Agda-2.5.2: A dependently typed functional programming language and proof assistant

Safe Haskell | None
Language | Haskell2010

Agda.Compiler.MAlonzo.Compiler

Synopsis

- compilerMain :: IsMain -> Interface -> TCM ()
- compile :: Interface -> TCM ()
- imports :: TCM [ImportDecl]
- definitions :: Definitions -> TCM [Decl]
- definition :: Maybe CoinductionKit -> Definition -> TCM [Decl]
- data CCEnv = CCEnv {
  - ccNameSupply :: NameSupply
  - ccCxt :: CCContext
  }
- type NameSupply = [Name]
- type CCContext = [Name]
- mapNameSupply :: (NameSupply -> NameSupply) -> CCEnv -> CCEnv
- mapContext :: (CCContext -> CCContext) -> CCEnv -> CCEnv
- initCCEnv :: CCEnv
- lookupIndex :: Int -> CCContext -> Name
- type CC = ReaderT CCEnv TCM
- freshNames :: Int -> ([Name] -> CC a) -> CC a
- intros :: Int -> ([Name] -> CC a) -> CC a
- checkConstructorType :: QName -> TCM [Decl]
- checkCover :: QName -> HaskellType -> Nat -> [QName] -> TCM [Decl]
- closedTerm :: TTerm -> TCM Exp
- term :: TTerm -> CC Exp
- compilePrim :: TPrim -> Exp
- alt :: Int -> TAlt -> CC Alt
- literal :: Literal -> Exp
- hslit :: Literal -> Literal
- litString :: String -> Exp
- litqname :: QName -> Exp
- litqnamepat :: QName -> Pat
- erasedArity :: QName -> TCM Nat
- condecl :: QName -> TCM (Nat, ConDecl)
- cdecl :: QName -> Nat -> ConDecl
- tvaldecl :: QName -> Induction -> Nat -> Nat -> [ConDecl] -> Maybe Clause -> [Decl]
- infodecl :: QName -> [Decl] -> [Decl]
- hsCast :: Exp -> Exp
- hsCast' :: Exp -> Exp
- hsCastApp :: Exp -> Exp
- hsCoerce :: Exp -> Exp
- copyRTEModules :: TCM ()
- writeModule :: Module -> TCM ()
- outFile' :: Pretty a => a -> TCM (FilePath, FilePath)
- outFile :: ModuleName -> TCM FilePath
- outFile_ :: TCM FilePath
- callGHC :: IsMain -> Interface -> TCM ()

# Documentation

compilerMain :: IsMain -> Interface -> TCM () #

compile :: Interface -> TCM () #

imports :: TCM [ImportDecl] #

definitions :: Definitions -> TCM [Decl] #

definition :: Maybe CoinductionKit -> Definition -> TCM [Decl] #

Note that the INFINITY, SHARP and FLAT builtins are translated as follows (if a `CoinductionKit` is given):

      type Infinity a b = b

      sharp :: a -> a
      sharp x = x

      flat :: a -> a
      flat x = x

data CCEnv #

Environment for naming of local variables. Invariant: `reverse ccCxt ++ ccNameSupply`

Constructors

CCEnv |
Fields ccNameSupply :: NameSupply Supply of fresh names ccCxt :: CCContext Names currently in scope

type NameSupply = [Name] #

type CCContext = [Name] #

mapNameSupply :: (NameSupply -> NameSupply) -> CCEnv -> CCEnv #

mapContext :: (CCContext -> CCContext) -> CCEnv -> CCEnv #

initCCEnv :: CCEnv #

Initial environment for expression generation.

lookupIndex :: Int -> CCContext -> Name #

Term variables are de Bruijn indices.

type CC = ReaderT CCEnv TCM #

freshNames :: Int -> ([Name] -> CC a) -> CC a #

intros :: Int -> ([Name] -> CC a) -> CC a #

Introduce n variables into the context.

checkConstructorType :: QName -> TCM [Decl] #

checkCover :: QName -> HaskellType -> Nat -> [QName] -> TCM [Decl] #

closedTerm :: TTerm -> TCM Exp #

term :: TTerm -> CC Exp #

Extract Agda term to Haskell expression. Erased arguments are extracted as `()`. Types are extracted as `()`.

compilePrim :: TPrim -> Exp #

alt :: Int -> TAlt -> CC Alt #

literal :: Literal -> Exp #

hslit :: Literal -> Literal #

litString :: String -> Exp #

litqname :: QName -> Exp #

litqnamepat :: QName -> Pat #

erasedArity :: QName -> TCM Nat #

condecl :: QName -> TCM (Nat, ConDecl) #

cdecl :: QName -> Nat -> ConDecl #

tvaldecl #

Arguments

:: QName |
-> Induction | Is the type inductive or coinductive?
-> Nat |
-> Nat |
-> [ConDecl] |
-> Maybe Clause |
-> [Decl] |

infodecl :: QName -> [Decl] -> [Decl] #

hsCast :: Exp -> Exp #

hsCast' :: Exp -> Exp #

hsCastApp :: Exp -> Exp #

hsCoerce :: Exp -> Exp #

copyRTEModules :: TCM () #

writeModule :: Module -> TCM () #

outFile' :: Pretty a => a -> TCM (FilePath, FilePath) #

outFile :: ModuleName -> TCM FilePath #

outFile_ :: TCM FilePath #

callGHC :: IsMain -> Interface -> TCM () #