cryptol-2.5.0: Cryptol: The Language of Cryptography

Copyright(c) 2013-2016 Galois Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Cryptol.TypeCheck.AST

Description

 

Synopsis

Documentation

data Module Source #

A Cryptol module.

data Expr Source #

Constructors

EList [Expr] Type

List value (with type of elements)

ETuple [Expr]

Tuple value

ERec [(Ident, Expr)]

Record value

ESel Expr Selector

Elimination for tuplerecordlist

EIf Expr Expr Expr

If-then-else

EComp Type Type Expr [[Match]]

List comprehensions The types cache the length of the sequence and its element type.

EVar Name

Use of a bound variable

ETAbs TParam Expr

Function Value

ETApp Expr Type

Type application

EApp Expr Expr

Function application

EAbs Name Type Expr

Function value

EProofAbs Prop Expr

Proof abstraction. Because we don't keep proofs around we don't need to name the assumption, but we still need to record the assumption. The assumption is the Type term, which should be of kind KProp.

EProofApp Expr

If `e : p => t`, then `EProofApp e : t`, as long as we can prove p.

We don't record the actual proofs, as they are not used for anything. It may be nice to keep them around for sanity checking.

EWhere Expr [DeclGroup] 

Instances

Show Expr Source # 

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

Generic Expr Source # 

Associated Types

type Rep Expr :: * -> * #

Methods

from :: Expr -> Rep Expr x #

to :: Rep Expr x -> Expr #

NFData Expr Source # 

Methods

rnf :: Expr -> () #

PP Expr Source # 

Methods

ppPrec :: Int -> Expr -> Doc Source #

TVars Expr Source # 

Methods

apSubst :: Subst -> Expr -> Expr Source #

PP (WithNames Expr) Source # 

Methods

ppPrec :: Int -> WithNames Expr -> Doc Source #

type Rep Expr Source # 
type Rep Expr = D1 (MetaData "Expr" "Cryptol.TypeCheck.AST" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "EList" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Expr])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))) ((:+:) (C1 (MetaCons "ETuple" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Expr]))) (C1 (MetaCons "ERec" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Ident, Expr)]))))) ((:+:) ((:+:) (C1 (MetaCons "ESel" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Selector)))) (C1 (MetaCons "EIf" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)))))) ((:+:) (C1 (MetaCons "EComp" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[Match]]))))) (C1 (MetaCons "EVar" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Name)))))) ((:+:) ((:+:) (C1 (MetaCons "ETAbs" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TParam)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)))) ((:+:) (C1 (MetaCons "ETApp" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))) (C1 (MetaCons "EApp" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)))))) ((:+:) ((:+:) (C1 (MetaCons "EAbs" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Name)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr))))) (C1 (MetaCons "EProofAbs" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Prop)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr))))) ((:+:) (C1 (MetaCons "EProofApp" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr))) (C1 (MetaCons "EWhere" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [DeclGroup]))))))))

data DeclGroup Source #

Constructors

Recursive [Decl]

Mutually recursive declarations

NonRecursive Decl

Non-recursive declaration

data Decl Source #

data DeclDef Source #

Constructors

DPrim 
DExpr Expr 

Instances

Show DeclDef Source # 
Generic DeclDef Source # 

Associated Types

type Rep DeclDef :: * -> * #

Methods

from :: DeclDef -> Rep DeclDef x #

to :: Rep DeclDef x -> DeclDef #

NFData DeclDef Source # 

Methods

rnf :: DeclDef -> () #

TVars DeclDef Source # 
PP (WithNames DeclDef) Source # 
type Rep DeclDef Source # 
type Rep DeclDef = D1 (MetaData "DeclDef" "Cryptol.TypeCheck.AST" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) ((:+:) (C1 (MetaCons "DPrim" PrefixI False) U1) (C1 (MetaCons "DExpr" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Expr))))

ePrim :: PrimMap -> Ident -> Expr Source #

Construct a primitive, given a map to the unique names of the Cryptol module.

eError :: PrimMap -> Type -> String -> Expr Source #

Make an expression that is error pre-applied to a type and a message.

ppLam :: NameMap -> Int -> [TParam] -> [Prop] -> [(Name, Type)] -> Expr -> Doc Source #

splitWhile :: (a -> Maybe (b, a)) -> a -> ([b], a) Source #

data Name Source #

Instances

Eq Name Source # 

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Ord Name Source # 

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Show Name Source # 

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

Generic Name Source # 

Associated Types

type Rep Name :: * -> * #

