hets -- a heterogenous Specification (CASL) tool setContentsIndex
HasCASL.Unify
Portability portable
Stability experimental
Maintainer hets@tzi.de
Description
substitution and unification of types
Synopsis
varsOf :: Type -> [TypeArg]
generalize :: TypeScheme -> TypeScheme
compSubst :: Subst -> Subst -> Subst
isUnifiable :: TypeMap -> Int -> TypeScheme -> TypeScheme -> Bool
instScheme :: TypeMap -> Int -> TypeScheme -> TypeScheme -> Bool
toEnvState :: State Int a -> State Env a
toSchemes :: (Type -> Type -> a) -> TypeScheme -> TypeScheme -> State Int a
asSchemes :: Int -> (Type -> Type -> a) -> TypeScheme -> TypeScheme -> a
freshInst :: TypeScheme -> State Int Type
freshVar :: State Int Id
mkSingleSubst :: TypeArg -> State Int Subst
mkSubst :: [TypeArg] -> State Int Subst
type Subst = Map TypeArg Type
eps :: Subst
class Unifiable a where
subst :: Subst -> a -> a
match :: TypeMap -> (Bool, a) -> (Bool, a) -> Result Subst
mgu :: Unifiable a => TypeMap -> a -> a -> Result Subst
unify :: Unifiable a => TypeMap -> a -> a -> Bool
subsume :: Unifiable a => TypeMap -> a -> a -> Bool
equalSubs :: Unifiable a => TypeMap -> a -> a -> Bool
starTypeInfo :: TypeInfo
showPrettyWithPos :: (PrettyPrint a, PosItem a) => a -> ShowS
uniResult :: (PrettyPrint a, PosItem a, PrettyPrint b, PosItem b) => String -> a -> String -> b -> Result Subst
occursIn :: TypeMap -> TypeId -> Type -> Bool
expandAlias :: TypeMap -> Type -> (Type, Bool)
expandAliases :: TypeMap -> Type -> ([TypeArg], [Type], Type, Bool)
Documentation
varsOf :: Type -> [TypeArg]
generalize :: TypeScheme -> TypeScheme
compSubst :: Subst -> Subst -> Subst
composition (reversed: first substitution first!)
isUnifiable :: TypeMap -> Int -> TypeScheme -> TypeScheme -> Bool
unifiability of type schemes including instantiation with fresh variables (and looking up type aliases)
instScheme :: TypeMap -> Int -> TypeScheme -> TypeScheme -> Bool
test if second scheme is a substitution instance
toEnvState :: State Int a -> State Env a
lift State Int to State Env
toSchemes :: (Type -> Type -> a) -> TypeScheme -> TypeScheme -> State Int a
asSchemes :: Int -> (Type -> Type -> a) -> TypeScheme -> TypeScheme -> a
freshInst :: TypeScheme -> State Int Type
freshVar :: State Int Id
mkSingleSubst :: TypeArg -> State Int Subst
mkSubst :: [TypeArg] -> State Int Subst
type Subst = Map TypeArg Type
eps :: Subst
class Unifiable a where
Methods
subst :: Subst -> a -> a
match :: TypeMap -> (Bool, a) -> (Bool, a) -> Result Subst
Instances
Unifiable Type
(Unifiable a, Unifiable b) => Unifiable (a, b)
(PrettyPrint a, PosItem a, Unifiable a) => Unifiable [a]
(PrettyPrint a, PosItem a, Unifiable a) => Unifiable (Maybe a)
mgu :: Unifiable a => TypeMap -> a -> a -> Result Subst
most general unifier via match where both sides may contribute substitutions
unify :: Unifiable a => TypeMap -> a -> a -> Bool
subsume :: Unifiable a => TypeMap -> a -> a -> Bool
equalSubs :: Unifiable a => TypeMap -> a -> a -> Bool
starTypeInfo :: TypeInfo
showPrettyWithPos :: (PrettyPrint a, PosItem a) => a -> ShowS
uniResult :: (PrettyPrint a, PosItem a, PrettyPrint b, PosItem b) => String -> a -> String -> b -> Result Subst
occursIn :: TypeMap -> TypeId -> Type -> Bool
expandAlias :: TypeMap -> Type -> (Type, Bool)
expandAliases :: TypeMap -> Type -> ([TypeArg], [Type], Type, Bool)
Produced by Haddock version 0.6