Safe Haskell | None |
---|
Core language parser.
- type Parser n a = Parser (Tok n) a
- data Context = Context {
- contextTrackedEffects :: Bool
- contextTrackedClosures :: Bool
- contextFunctionalEffects :: Bool
- contextFunctionalClosures :: Bool
- contextOfProfile :: Profile n -> Context
- pType :: Ord n => Context -> Parser n (Type n)
- pTypeApp :: Ord n => Context -> Parser n (Type n)
- pTypeAtom :: Ord n => Context -> Parser n (Type n)
- pModule :: (Ord n, Pretty n) => Context -> Parser n (Module SourcePos n)
- pModuleName :: Pretty n => Parser n ModuleName
- pExp :: Ord n => Context -> Parser n (Exp SourcePos n)
- pExpApp :: Ord n => Context -> Parser n (Exp SourcePos n)
- pExpAtom :: Ord n => Context -> Parser n (Exp SourcePos n)
- data ParamSpec n
- = ParamType (Bind n)
- | ParamWitness (Bind n)
- | ParamValue (Bind n) (Type n) (Type n)
- funTypeOfParams :: Context -> [ParamSpec n] -> Type n -> Type n
- expOfParams :: a -> [ParamSpec n] -> Exp a n -> Exp a n
- pBindParamSpecAnnot :: Ord n => Context -> Parser n [ParamSpec n]
- pBindParamSpec :: Ord n => Context -> Parser n [ParamSpec n]
- pWitness :: Ord n => Context -> Parser n (Witness SourcePos n)
- pWitnessApp :: Ord n => Context -> Parser n (Witness SourcePos n)
- pWitnessAtom :: Ord n => Context -> Parser n (Witness SourcePos n)
- pCon :: Parser n n
- pConSP :: Parser n (n, SourcePos)
- pLit :: Parser n n
- pLitSP :: Parser n (n, SourcePos)
- pIndex :: Parser n Int
- pIndexSP :: Parser n (Int, SourcePos)
- pVar :: Parser n n
- pVarSP :: Parser n (n, SourcePos)
- pBinder :: Ord n => Parser n (Binder n)
- pName :: Parser n n
- pOpSP :: Parser n (String, SourcePos)
- pOpVarSP :: Parser n (String, SourcePos)
- pTok :: TokAtom -> Parser n ()
- pTokSP :: TokAtom -> Parser n SourcePos
- pTokAs :: TokAtom -> a -> Parser n a
Documentation
Configuration and information from the context. Used for context sensitive parsing.
Context | |
|
Types
pTypeAtom :: Ord n => Context -> Parser n (Type n)Source
Parse a variable, constructor or parenthesised type.
Modules
pModuleName :: Pretty n => Parser n ModuleNameSource
Parse a module name.
Expressions
pExpAtom :: Ord n => Context -> Parser n (Exp SourcePos n)Source
Parse a variable, constructor or parenthesised expression.
Function Parameters
Specification of a function parameter. We can determine the contribution to the type of the function, as well as its expression based on the parameter.
ParamType (Bind n) | |
ParamWitness (Bind n) | |
ParamValue (Bind n) (Type n) (Type n) |
:: Context | |
-> [ParamSpec n] | Spec of parameters. |
-> Type n | Type of body. |
-> Type n | Type of whole function. |
Build the type of a function from specifications of its parameters, and the type of the body.
:: a | |
-> [ParamSpec n] | Spec of parameters. |
-> Exp a n | Body of function. |
-> Exp a n | Expression of whole function. |
Build the expression of a function from specifications of its parameters, and the expression for the body.
pBindParamSpecAnnot :: Ord n => Context -> Parser n [ParamSpec n]Source
Parse a function parameter specification, requiring a full type (or kind) annotation.
pBindParamSpec :: Ord n => Context -> Parser n [ParamSpec n]Source
Parse a function parameter specification, with an optional type (or kind) annotation.
Witnesses
pWitnessAtom :: Ord n => Context -> Parser n (Witness SourcePos n)Source
Parse a variable, constructor or parenthesised witness.