Safe Haskell | Safe-Infered |
---|
Refinement Types. Mostly mirroring the GHC Type definition, but with room for refinements of various sorts.
- newtype RTyVar = RTV TyVar
- data RType p c tv r
- type RRType = RType Class RTyCon RTyVar
- type BRType = RType String String String
- data RTyCon = RTyCon {}
- class Eq c => TyConable c where
- class (Monoid r, Subable r, Outputable r) => Reftable r where
- class (Outputable p, TyConable c, Eq p, Eq c, Eq tv, Hashable tv, Outputable tv, Reftable r) => RefTypable p c tv r where
- class SubsTy tv ty a where
- subt :: (tv, ty) -> a -> a
- data Ref s m
- data RTAlias tv ty = RTA {}
- data FReft
- reft :: (Symbol, [Refa]) -> FReft
- fFReft :: (Reft -> Reft) -> FReft -> FReft
- toFReft :: Reft -> FReft
- fromFReft :: FReft -> Reft
- splitFReft :: FReft -> ([Symbol], Reft)
- type BSort = BRType ()
- type BPVar = PVar BSort
- type BareType = BRType RReft
- type RSort = RRType ()
- type UsedPVar = PVar ()
- type RPVar = PVar RSort
- type RReft = UReft FReft
- type RefType = RRType FReft
- type PrType = RRType Predicate
- type SpecType = RRType RReft
- data PVar t = PV {}
- newtype Predicate = Pr [UsedPVar]
- data UReft r = U {}
- data DataDecl = D {}
- uTop :: r -> UReft r
- uReft :: (Symbol, [Refa]) -> UReft Reft
- uRType :: RType p c tv a -> RType p c tv (UReft a)
- uRType' :: RType p c tv (UReft a) -> RType p c tv a
- uRTypeGen :: Reftable b => RType p c tv a -> RType p c tv b
- uPVar :: PVar t -> UsedPVar
- pdAnd :: [Predicate] -> Predicate
- pdVar :: PVar t -> Predicate
- pdTrue :: Predicate
- pvars :: Predicate -> [UsedPVar]
- findPVar :: [PVar (RType p c tv ())] -> UsedPVar -> PVar (RType p c tv ())
- ppr_rtype :: (RefTypable p c tv (), RefTypable p c tv r) => Bool -> Prec -> RType p c tv r -> SDoc
- efoldReft :: Reftable r => (RType p c tv r -> a) -> (SEnv a -> Maybe (RType p c tv r) -> r -> c1 -> c1) -> SEnv a -> c1 -> RType p c tv r -> c1
- foldReft :: Reftable r => (r -> c1 -> c1) -> c1 -> RType p c tv r -> c1
- mapReft :: (r1 -> r2) -> RType p c tv r1 -> RType p c tv r2
- mapReftM :: Monad m => (r1 -> m r2) -> RType p c tv r1 -> m (RType p c tv r2)
- mapBot :: (RType p c tv s -> RType p c tv s) -> RType p c tv s -> RType p c tv s
- mapBind :: (Symbol -> Symbol) -> RType p c tv r -> RType p c tv r
- freeTyVars :: RefTypable t t1 a t2 => RType t t1 a t2 -> [a]
- tyClasses :: RefTypable t3 t t1 t2 => RType t3 t t1 t2 -> [(t3, [RType t3 t t1 t2])]
- ofType :: Reftable r => Type -> RRType r
- ofPredTree :: Reftable r => PredTree -> RType Class RTyCon RTyVar r
- toType :: Reftable r => RRType r -> Type
- rTyVar :: TyVar -> RTyVar
- rVar :: Reftable r => TyVar -> RType p c RTyVar r
- rApp :: TyCon -> [RType p RTyCon tv r] -> [Ref r (RType p RTyCon tv r)] -> r -> RType p RTyCon tv r
- rFun :: Reftable r => Symbol -> RType p c tv r -> RType p c tv r -> RType p c tv r
- expandRApp :: Reftable r => HashMap TyCon RTyCon -> RType Class RTyCon RTyVar r -> RType Class RTyCon RTyVar r
- typeUniqueSymbol :: Type -> Symbol
- strengthen :: Reftable r => RType p c tv r -> r -> RType p c tv r
- mkArrow :: Reftable r => [a] -> [PVar (RType p c a ())] -> [(Symbol, RType p c a r)] -> RType p c a r -> RType p c a r
- mkUnivs :: [a] -> [PVar (RType p c a ())] -> RType p c a r -> RType p c a r
- bkUniv :: RType t t1 a t2 -> ([a], [PVar (RType t t1 a ())], RType t t1 a t2)
- bkArrow :: RType t t1 t2 t3 -> ([Symbol], [RType t t1 t2 t3], RType t t1 t2 t3)
- generalize :: RefTypable p c a r => RType p c a r -> RType p c a r
- normalizePds :: RefTypable p c tv r => RType p c tv r -> RType p c tv r
- subts :: SubsTy tv ty c => [(tv, ty)] -> c -> c
- subvPredicate :: (UsedPVar -> UsedPVar) -> Predicate -> Predicate
- subvUReft :: (UsedPVar -> UsedPVar) -> UReft FReft -> UReft FReft
- subsTyVar_meet :: (Eq a, Hashable a, SubsTy a ty c, SubsTy a ty (PVar (RType p c a ())), Reftable s) => (a, ty, RType p c a s) -> RType p c a s -> RType p c a s
- subsTyVars_meet :: (Eq a, Hashable a, SubsTy a ty (PVar (RType p c a ())), SubsTy a ty c, Reftable s) => [(a, ty, RType p c a s)] -> RType p c a s -> RType p c a s
- subsTyVar_nomeet :: (Eq a, Hashable a, SubsTy a ty c, SubsTy a ty (PVar (RType p c a ())), Reftable s) => (a, ty, RType p c a s) -> RType p c a s -> RType p c a s
- subsTyVars_nomeet :: (Eq a, Hashable a, SubsTy a ty (PVar (RType p c a ())), SubsTy a ty c, Reftable s) => [(a, ty, RType p c a s)] -> RType p c a s -> RType p c a s
- stripRTypeBase :: RType t t1 t2 a -> Maybe a
- rTypeReft :: Reftable r => RType p c tv r -> Reft
- rTypeSortedReft :: Reftable r => TCEmb TyCon -> RRType r -> SortedReft
- rTypeSort :: Reftable r => TCEmb TyCon -> RRType r -> Sort
- rTypeValueVar :: Reftable r => RType p c tv r -> Symbol
- ofRSort :: Reftable r => RType p c tv () -> RType p c tv r
- toRSort :: RType p c tv r -> RType p c tv ()
- varSymbol :: Var -> Symbol
- dataConSymbol :: DataCon -> Symbol
- dataConMsReft :: Reftable r => RType p c tv r -> [Symbol] -> FReft
- dataConReft :: DataCon -> [Symbol] -> FReft
- literalFRefType :: TCEmb TyCon -> Literal -> RType p RTyCon RTyVar FReft
- literalFReft :: TCEmb TyCon -> Literal -> FReft
- literalConst :: TCEmb TyCon -> Literal -> (Sort, Expr)
- fromRMono :: [Char] -> Ref t t1 -> t
- fromRPoly :: Ref t t1 -> t1
- idRMono :: Ref b t -> Ref b m
- isTrivial :: Reftable r => RType p c tv r -> Bool
Documentation
Eq RTyVar | |
Ord RTyVar | |
Show RTyVar | |
NFData RTyVar | |
NFData PrType | |
Outputable RTyVar | |
Hashable RTyVar | |
Freshable RefType | |
SubsTy RTyVar RTyVar SpecType | |
SubsTy RTyVar RSort RTyCon | |
SubsTy RTyVar RSort SpecType | |
SubsTy RTyVar RSort PrType | |
SubsTy RTyVar RSort RSort | |
Reftable r => RefTypable Class RTyCon RTyVar r | |
Subable (Ref Reft RefType) | |
Reftable r => Reftable (RType Class RTyCon RTyVar r) |
RVar | |
RFun | |
RAllT | |
RAllP | |
RApp | |
RCls | |
REx | |
RExprArg Expr | For expression arguments to type aliases see testsposvector2.hs |
ROth !String |
Eq RTyCon | |
Ord RTyCon | |
Show RTyCon | |
NFData RTyCon | |
NFData PrType | |
Outputable RTyCon | |
Hashable RTyCon | |
TyConable RTyCon | |
Freshable RefType | |
SubsTy RTyVar RTyVar SpecType | |
SubsTy RTyVar RSort RTyCon | |
SubsTy RTyVar RSort SpecType | |
SubsTy RTyVar RSort PrType | |
SubsTy RTyVar RSort RSort | |
Reftable r => RefTypable Class RTyCon RTyVar r | |
Subable (Ref Reft RefType) | |
Reftable r => Reftable (RType Class RTyCon RTyVar r) |
class (Monoid r, Subable r, Outputable r) => Reftable r whereSource
class (Outputable p, TyConable c, Eq p, Eq c, Eq tv, Hashable tv, Outputable tv, Reftable r) => RefTypable p c tv r whereSource
(Eq p, Outputable p, TyConable c, Reftable r) => RefTypable p c String r | |
Reftable r => RefTypable Class RTyCon RTyVar r |
class SubsTy tv ty a whereSource
SubsTy String BSort String | |
SubsTy String BSort BSort | |
SubsTy tv ty Reft | |
SubsTy tv ty () | |
SubsTy RTyVar RTyVar SpecType | |
SubsTy RTyVar RSort RTyCon | |
SubsTy RTyVar RSort SpecType | |
SubsTy RTyVar RSort PrType | |
SubsTy RTyVar RSort RSort | |
SubsTy tv ty ty => SubsTy tv ty (PVar ty) | |
SubsTy tv ty (UReft r) => SubsTy tv ty (Ref (UReft r) (RType p c tv (UReft r))) |
SubsTy tv ty (UReft r) => SubsTy tv ty (Ref (UReft r) (RType p c tv (UReft r))) | |
(Monoid r, Reftable r, RefTypable a b c r) => Monoid (Ref r (RType a b c r)) | |
(SubsTy tv (RType p c tv ()) (RType p c tv ()), SubsTy tv (RType p c tv ()) c, Reftable r, RefTypable p c tv (), RefTypable p c tv (UReft r)) => Monoid (Ref r (RType p c tv (UReft r))) | |
(NFData a, NFData b) => NFData (Ref a b) | |
(Reftable s, Outputable p) => Outputable (Ref s p) | |
(Reftable r, RefTypable p c tv r) => Subable (Ref r (RType p c tv r)) | |
Subable (Ref Reft RefType) | |
(Reftable r, RefTypable p c tv r) => Reftable (Ref r (RType p c tv r)) |
Refinement Type Aliases
splitFReft :: FReft -> ([Symbol], Reft)Source
Predicate Variables -------------------------------------------
Functor UReft | |
Inputable BareType | |
Freshable RReft | |
SubsTy RTyVar RTyVar SpecType | |
SubsTy RTyVar RSort SpecType | |
SubsTy tv ty (UReft r) => SubsTy tv ty (Ref (UReft r) (RType p c tv (UReft r))) | |
Outputable (UReft r) => Show (UReft r) | |
Monoid a => Monoid (UReft a) | |
NFData r => NFData (UReft r) | |
Reftable r => Outputable (UReft r) | |
Subable r => Subable (UReft r) | |
Reftable r => Reftable (UReft r) | |
(SubsTy tv (RType p c tv ()) (RType p c tv ()), SubsTy tv (RType p c tv ()) c, Reftable r, RefTypable p c tv (), RefTypable p c tv (UReft r)) => Monoid (Ref r (RType p c tv (UReft r))) | |
Inputable (Measure BareType Symbol) | |
Inputable (Spec BareType Symbol) |
Data type refinements
Functions for lifting Reft-values to Spec-values
uRType :: RType p c tv a -> RType p c tv (UReft a)Source
Various functions for converting vanilla Reft
to Spec
Functions for manipulating Predicate
s
Traversing RType
:: (RefTypable p c tv (), RefTypable p c tv r) | |
=> Bool | Whether to print reftPs or not e.g. [a]... |
-> Prec | |
-> RType p c tv r | |
-> SDoc |
efoldReft :: Reftable r => (RType p c tv r -> a) -> (SEnv a -> Maybe (RType p c tv r) -> r -> c1 -> c1) -> SEnv a -> c1 -> RType p c tv r -> c1Source
freeTyVars :: RefTypable t t1 a t2 => RType t t1 a t2 -> [a]Source
tyClasses :: RefTypable t3 t t1 t2 => RType t3 t t1 t2 -> [(t3, [RType t3 t t1 t2])]Source
rApp :: TyCon -> [RType p RTyCon tv r] -> [Ref r (RType p RTyCon tv r)] -> r -> RType p RTyCon tv rSource
expandRApp :: Reftable r => HashMap TyCon RTyCon -> RType Class RTyCon RTyVar r -> RType Class RTyCon RTyVar rSource
typeUniqueSymbol :: Type -> SymbolSource
strengthen :: Reftable r => RType p c tv r -> r -> RType p c tv rSource
mkArrow :: Reftable r => [a] -> [PVar (RType p c a ())] -> [(Symbol, RType p c a r)] -> RType p c a r -> RType p c a rSource
generalize :: RefTypable p c a r => RType p c a r -> RType p c a rSource
normalizePds :: RefTypable p c tv r => RType p c tv r -> RType p c tv rSource
subsTyVar_meet :: (Eq a, Hashable a, SubsTy a ty c, SubsTy a ty (PVar (RType p c a ())), Reftable s) => (a, ty, RType p c a s) -> RType p c a s -> RType p c a sSource
subsTyVars_meet :: (Eq a, Hashable a, SubsTy a ty (PVar (RType p c a ())), SubsTy a ty c, Reftable s) => [(a, ty, RType p c a s)] -> RType p c a s -> RType p c a sSource
subsTyVar_nomeet :: (Eq a, Hashable a, SubsTy a ty c, SubsTy a ty (PVar (RType p c a ())), Reftable s) => (a, ty, RType p c a s) -> RType p c a s -> RType p c a sSource
subsTyVars_nomeet :: (Eq a, Hashable a, SubsTy a ty (PVar (RType p c a ())), SubsTy a ty c, Reftable s) => [(a, ty, RType p c a s)] -> RType p c a s -> RType p c a sSource
stripRTypeBase :: RType t t1 t2 a -> Maybe aSource
rTypeSortedReft :: Reftable r => TCEmb TyCon -> RRType r -> SortedReftSource
rTypeValueVar :: Reftable r => RType p c tv r -> SymbolSource
dataConSymbol :: DataCon -> SymbolSource
dataConReft :: DataCon -> [Symbol] -> FReftSource