Copyright | (c) 2013-2016 Galois, Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
- data Ident
- mkIdent :: Text -> Ident
- mkInfix :: Text -> Ident
- isInfixIdent :: Ident -> Bool
- nullIdent :: Ident -> Bool
- identText :: Ident -> Text
- type ModName = Text
- modRange :: Module name -> Range
- data PName
- getModName :: PName -> Maybe ModName
- getIdent :: PName -> Ident
- mkUnqual :: Ident -> PName
- mkQual :: ModName -> Ident -> PName
- data Named a = Named {}
- data Pass
- = NoPat
- | MonoValues
- data Assoc
- data Schema n = Forall [TParam n] [Prop n] (Type n) (Maybe Range)
- data TParam n = TParam {}
- data Kind
- data Type n
- data Prop n
- data Module name = Module {}
- newtype Program name = Program [TopDecl name]
- data TopDecl name
- data Decl name
- data Fixity = Fixity {}
- defaultFixity :: Fixity
- data FixityCmp
- compareFixity :: Fixity -> Fixity -> FixityCmp
- data TySyn n = TySyn (Located n) [TParam n] (Type n)
- data Bind name = Bind {}
- data BindDef name
- type LBindDef = Located (BindDef PName)
- data Pragma
- data ExportType
- data ExportSpec name = ExportSpec {}
- exportBind :: Ord name => TopLevel name -> ExportSpec name
- exportType :: Ord name => TopLevel name -> ExportSpec name
- isExportedBind :: Ord name => name -> ExportSpec name -> Bool
- isExportedType :: Ord name => name -> ExportSpec name -> Bool
- data TopLevel a = TopLevel {}
- data Import = Import {}
- data ImportSpec
- data Newtype name = Newtype {}
- data ReplInput name
- data Expr n
- = EVar n
- | ELit Literal
- | ETuple [Expr n]
- | ERecord [Named (Expr n)]
- | ESel (Expr n) Selector
- | EList [Expr n]
- | EFromTo (Type n) (Maybe (Type n)) (Maybe (Type n))
- | EInfFrom (Expr n) (Maybe (Expr n))
- | EComp (Expr n) [[Match n]]
- | EApp (Expr n) (Expr n)
- | EAppT (Expr n) [TypeInst n]
- | EIf (Expr n) (Expr n) (Expr n)
- | EWhere (Expr n) [Decl n]
- | ETyped (Expr n) (Type n)
- | ETypeVal (Type n)
- | EFun [Pattern n] (Expr n)
- | ELocated (Expr n) Range
- | EParens (Expr n)
- | EInfix (Expr n) (Located n) Fixity (Expr n)
- data Literal
- data NumInfo
- data Match name
- data Pattern n
- data Selector
- data TypeInst name
- data Located a = Located {}
- type LPName = Located PName
- type LString = Located String
- type LIdent = Located Ident
- class NoPos t where
- noPos :: t -> t
- cppKind :: Kind -> Doc
- ppSelector :: Selector -> Doc
Names
Identifiers, along with a flag that indicates whether or not they're infix operators. The boolean is present just as cached information from the lexer, and never used during comparisons.
isInfixIdent :: Ident -> Bool Source
Names that originate in the parser.
UnQual !Ident | Unqualified names like |
Qual !ModName !Ident | Qualified names like |
NewName !Pass !Int | Fresh names generated by a pass. |
Eq PName Source | |
Ord PName Source | |
Show PName Source | |
Generic PName Source | |
NFData PName Source | |
PPName PName Source | |
PP PName Source | |
RemovePatterns [Decl PName] Source | |
RemovePatterns (Expr PName) Source | |
RemovePatterns (Module PName) Source | |
RemovePatterns (Program PName) Source | |
BindsNames (TParam PName) Source | Generate the naming environment for a type parameter. |
BindsNames (Schema PName) Source | Generate a type renaming environment from the parameters that are bound by this schema. |
BindsNames (Module PName) Source | The naming environment for a single module. This is the mapping from unqualified names to fully qualified names with uniques. |
BindsNames (InModule (Newtype PName)) Source | |
BindsNames (InModule (Bind PName)) Source | Introduce the name |
BindsNames (InModule (Decl PName)) Source | The naming environment for a single declaration. |
BindsNames (InModule (TopDecl PName)) Source | |
type Rep PName Source |
getModName :: PName -> Maybe ModName Source
Passes that can generate fresh names.
Information about associativity.
Types
Rename Schema Source | Rename a schema, assuming that none of its type variables are already in scope. |
Eq n => Eq (Schema n) Source | |
Show n => Show (Schema n) Source | |
Generic (Schema n) Source | |
NFData name => NFData (Schema name) Source | |
PPName name => PP (Schema name) Source | |
AddLoc (Schema name) Source | |
HasLoc (Schema name) Source | |
NoPos (Schema name) Source | |
BindsNames (Schema PName) Source | Generate a type renaming environment from the parameters that are bound by this schema. |
type Rep (Schema n) Source |
Rename TParam Source | |
Eq n => Eq (TParam n) Source | |
Show n => Show (TParam n) Source | |
Generic (TParam n) Source | |
NFData name => NFData (TParam name) Source | |
PPName name => PP (TParam name) Source | |
AddLoc (TParam name) Source | |
HasLoc (TParam name) Source | |
NoPos (TParam name) Source | |
BindsNames (TParam PName) Source | Generate the naming environment for a type parameter. |
type Rep (TParam n) Source |
TFun (Type n) (Type n) | [8] -> [8] |
TSeq (Type n) (Type n) | [8] a |
TBit | Bit |
TNum Integer | 10 |
TChar Char |
|
TInf | inf |
TUser n [Type n] | A type variable or synonym |
TApp TFun [Type n] | 2 + x |
TRecord [Named (Type n)] | { x : [8], y : [32] } |
TTuple [Type n] | ([8], [32]) |
TWild |
|
TLocated (Type n) Range | Location information |
TParens (Type n) | (ty) |
TInfix (Type n) (Located n) Fixity (Type n) | ty + ty |
Rename Type Source | Resolve fixity, then rename the resulting type. |
Eq n => Eq (Type n) Source | |
Show n => Show (Type n) Source | |
Generic (Type n) Source | |
NFData name => NFData (Type name) Source | |
PPName name => PP (Type name) Source | |
AddLoc (Type name) Source | |
HasLoc (Type name) Source | |
NoPos (Type name) Source | |
type Rep (Type n) Source |
Declarations
Show name => Show (Module name) Source | |
Generic (Module name) Source | |
NFData name => NFData (Module name) Source | |
(Show name, PPName name) => PP (Module name) Source | |
HasLoc (Module name) Source | |
NoPos (Module name) Source | |
RemovePatterns (Module PName) Source | |
BindsNames (Module PName) Source | The naming environment for a single module. This is the mapping from unqualified names to fully qualified names with uniques. |
type Rep (Module name) Source |
Rename TopDecl Source | |
Show name => Show (TopDecl name) Source | |
Generic (TopDecl name) Source | |
NFData name => NFData (TopDecl name) Source | |
(Show name, PPName name) => PP (TopDecl name) Source | |
HasLoc (TopDecl name) Source | |
NoPos (TopDecl name) Source | |
BindsNames (InModule (TopDecl PName)) Source | |
FromDecl (TopDecl Name) Source | |
type Rep (TopDecl name) Source |
DSignature [Located name] (Schema name) | |
DFixity !Fixity [Located name] | |
DPragma [Located name] Pragma | |
DBind (Bind name) | |
DPatBind (Pattern name) (Expr name) | |
DType (TySyn name) | |
DLocated (Decl name) Range |
Rename Decl Source | |
Eq name => Eq (Decl name) Source | |
Show name => Show (Decl name) Source | |
Generic (Decl name) Source | |
NFData name => NFData (Decl name) Source | |
(Show name, PPName name) => PP (Decl name) Source | |
AddLoc (Decl name) Source | |
HasLoc (Decl name) Source | |
NoPos (Decl name) Source | |
RemovePatterns [Decl PName] Source | |
BindsNames (InModule (Decl PName)) Source | The naming environment for a single declaration. |
FromDecl (Decl Name) Source | |
type Rep (Decl name) Source |
defaultFixity :: Fixity Source
The fixity used when none is provided.
compareFixity :: Fixity -> Fixity -> FixityCmp Source
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.
Bind | |
|
Rename Bind Source | Rename a binding. |
Eq name => Eq (Bind name) Source | |
Show name => Show (Bind name) Source | |
Generic (Bind name) Source | |
NFData name => NFData (Bind name) Source | |
(Show name, PPName name) => PP (Bind name) Source | |
HasLoc (Bind name) Source | |
NoPos (Bind name) Source | |
BindsNames (InModule (Bind PName)) Source | Introduce the name |
type Rep (Bind name) Source |
data ExportType Source
Export information for a declaration.
data ExportSpec name Source
Show name => Show (ExportSpec name) Source | |
Generic (ExportSpec name) Source | |
Ord name => Monoid (ExportSpec name) Source | |
NFData name => NFData (ExportSpec name) Source | |
type Rep (ExportSpec name) Source |
exportBind :: Ord name => TopLevel name -> ExportSpec name Source
Add a binding name to the export list, if it should be exported.
exportType :: Ord name => TopLevel name -> ExportSpec name Source
Add a type synonym name to the export list, if it should be exported.
isExportedBind :: Ord name => name -> ExportSpec name -> Bool Source
Check to see if a binding is exported.
isExportedType :: Ord name => name -> ExportSpec name -> Bool Source
Check to see if a type synonym is exported.
Functor TopLevel Source | |
Foldable TopLevel Source | |
Traversable TopLevel Source | |
Show a => Show (TopLevel a) Source | |
Generic (TopLevel a) Source | |
NFData a => NFData (TopLevel a) Source | |
PP a => PP (TopLevel a) Source | |
HasLoc a => HasLoc (TopLevel a) Source | |
NoPos a => NoPos (TopLevel a) Source | |
type Rep (TopLevel a) Source |
An import declaration.
data ImportSpec Source
The list of names following an import.
INVARIANT: All of the Name
entries in the list are expected to be
unqualified names; the QName
or NewName
constructors should not be
present.
Rename Newtype Source | |
Eq name => Eq (Newtype name) Source | |
Show name => Show (Newtype name) Source | |
Generic (Newtype name) Source | |
NFData name => NFData (Newtype name) Source | |
PPName name => PP (Newtype name) Source | |
HasLoc (Newtype name) Source | |
NoPos (Newtype name) Source | |
BindsNames (InModule (Newtype PName)) Source | |
type Rep (Newtype name) Source |
Interactive
Input at the REPL, which can either be an expression or a let
statement.
Expressions
EVar n | x |
ELit Literal | 0x10 |
ETuple [Expr n] | (1,2,3) |
ERecord [Named (Expr n)] | { x = 1, y = 2 } |
ESel (Expr n) Selector | e.l |
EList [Expr n] | [1,2,3] |
EFromTo (Type n) (Maybe (Type n)) (Maybe (Type n)) | [1, 5 .. 117 ] |
EInfFrom (Expr n) (Maybe (Expr n)) | [1, 3 ...] |
EComp (Expr n) [[Match n]] | [ 1 | x <- xs ] |
EApp (Expr n) (Expr n) | f x |
EAppT (Expr n) [TypeInst n] | f `{x = 8}, f`{8} |
EIf (Expr n) (Expr n) (Expr n) | if ok then e1 else e2 |
EWhere (Expr n) [Decl n] | 1 + x where { x = 2 } |
ETyped (Expr n) (Type n) | 1 : [8] |
ETypeVal (Type n) |
|
EFun [Pattern n] (Expr n) | \x y -> x |
ELocated (Expr n) Range | position annotation |
EParens (Expr n) |
|
EInfix (Expr n) (Located n) Fixity (Expr n) |
|
Rename Expr Source | |
Eq n => Eq (Expr n) Source | |
Show n => Show (Expr n) Source | |
Generic (Expr n) Source | |
NFData name => NFData (Expr name) Source | |
(Show name, PPName name) => PP (Expr name) Source | |
AddLoc (Expr n) Source | |
HasLoc (Expr name) Source | |
NoPos (Expr name) Source | |
RemovePatterns (Expr PName) Source | |
type Rep (Expr n) Source |
Literals.
Infromation about the representation of a numeric constant.
PVar (Located n) | x |
PWild | _ |
PTuple [Pattern n] | (x,y,z) |
PRecord [Named (Pattern n)] | { x = (a,b,c), y = z } |
PList [Pattern n] | [ x, y, z ] |
PTyped (Pattern n) (Type n) | x : [8] |
PSplit (Pattern n) (Pattern n) | (x # y) |
PLocated (Pattern n) Range | Location information |
Rename Pattern Source | |
Eq n => Eq (Pattern n) Source | |
Show n => Show (Pattern n) Source | |
Generic (Pattern n) Source | |
NFData name => NFData (Pattern name) Source | |
PPName name => PP (Pattern name) Source | |
AddLoc (Pattern name) Source | |
HasLoc (Pattern name) Source | |
NoPos (Pattern name) Source | |
type Rep (Pattern n) Source |
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
Functor Located Source | |
Eq a => Eq (Located a) Source | |
Show a => Show (Located a) Source | |
Generic (Located a) Source | |
NFData a => NFData (Located a) Source | |
PPName a => PPName (Located a) Source | |
PP a => PP (Located a) Source | |
AddLoc (Located a) Source | |
HasLoc (Located a) Source | |
NoPos (Located t) Source | |
type Rep (Located a) Source |
NoPos Pragma Source | |
NoPos t => NoPos [t] Source | |
NoPos t => NoPos (Maybe t) Source | |
NoPos (Located t) Source | |
NoPos (Prop name) Source | |
NoPos (Type name) Source | |
NoPos (TParam name) Source | |
NoPos (Schema name) Source | |
NoPos t => NoPos (Named t) Source | |
NoPos (Pattern name) Source | |
NoPos (Match name) Source | |
NoPos (TypeInst name) Source | |
NoPos (Expr name) Source | |
NoPos a => NoPos (TopLevel a) Source | |
NoPos (Newtype name) Source | |
NoPos (Bind name) Source | |
NoPos (TySyn name) Source | |
NoPos (Decl name) Source | |
NoPos (TopDecl name) Source | |
NoPos (Module name) Source | |
NoPos (Program name) Source |
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.