Copyright | (c) 2013-2015 Galois, Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
- newtype ModName = ModName [String]
- modRange :: Module -> Range
- data QName = QName (Maybe ModName) Name
- mkQual :: ModName -> Name -> QName
- mkUnqual :: Name -> QName
- unqual :: QName -> Name
- data Name
- data Named a = Named {}
- data Pass
- = NoPat
- | MonoValues
- data Schema = Forall [TParam] [Prop] Type (Maybe Range)
- data TParam = TParam {}
- tpQName :: TParam -> QName
- data Kind
- data Type
- data Prop
- data Module = Module {}
- newtype Program = Program [TopDecl]
- data TopDecl
- data Decl
- data TySyn = TySyn LQName [TParam] Type
- data Bind = Bind {}
- data Pragma
- data ExportType
- data ExportSpec = ExportSpec {}
- exportBind :: TopLevel QName -> ExportSpec
- exportType :: TopLevel QName -> ExportSpec
- isExportedBind :: QName -> ExportSpec -> Bool
- isExportedType :: QName -> ExportSpec -> Bool
- data TopLevel a = TopLevel {
- tlExport :: ExportType
- tlValue :: a
- data Import = Import {}
- data ImportSpec
- data Newtype = Newtype {}
- data ReplInput
- data Expr
- = EVar QName
- | ECon ECon
- | ELit Literal
- | ETuple [Expr]
- | ERecord [Named Expr]
- | ESel Expr Selector
- | EList [Expr]
- | EFromTo Type (Maybe Type) (Maybe Type)
- | EInfFrom Expr (Maybe Expr)
- | EComp Expr [[Match]]
- | EApp Expr Expr
- | EAppT Expr [TypeInst]
- | EIf Expr Expr Expr
- | EWhere Expr [Decl]
- | ETyped Expr Type
- | ETypeVal Type
- | EFun [Pattern] Expr
- | ELocated Expr Range
- data Literal
- data NumInfo
- data Match
- data Pattern
- data Selector
- data TypeInst
- data Located a = Located {}
- type LName = Located Name
- type LQName = Located QName
- type LString = Located String
- class NoPos t where
- noPos :: t -> t
- cppKind :: Kind -> Doc
- ppSelector :: Selector -> Doc
Names
Module names are just namespaces.
INVARIANT: the list of strings should never be empty in a valid module name.
Types
Declarations
Bindings. Notes:
The parser does not associate type signatures and pragmas with their bindings: this is done in a separate pass, after de-sugaring pattern bindings. In this way we can associate pragmas and type signatures with the variables defined by pattern bindings as well.
- Currently, there is no surface syntax for defining monomorphic bindings (i.e., bindings that will not be automatically generalized by the type checker. However, they are useful when de-sugaring patterns.
data ExportType Source
Export information for a declaration.
data ExportSpec Source
exportBind :: TopLevel QName -> ExportSpec Source
Add a binding name to the export list, if it should be exported.
exportType :: TopLevel QName -> ExportSpec Source
Add a type synonym name to the export list, if it should be exported.
isExportedBind :: QName -> ExportSpec -> Bool Source
Check to see if a binding is exported.
isExportedType :: QName -> ExportSpec -> Bool Source
Check to see if a type synonym is exported.
TopLevel | |
|
An import declaration.
data ImportSpec Source
Interactive
Input at the REPL, which can either be an expression or a let
statement.
Expressions
EVar QName | x |
ECon ECon | split |
ELit Literal | 0x10 |
ETuple [Expr] | (1,2,3) |
ERecord [Named Expr] | { x = 1, y = 2 } |
ESel Expr Selector | e.l |
EList [Expr] | [1,2,3] |
EFromTo Type (Maybe Type) (Maybe Type) | [1, 5 .. 117 ] |
EInfFrom Expr (Maybe Expr) | [1, 3 ...] |
EComp Expr [[Match]] | [ 1 | x <- xs ] |
EApp Expr Expr | f x |
EAppT Expr [TypeInst] | f `{x = 8}, f`{8} |
EIf Expr Expr Expr | if ok then e1 else e2 |
EWhere Expr [Decl] | 1 + x where { x = 2 } |
ETyped Expr Type | 1 : [8] |
ETypeVal Type |
|
EFun [Pattern] Expr | \x y -> x |
ELocated Expr Range | position annotation |
Literals.
Infromation about the representation of a numeric constant.
Selectors are used for projecting from various components. Each selector has an option spec to specify the shape of the thing that is being selected. Currently, there is no surface syntax for list selectors, but they are used during the desugaring of patterns.
Positions
NoPos Prop | |
NoPos Type | |
NoPos TParam | |
NoPos Schema | |
NoPos Pattern | |
NoPos Match | |
NoPos TypeInst | |
NoPos Expr | |
NoPos Newtype | |
NoPos Pragma | |
NoPos Bind | |
NoPos TySyn | |
NoPos Decl | |
NoPos TopDecl | |
NoPos Module | |
NoPos Program | |
NoPos t => NoPos [t] | |
NoPos t => NoPos (Maybe t) | |
NoPos (Located t) | |
NoPos t => NoPos (Named t) | |
NoPos a => NoPos (TopLevel a) |
Pretty-printing
Conversational printing of kinds (e.g., to use in error messages)
ppSelector :: Selector -> Doc Source
Display the thing selected by the selector, nicely.