Copyright | (c) Edward Kmett 2011-2014 |
---|---|
License | BSD3 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
- unifyKind :: (MonadMeta s m, MonadWriter Any m) => KindM s -> KindM s -> m (KindM s)
- unifyKindVar :: (MonadMeta s m, MonadWriter Any m) => MetaK s -> KindM s -> m (KindM s)
- kindOccurs :: (MonadMeta s m, MonadWriter Any m) => Depth -> KindM s -> (MetaK s -> Bool) -> m (KindM s)
- generalize :: MonadMeta s m => KindM s -> m (Schema a)
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