Methods

from :: Name -> Rep Name x #

to :: Rep Name x -> Name #

NFData Name Source # 

Methods

rnf :: Name -> () #

PPName Name Source # 
PP Name Source # 

Methods

ppPrec :: Int -> Name -> Doc Source #

FromDecl (Decl Name) Source # 
FromDecl (TopDecl Name) Source # 
type Rep Name Source # 

data TFun Source #

Built-in types.

Constructors

TCAdd
 : Num -> Num -> Num
TCSub
 : Num -> Num -> Num
TCMul
 : Num -> Num -> Num
TCDiv
 : Num -> Num -> Num
TCMod
 : Num -> Num -> Num
TCExp
 : Num -> Num -> Num
TCWidth
 : Num -> Num
TCMin
 : Num -> Num -> Num
TCMax
 : Num -> Num -> Num
TCLenFromThen

: Num -> Num -> Num -> Num Example: [ 1, 5 .. ] :: [lengthFromThen 1 5 b][b]

TCLenFromThenTo

: Num -> Num -> Num -> Num Example: [ 1, 5 .. 9 ] :: [lengthFromThenTo 1 5 9][b]

Instances

Bounded TFun Source # 
Enum TFun Source # 

Methods

succ :: TFun -> TFun #

pred :: TFun -> TFun #

toEnum :: Int -> TFun #

fromEnum :: TFun -> Int #

enumFrom :: TFun -> [TFun] #

enumFromThen :: TFun -> TFun -> [TFun] #

enumFromTo :: TFun -> TFun -> [TFun] #

enumFromThenTo :: TFun -> TFun -> TFun -> [TFun] #

Eq TFun Source # 

Methods

(==) :: TFun -> TFun -> Bool #

(/=) :: TFun -> TFun -> Bool #

Ord TFun Source # 

Methods

compare :: TFun -> TFun -> Ordering #

(<) :: TFun -> TFun -> Bool #

(<=) :: TFun -> TFun -> Bool #

(>) :: TFun -> TFun -> Bool #

(>=) :: TFun -> TFun -> Bool #

max :: TFun -> TFun -> TFun #

min :: TFun -> TFun -> TFun #

Show TFun Source # 

Methods

showsPrec :: Int -> TFun -> ShowS #

show :: TFun -> String #

showList :: [TFun] -> ShowS #

Generic TFun Source # 

Associated Types

type Rep TFun :: * -> * #

Methods

from :: TFun -> Rep TFun x #

to :: Rep TFun x -> TFun #

NFData TFun Source # 

Methods

rnf :: TFun -> () #

PPName TFun Source # 
PP TFun Source # 

Methods

ppPrec :: Int -> TFun -> Doc Source #

HasKind TFun Source # 

Methods

kindOf :: TFun -> Kind Source #

type Rep TFun Source # 
type Rep TFun = D1 (MetaData "TFun" "Cryptol.Prims.Syntax" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "TCAdd" PrefixI False) U1) (C1 (MetaCons "TCSub" PrefixI False) U1)) ((:+:) (C1 (MetaCons "TCMul" PrefixI False) U1) ((:+:) (C1 (MetaCons "TCDiv" PrefixI False) U1) (C1 (MetaCons "TCMod" PrefixI False) U1)))) ((:+:) ((:+:) (C1 (MetaCons "TCExp" PrefixI False) U1) ((:+:) (C1 (MetaCons "TCWidth" PrefixI False) U1) (C1 (MetaCons "TCMin" PrefixI False) U1))) ((:+:) (C1 (MetaCons "TCMax" PrefixI False) U1) ((:+:) (C1 (MetaCons "TCLenFromThen" PrefixI False) U1) (C1 (MetaCons "TCLenFromThenTo" PrefixI False) U1)))))

data Selector 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.

Constructors

TupleSel Int (Maybe Int)

Zero-based tuple selection. Optionally specifies the shape of the tuple (one-based).

RecordSel Ident (Maybe [Ident])

Record selection. Optionally specifies the shape of the record.

ListSel Int (Maybe Int)

List selection. Optionally specifies the length of the list.

Instances

Eq Selector Source # 
Ord Selector Source # 
Show Selector Source # 
Generic Selector Source # 

Associated Types

type Rep Selector :: * -> * #

Methods

from :: Selector -> Rep Selector x #

to :: Rep Selector x -> Selector #

NFData Selector Source # 

Methods

rnf :: Selector -> () #

PP Selector Source # 

Methods

