[GHC] #12418: Make `MonadCont (ContT r m)` polykinded (r::k), (m::k -> Type)
GHC
ghc-devs at haskell.org
Sat Jul 23 20:23:35 UTC 2016
#12418: Make `MonadCont (ContT r m)` polykinded (r::k), (m::k -> Type)
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Core Libraries | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
I want to make sure I understand this correctly, this brittleness applies
to monad transformers and not the instances below `↓` since they are
already kind polymorphic?
{{{#!hs
instance forall k (r :: k) (m :: k -> *). Functor (ContT r m)
instance forall k (r :: k) (m :: k -> *). Applicative (ContT r m)
instance forall k (r :: k) (m :: k -> *). Monad (ContT r m)
}}}
----
I have no use for a kind-polymorphic instance (that I know of!), the
original motivation was allowing
{{{#!hs
callCC :: ((a -> ContT r m b) -> ContT r m a) -> ContT r m a
callCC @(ContT _ _)
}}}
to match the instance.
{{{#!hs
instance k ~ Type => MonadCont (ContT @k r m)
}}}
would allow `callCC @(ContT _ _)` but not `callCC :: ((a -> ContT r m b)
-> ContT r m a) -> ContT r m a` it seems (I get `Couldn't match type ‘k1’
with ‘*’ arising from a use of ‘callCC’`).
I don't understand your point about `MonadState` and `MonadReader`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12418#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list