Safe Haskell | None |
---|
- newtype Unknown = Unknown {
- runUnknown :: Int
- class (Typeable t, Data t) => Partial t where
- class Partial t => Unifiable m t | t -> m where
- data Substitution t = Substitution {
- runSubstitution :: HashMap Int t
- ($?) :: Partial t => Substitution t -> t -> t
- data UnifyState t = UnifyState {}
- defaultUnifyState :: Partial t => UnifyState t
- newtype UnifyT t m a = UnifyT {
- unUnify :: StateT (UnifyState t) (ErrorT String m) a
- unknowns :: Data d => d -> [Unknown]
- runUnify :: UnifyState t -> UnifyT t m a -> m (Either String (a, UnifyState t))
- substituteOne :: Partial t => Unknown -> t -> Substitution t
- (=:=) :: (Monad m, Unifiable m t) => Unknown -> t -> UnifyT t m ()
- occursCheck :: (Monad m, Partial t) => Unknown -> t -> UnifyT t m ()
- fresh' :: Monad m => UnifyT t m Unknown
- fresh :: (Monad m, Partial t) => UnifyT t m t
Documentation
Untyped unification variables
Unknown | |
|
data Substitution t Source
A substitution maintains a mapping from unification variables to their values
Partial t => Monoid (Substitution t) |
($?) :: Partial t => Substitution t -> t -> tSource
Apply a substitution to a value
data UnifyState t Source
State required for type checking
UnifyState | |
|
defaultUnifyState :: Partial t => UnifyState tSource
An empty UnifyState
The type checking monad, which provides the state of the type checker, and error reporting capabilities
Monad m => MonadError String (UnifyT t m) | |
MonadState s m => MonadState s (UnifyT t m) | |
Monad m => Monad (UnifyT t m) | |
Functor m => Functor (UnifyT t m) | |
Monad m => MonadPlus (UnifyT t m) | |
(Monad m, Functor m) => Applicative (UnifyT t m) |
runUnify :: UnifyState t -> UnifyT t m a -> m (Either String (a, UnifyState t))Source
Run a computation in the Unify monad, failing with an error, or succeeding with a return value and the new next unification variable
substituteOne :: Partial t => Unknown -> t -> Substitution tSource
Substitute a single unification variable
(=:=) :: (Monad m, Unifiable m t) => Unknown -> t -> UnifyT t m ()Source
Replace a unification variable with the specified value in the current substitution