cryptol-2.5.0: Cryptol: The Language of Cryptography

Safe HaskellSafe
LanguageHaskell98

Cryptol.TypeCheck.Type

Synopsis

Documentation

data Kind Source #

Kinds, classify types.

Constructors

KType 
KNum 
KProp 
Kind :-> Kind infixr 5 

Instances

Eq Kind Source # 

Methods

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

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

Ord Kind Source # 

Methods

compare :: Kind -> Kind -> Ordering #

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

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

(>) :: Kind -> Kind -> Bool #

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

max :: Kind -> Kind -> Kind #

min :: Kind -> Kind -> Kind #

Show Kind Source # 

Methods

showsPrec :: Int -> Kind -> ShowS #

show :: Kind -> String #

showList :: [Kind] -> ShowS #

Generic Kind Source # 

Associated Types

type Rep Kind :: * -> * #

Methods

from :: Kind -> Rep Kind x #

to :: Rep Kind x -> Kind #

NFData Kind Source # 

Methods

rnf :: Kind -> () #

PP Kind Source # 

Methods

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

type Rep Kind Source # 

data Schema Source #

The types of polymorphic values.

Constructors

Forall 

Fields

Instances

Eq Schema Source # 

Methods

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

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

Show Schema Source # 
Generic Schema Source # 

Associated Types

type Rep Schema :: * -> * #

Methods

from :: Schema -> Rep Schema x #

to :: Rep Schema x -> Schema #

NFData Schema Source # 

Methods

rnf :: Schema -> () #

PP Schema Source # 

Methods

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

FVS Schema Source # 

Methods

fvs :: Schema -> Set TVar Source #

TVars Schema Source #

WARNING: This instance assumes that the quantified variables in the types in the substitution will not get captured by the quantified variables. This is reasonable because there should be no shadowing of quantified variables but, just in case, we make a sanity check and panic if somehow capture did occur.

Methods

apSubst :: Subst -> Schema -> Schema Source #

PP (WithNames Schema) Source # 
type Rep Schema Source # 

data TParam Source #

Type parameters.

Constructors

TParam 

Fields

Instances

Eq TParam Source # 

Methods

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

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

Ord TParam Source # 
Show TParam Source # 
Generic TParam Source # 

Associated Types

type Rep TParam :: * -> * #

Methods

from :: TParam -> Rep TParam x #

to :: Rep TParam x -> TParam #

NFData TParam Source # 

Methods

rnf :: TParam -> () #

PP TParam Source # 

Methods

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

HasKind TParam Source # 

Methods

kindOf :: TParam -> Kind Source #

