Safe Haskell | None |
---|
- newtype Unknown = Unknown {
- runUnknown :: Int
- newtype TypedUnknown t = TypedUnknown {}
- class (Typeable t, Data t, Show t) => Unifiable m t | t -> m where
- unknown :: TypedUnknown t -> t
- isUnknown :: t -> Maybe (TypedUnknown t)
- (?=) :: t -> t -> UnifyT m ()
- newtype Substitution = Substitution {
- runSubstitution :: forall d. Data d => d -> d
- data UnifyState = UnifyState {}
- defaultUnifyState :: UnifyState
- newtype UnifyT m a = UnifyT {
- unUnify :: StateT UnifyState (ErrorT String m) a
- unknowns :: Data d => d -> [Unknown]
- runUnify :: UnifyState -> UnifyT m a -> m (Either String (a, UnifyState))
- substituteOne :: Unifiable m t => TypedUnknown t -> t -> Substitution
- replace :: (Monad m, Unifiable m t) => TypedUnknown t -> t -> UnifyT m ()
- occursCheck :: (Monad m, Unifiable m t) => TypedUnknown s -> t -> UnifyT m ()
- fresh' :: Monad m => UnifyT m Unknown
- fresh :: (Monad m, Unifiable m t) => UnifyT m t
Documentation
Untyped unification variables
Unknown | |
|
newtype TypedUnknown t Source
The type of typed unification variables
TypedUnknown | |
|
Typeable1 TypedUnknown | |
Eq (TypedUnknown t) | |
Data t => Data (TypedUnknown t) | |
Ord (TypedUnknown t) | |
Show (TypedUnknown t) |
class (Typeable t, Data t, Show t) => Unifiable m t | t -> m whereSource
Identifies types which support unification
unknown :: TypedUnknown t -> tSource
isUnknown :: t -> Maybe (TypedUnknown t)Source
newtype Substitution Source
A substitution maintains a mapping from unification variables to their values, ensuring that the type of a unification variable matches the type of its value.
Substitution | |
|
data UnifyState Source
State required for type checking:
UnifyState | |
|
defaultUnifyState :: UnifyStateSource
An empty UnifyState
The type checking monad, which provides the state of the type checker, and error reporting capabilities
Monad m => MonadError String (UnifyT m) | |
MonadState s m => MonadState s (UnifyT m) | |
Monad m => Monad (UnifyT m) | |
Functor m => Functor (UnifyT m) | |
Monad m => MonadPlus (UnifyT m) | |
(Monad m, Functor m) => Applicative (UnifyT m) |
runUnify :: UnifyState -> UnifyT m a -> m (Either String (a, UnifyState))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 :: Unifiable m t => TypedUnknown t -> t -> SubstitutionSource
Substitute a single unification variable
replace :: (Monad m, Unifiable m t) => TypedUnknown t -> t -> UnifyT m ()Source
Replace a unification variable with the specified value in the current substitution
occursCheck :: (Monad m, Unifiable m t) => TypedUnknown s -> t -> UnifyT m ()Source
Perform the occurs check, to make sure a unification variable does not occur inside a value