Safe Haskell | Safe-Inferred |
---|
Compilation Monad and combinators for quickly assembling simple compilers.
Control/Compilation.hs
A generic compilation monad for quickly assembling simple compilers.
- type FreshIndex = Integer
- type Indentation = String
- type ModuleName = String
- type NestingDepth = Integer
- data State a = State FreshIndex Indentation (Maybe ModuleName) NestingDepth a
- class StateExtension a where
- initial :: a
- type Compile a b = Compilation a b
- data Compilation a b
- = Compilation (State a -> (State a, b))
- | Error String
- extract :: StateExtension a => Compilation a b -> a
- extractFromState :: StateExtension a => a -> Compilation a b -> a
- nothing :: Compilation a ()
- get :: StateExtension a => Compilation a a
- set :: StateExtension a => a -> Compilation a ()
- error :: String -> Compilation a ()
Documentation
type FreshIndex = IntegerSource
Data types, class declarations, and class memberships.
type Indentation = StringSource
type ModuleName = StringSource
type NestingDepth = IntegerSource
type Compile a b = Compilation a bSource
data Compilation a b Source
Compilation (State a -> (State a, b)) | |
Error String |
StateExtension a => Monad (Compilation a) | Standard state monad definition. |
extract :: StateExtension a => Compilation a b -> aSource
Generic combinators and functions.
extractFromState :: StateExtension a => a -> Compilation a b -> aSource
nothing :: Compilation a ()Source
get :: StateExtension a => Compilation a aSource
set :: StateExtension a => a -> Compilation a ()Source
error :: String -> Compilation a ()Source