PP (WithNames TParam) Source # 
type Rep TParam Source # 
type Rep TParam = D1 (MetaData "TParam" "Cryptol.TypeCheck.Type" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) (C1 (MetaCons "TParam" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "tpUnique") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) ((:*:) (S1 (MetaSel (Just Symbol "tpKind") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Kind)) (S1 (MetaSel (Just Symbol "tpName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Name))))))

data Type Source #

The internal representation of types. These are assumed to be kind correct.

Constructors

TCon !TCon ![Type]

Type constant with args

TVar TVar

Type variable (free or bound)

TUser !Name ![Type] !Type

This is just a type annotation, for a type that was written as a type synonym. It is useful so that we can use it to report nicer errors. Example: `TUser T ts t` is really just the type t that was written as `T ts` by the user.

TRec ![(Ident, Type)]

Record type

Instances

Eq Type Source # 

Methods

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

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

Ord Type Source # 

Methods

compare :: Type -> Type -> Ordering #

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

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

(>) :: Type -> Type -> Bool #

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

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Show Type Source # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Generic Type Source # 

Associated Types

type Rep Type :: * -> * #

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

NFData Type Source # 

Methods

rnf :: Type -> () #

PP Type Source # 

Methods

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

FVS Type Source # 

Methods

fvs :: Type -> Set TVar Source #

HasKind Type Source # 

Methods

kindOf :: Type -> Kind Source #

TVars Type Source # 

Methods

apSubst :: Subst -> Type -> Type Source #

DebugLog Type Source # 

Methods

debugLog :: Solver -> Type -> IO () Source #

debugLogList :: Solver -> [Type] -> IO () Source #

TrieMap TypeMap Type Source # 

Methods

emptyTM :: TypeMap a Source #

nullTM :: TypeMap a -> Bool Source #

lookupTM :: Type -> TypeMap a -> Maybe a Source #

alterTM :: Type -> (Maybe a -> Maybe a) -> TypeMap a -> TypeMap a Source #

unionTM :: (a -> a -> a) -> TypeMap a -> TypeMap a -> TypeMap a Source #

toListTM :: TypeMap a -> [(Type, a)] Source #

mapMaybeWithKeyTM :: (Type -> a -> Maybe b) -> TypeMap a -> TypeMap b Source #

PP (WithNames Type) Source # 

Methods

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

type Rep Type Source # 

data TVar Source #

Type variables.

Constructors

TVFree !Int Kind (Set TVar) Doc

Unique, kind, ids of bound type variables that are in scope The Doc is a description of how this type came to be.

TVBound !Int Kind 

Instances

Eq TVar Source # 

Methods

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

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

Ord TVar Source # 

Methods

compare :: TVar -> TVar -> Ordering #

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

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

(>) :: TVar -> TVar -> Bool #

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

max :: TVar -> TVar -> TVar #

min :: TVar -> TVar -> TVar #

Show TVar Source # 

Methods

showsPrec :: Int -> TVar -> ShowS #

show :: TVar -> String #

showList :: [TVar] -> ShowS #

Generic TVar Source # 

Associated Types

type Rep TVar :: * -> * #

Methods

from :: TVar -> Rep TVar x #

to :: Rep TVar x -> TVar #

NFData TVar Source # 

Methods

rnf :: TVar -> () #

PP TVar Source # 

Methods

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

HasKind TVar Source # 

Methods

kindOf :: TVar -> Kind Source #

PP (WithNames TVar) Source # 

Methods

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

type Rep TVar Source # 

type Prop = Type Source #

The type is supposed to be of kind KProp

data TCon Source #

Type constants.

Instances

Eq TCon Source # 

Methods

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

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

Ord TCon Source # 

Methods

compare :: TCon -> TCon -> Ordering #

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

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

(>) :: TCon -> TCon -> Bool #

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

max :: TCon -> TCon -> TCon #

min :: TCon -> TCon -> TCon #

Show TCon Source # 

Methods

showsPrec :: Int -> TCon -> ShowS #

show :: TCon -> String #

showList :: [TCon] -> ShowS #

Generic TCon Source # 

Associated Types

type Rep TCon :: * -> * #

Methods

from :: TCon -> Rep TCon x #

to :: Rep TCon x -> TCon #

NFData TCon Source # 

Methods

rnf :: TCon -> () #

PP TCon Source # 

Methods

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

HasKind TCon Source # 

Methods

kindOf :: TCon -> Kind Source #

type Rep TCon Source # 

data PC Source #

Predicate symbols.

Constructors

PEqual
_ == _
PNeq
_ /= _
PGeq
_ >= _
PFin
fin _
PHas Selector

Has sel type field does not appear in schemas

PArith
Arith _
PCmp
Cmp _
PAnd

This is useful when simplifying things in place

PTrue

Ditto

Instances

Eq PC Source # 

Methods

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

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

Ord PC Source # 

Methods

compare :: PC -> PC -> Ordering #

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

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

(>) :: PC -> PC -> Bool #

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

max :: PC -> PC -> PC #

min :: PC -> PC -> PC #

Show PC Source # 

Methods

showsPrec :: Int -> PC -> ShowS #

show :: PC -> String #

showList :: [PC] -> ShowS #

Generic PC Source # 

Associated Types

type Rep PC :: * -> * #

Methods

from :: PC -> Rep PC x #

to :: Rep PC x -> PC #

NFData PC Source # 

Methods

rnf :: PC -> () #

PP PC Source # 

Methods

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

HasKind PC Source # 

Methods

kindOf :: PC -> Kind Source #

type Rep PC Source # 
type Rep PC = D1 (MetaData "PC" "Cryptol.TypeCheck.Type" "cryptol-2.5.0-62ntwDPh16AFY461fF3rK" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "PEqual" PrefixI False) U1) (C1 (MetaCons "PNeq" PrefixI False) U1)) ((:+:) (C1 (MetaCons "PGeq" PrefixI False) U1) (C1 (MetaCons "PFin" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "PHas" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Selector))) (C1 (MetaCons "PArith" PrefixI False) U1)) ((:+:) (C1 (MetaCons "PCmp" PrefixI False) U1) ((:+:) (C1 (MetaCons "PAnd" PrefixI False) U1) (C1 (MetaCons "PTrue" PrefixI False) U1)))))

data TC Source #

1-1 constants.

Constructors

TCNum Integer

Numbers

TCInf

Inf

TCBit

Bit

TCSeq
[_] _
TCFun
_ -> _
TCTuple Int
(_, _, _)
TCNewtype UserTC

