| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Monad.Free.Foil.Binary
Contents
Description
Binary instances for the scope-safe syntax: the wire view of a term
is the term itself, raw ids and all.
The instances are deliberately orphans in a module of their own, so that
they are opt-in: importing this module is what brings them into scope,
and nothing else in the library does. (The dependency this costs is
binary, a GHC boot library.)
Note that decoding mints scope evidence: a Name comes back at
whatever scope index the context asks for, and the existential scope
under a binder is chosen arbitrarily. Thus the instances are a trust
boundary, in the sense of checkExtScope. The
bytes are meaningful only under the discipline of the layer that wrote
them, and that layer is expected to validate what it can on the way in.
In particular, it should resolve the references it made
world-independent, and check that the names it left verbatim lie where its
allocation policy says. Control.Monad.Free.Foil.Artifact supplies those
checks.
Orphan instances
| Binary NameRange Source # | The two bounds. A range carries no scope index, so nothing is minted: this instance is layout metadata for the serialising layer. |
| Binary (Name n) Source # | The raw id and nothing else. See the module documentation for what decoding trusts. |
| Binary (NameBinder n l) Source # | |
Methods put :: NameBinder n l -> Put # get :: Get (NameBinder n l) # putList :: [NameBinder n l] -> Put # | |
| (forall (x :: S) (y :: S). Binary (binder x y), forall scope term. (Binary scope, Binary term) => Binary (sig scope term)) => Binary (AST binder sig n) Source # | A tag byte, then the name or the node. |
| (forall (x :: S) (y :: S). Binary (binder x y), forall (l :: S). Binary (AST binder sig l)) => Binary (ScopedAST binder sig n) Source # | The binder and the body, one after the other. Decoding mints the scope under the binder. See the module documentation. |