Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- type Labels = Map String Label
- type Asm = StateT Labels SimpleUniqueMonad
- getLabel :: String -> Asm Label
- type Nodes n a = Free ((,) (n O O)) a
- nodesToList :: Nodes n a -> (a, [n O O])
- type BodyNode n = Nodes n ()
- bodyNode :: n O O -> BodyNode n
- type EndNode n = Nodes n (Asm (n O C))
- endNode :: Asm (n O C) -> EndNode n
- data ProgramF n = FreeBlock {
- labelEntry :: Label
- labelBody :: EndNode n
- type Program n = FreeT ((,) (ProgramF n)) Asm ()
- label :: String -> EndNode n -> Program n
- jump :: HooplNode n => String -> EndNode n
- compile :: (NonLocal n, HooplNode n) => String -> Program n -> (Graph n C C, Label)
Documentation
type Asm = StateT Labels SimpleUniqueMonad Source
The Asm
monad lets us create labels by name and refer to them later.
type Nodes n a = Free ((,) (n O O)) a Source
A series of Nodes
is a set of assembly instructions that ends with some
kind of closing operation, such as a jump, branch or return.
nodesToList :: Nodes n a -> (a, [n O O]) Source
The Nodes
free monad is really just a convenient way to describe a list
that must result in a closing operation at the end.