-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Compiler IR Compiler. -- -- A Compiler IR Compiler. @package circ @version 0.0.2 -- | The runtime library for CIRC generated code. module Language.CIRC.Runtime -- | The CIRC transform monad. Used to create fresh ids. type CIRC = State Int -- | Evaluates a CIRC transform. evalCIRC :: CIRC a -> Int -> a -- | Evaluates a CIRC transform, also returning the fresh next id. runCIRC :: CIRC a -> Int -> (a, Int) -- | Identifiers. type Id = String -- | Produces a fresh id. newId :: CIRC Id -- | Compiler IR Compiler (CIRC): A language for specifying compiler -- intermediate representations. module Language.CIRC -- | A specification is a module name for the initial type, common imports, -- the root type, the initial type definitions, and a list of transforms. data Spec Spec :: Name -> [Import] -> TypeName -> [TypeDef] -> [Transform] -> Spec -- | A transform is a module name, the constructor to be transformed, a -- list of new type definitions, and the implementation (imports and -- code). data Transform Transform :: ModuleName -> [Import] -> [Import] -> [(CtorName, ModuleName -> Code)] -> [TypeRefinement] -> Transform -- | A type expression. data Type T :: TypeName -> [Type] -> Type TList :: Type -> Type TMaybe :: Type -> Type TTuple :: [Type] -> Type -- | A type definition is a name, a list of type parameters, and a list of -- constructor definitions. data TypeDef TypeDef :: TypeName -> [TypeParam] -> [CtorDef] -> TypeDef -- | A constructor definition is a name and a list of type arguments. data CtorDef CtorDef :: CtorName -> [Type] -> CtorDef -- | A type refinement. data TypeRefinement NewCtor :: TypeName -> CtorDef -> (ModuleName -> Code) -> TypeRefinement NewType :: TypeDef -> TypeRefinement type Name = String type ModuleName = String type CtorName = String type TypeName = String type TypeParam = String type Code = String type Import = String -- | An unparameterized type. t :: String -> Type -- | Indents code with 2 spaces. indent :: String -> String -- | Compiles a CIRC spec. circ :: Spec -> IO ()