ermine-0.6: Ermine

Copyright(c) Edward Kmett 2011-2014
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Ermine.Unification.Kind

Description

 

Synopsis

Documentation

unifyKind :: (MonadMeta s m, MonadWriter Any m) => KindM s -> KindM s -> m (KindM s) Source

Returns the a unified form if different from the left argument.

The writer is used to track if any interesting edits have been made

unifyKindVar :: (MonadMeta s m, MonadWriter Any m) => MetaK s -> KindM s -> m (KindM s) Source

Unify a known Meta variable with a kind that isn't a Var.

kindOccurs :: (MonadMeta s m, MonadWriter Any m) => Depth -> KindM s -> (MetaK s -> Bool) -> m (KindM s) Source

Die with an error message due to a cycle between the specified kinds.

>>> test $ do k <- Var <$> newMeta False (Just "k"); unifyKind k (star ~> k)
*** Exception: (interactive):1:1: error: infinite kind detected
cyclic kind: a = * -> a
>>> test $ do k1 <- Var <$> newMeta False (Just "k1"); k2 <- Var <$> newMeta False (Just "k2"); unifyKind k1 (k1 ~> k2); unifyKind k2 (k1 ~> k2); return (k1 ~> k2)
*** Exception: (interactive):1:1: error: infinite kind detected
cyclic kind: a = a -> b

generalize :: MonadMeta s m => KindM s -> m (Schema a) Source

Generalize a Kind.