ppPrec :: Int -> Selector -> Doc Source #

type Rep Selector Source # 

data Import Source #

An import declaration.

Constructors

Import 

Instances

Eq Import Source # 

Methods

(==) :: Import -> Import -> Bool #

(/=) :: Import -> Import -> Bool #

Show Import Source # 
Generic Import Source # 

Associated Types

type Rep Import :: * -> * #

Methods

from :: Import -> Rep Import x #

to :: Rep Import x -> Import #

NFData Import Source # 

Methods

rnf :: Import -> () #

PP Import Source # 

Methods

ppPrec :: Int -> Import -> Doc Source #

type Rep Import Source # 

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.

Constructors

Hiding [Ident] 
Only [Ident] 

data ExportType Source #

Export information for a declaration.

Constructors

Public 
Private 

data ExportSpec name Source #

Constructors

ExportSpec 

Fields

Instances

Show name => Show (ExportSpec name) Source # 

Methods

showsPrec :: Int -> ExportSpec name -> ShowS #

show :: ExportSpec name -> String #

showList :: [ExportSpec name] -> ShowS #

Generic (ExportSpec name) Source # 

Associated Types

type Rep (ExportSpec name) :: * -> * #

Methods

from :: ExportSpec name -> Rep (ExportSpec name) x #

to :: Rep (ExportSpec name) x -> ExportSpec name #

Ord name => Monoid (ExportSpec name) Source # 

Methods

mempty :: ExportSpec name #

mappend :: ExportSpec name -> ExportSpec name -> ExportSpec name #

mconcat :: [ExportSpec name] -> ExportSpec name #

NFData name => NFData (ExportSpec name) Source # 

Methods

rnf :: ExportSpec name -> () #

type Rep (ExportSpec name) Source # 
type Rep (ExportSpec name) = D1 (MetaData "ExportSpec" "Cryptol.Parser.AST" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) (C1 (MetaCons "ExportSpec" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "eTypes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set name))) (S1 (MetaSel (Just Symbol "eBinds") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set name)))))

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.

data Pragma Source #

Instances

Eq Pragma Source # 

Methods

(==) :: Pragma -> Pragma -> Bool #

(/=) :: Pragma -> Pragma -> Bool #

Show Pragma Source # 
Generic Pragma Source # 

Associated Types

type Rep Pragma :: * -> * #

Methods

from :: Pragma -> Rep Pragma x #

to :: Rep Pragma x -> Pragma #

NFData Pragma Source # 

Methods

rnf :: Pragma -> () #

PP Pragma Source # 

Methods

ppPrec :: Int -> Pragma -> Doc Source #

NoPos Pragma Source # 

Methods

noPos :: Pragma -> Pragma Source #

type Rep Pragma Source # 
type Rep Pragma = D1 (MetaData "Pragma" "Cryptol.Parser.AST" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) ((:+:) (C1 (MetaCons "PragmaNote" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) (C1 (MetaCons "PragmaProperty" PrefixI False) U1))

data Fixity Source #

Constructors

Fixity 

Fields

Instances

Eq Fixity Source # 

Methods

(==) :: Fixity -> Fixity -> Bool #

(/=) :: Fixity -> Fixity -> Bool #

Show Fixity Source # 
Generic Fixity Source # 

Associated Types

type Rep Fixity :: * -> * #

Methods

from :: Fixity -> Rep Fixity x #

to :: Rep Fixity x -> Fixity #

NFData Fixity Source # 

Methods

rnf :: Fixity -> () #

type Rep Fixity Source # 
type Rep Fixity = D1 (MetaData "Fixity" "Cryptol.Parser.AST" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) (C1 (MetaCons "Fixity" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "fAssoc") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Assoc)) (S1 (MetaSel (Just Symbol "fLevel") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int))))

data PrimMap Source #

A mapping from an identifier defined in some module to its real name.

Constructors

PrimMap 

Instances

Show PrimMap Source # 
Generic PrimMap Source # 

Associated Types

type Rep PrimMap :: * -> * #

Methods

from :: PrimMap -> Rep PrimMap x #

to :: Rep PrimMap x -> PrimMap #

NFData PrimMap Source # 

Methods

rnf :: PrimMap -> () #

type Rep PrimMap Source # 
type Rep PrimMap = D1 (MetaData "PrimMap" "Cryptol.ModuleSystem.Name" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) (C1 (MetaCons "PrimMap" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "primDecls") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map Ident Name))) (S1 (MetaSel (Just Symbol "primTypes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map Ident Name)))))