user-defined, T

Instances

Eq TC Source # 

Methods

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

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

Ord TC Source # 

Methods

compare :: TC -> TC -> Ordering #

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

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

(>) :: TC -> TC -> Bool #

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

max :: TC -> TC -> TC #

min :: TC -> TC -> TC #

Show TC Source # 

Methods

showsPrec :: Int -> TC -> ShowS #

show :: TC -> String #

showList :: [TC] -> ShowS #

Generic TC Source # 

Associated Types

type Rep TC :: * -> * #

Methods

from :: TC -> Rep TC x #

to :: Rep TC x -> TC #

NFData TC Source # 

Methods

rnf :: TC -> () #

PP TC Source # 

Methods

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

HasKind TC Source # 

Methods

kindOf :: TC -> Kind Source #

type Rep TC Source # 

data UserTC Source #

Constructors

UserTC Name Kind 

Instances

Eq UserTC Source # 

Methods

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

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

Ord UserTC Source # 
Show UserTC Source # 
Generic UserTC Source # 

Associated Types

type Rep UserTC :: * -> * #

Methods

from :: UserTC -> Rep UserTC x #

to :: Rep UserTC x -> UserTC #

NFData UserTC Source # 

Methods

rnf :: UserTC -> () #

PP UserTC Source # 

Methods

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

HasKind UserTC Source # 

Methods

kindOf :: UserTC -> Kind Source #

type Rep UserTC Source # 

data TySyn Source #

Type synonym.

Constructors

TySyn 

Fields

Instances

Show TySyn Source # 

Methods

showsPrec :: Int -> TySyn -> ShowS #

show :: TySyn -> String #

showList :: [TySyn] -> ShowS #

Generic TySyn Source # 

Associated Types

type Rep TySyn :: * -> * #

Methods

from :: TySyn -> Rep TySyn x #

to :: Rep TySyn x -> TySyn #

NFData TySyn Source # 

Methods

rnf :: TySyn -> () #

PP TySyn Source # 

Methods

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

HasKind TySyn Source # 

Methods

kindOf :: TySyn -> Kind Source #

PP (WithNames TySyn) Source # 

Methods

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

type Rep TySyn Source # 

data Newtype Source #

Named records

Constructors

Newtype 

Fields

Instances

class HasKind t where Source #

Minimal complete definition

kindOf

Methods

kindOf :: t -> Kind Source #

quickApply :: Kind -> [a] -> Kind Source #

type SType = Type Source #

The type is "simple" (i.e., it contains no type functions).

tSplitFun :: TFun -> Type -> [Type] Source #

Split up repeated occurances of the given binary type-level function.

tNum :: Integral a => a -> Type Source #

tRec :: [(Ident, Type)] -> Type Source #

tFun :: Type -> Type -> Type infixr 5 Source #

Make a function type.

tNoUser :: Type -> Type Source #

Eliminate outermost type synonyms.

tBadNumber :: TCErrorMessage -> Type Source #

Make a malformed numeric type.

tf2 :: TFun -> Type -> Type -> Type Source #

tf3 :: TFun -> Type -> Type -> Type -> Type Source #

(=#=) :: Type -> Type -> Prop infix 4 Source #

Equality for numeric types.

(>==) :: Type -> Type -> Prop infix 4 Source #

Make a greater-than-or-equal-to constraint.

pHas :: Selector -> Type -> Type -> Prop Source #

A Has constraint, used for tuple and record selection.

pError :: TCErrorMessage -> Prop Source #

Make a malformed property.

class FVS t where Source #

Minimal complete definition

fvs

Methods

fvs :: t -> Set TVar Source #

Instances

FVS Type Source # 

Methods

fvs :: Type -> Set TVar Source #

FVS Schema Source # 

Methods

fvs :: Schema -> Set TVar Source #

FVS Error Source # 

Methods

fvs :: Error -> Set TVar Source #

FVS Warning Source # 

Methods

fvs :: Warning -> Set TVar Source #

FVS DelayedCt Source # 

Methods

fvs :: DelayedCt -> Set TVar Source #

FVS Goal Source # 

Methods

fvs :: Goal -> Set TVar Source #

FVS a => FVS [a] Source # 

Methods

fvs :: [a] -> Set TVar Source #

FVS a => FVS (Maybe a) Source # 

Methods

fvs :: Maybe a -> Set TVar Source #

(FVS a, FVS b) => FVS (a, b) Source # 

Methods

fvs :: (a, b) -> Set TVar 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)))))