[GHC] #16027: Cannot use DefaultSignatures for TypeFamiles
GHC
ghc-devs at haskell.org
Mon Dec 10 05:34:47 UTC 2018
#16027: Cannot use DefaultSignatures for TypeFamiles
-------------------------------------+-------------------------------------
Reporter: Ericson2314 | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone: 8.6.3
Component: Compiler | Version: 8.6.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
I'm surprised there wasn't a ticket for this. Maybe I just couldn't find
it.
In short, I want to do something like:
{{{
class Monad m => MyMonad m where
type AssociatedMonad m :: Type -> Type
default type AssociatedMonad m :: (m ~ t m', MonadTrans t, MyMonad m')
=> Type -> Type
type AssociatedMonad (t m') = t (AssociatedMonad m')
fun :: Foo -> m ()
default fun :: (m ~ t m', MonadTrans t, MyMonad m') => Foo -> m ()
fun = lift . fun
}}}
The syntax is a bit weird, but I hope in the process of implementing
constrained type families the syntax properly analogous to the term-level
would shake itself out.
The use-case, like the normal method original, is to assist with monad
transformer boilerplate. {{{MonadTrans}}} wouldn't be enough, but
{{{MFunctor}}} from mmorph might be depending on the method using the
associated type.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16027>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list