[GHC] #11534: Allow class associated types to reference functional dependencies

GHC ghc-devs at haskell.org
Mon Feb 8 19:31:45 UTC 2016


#11534: Allow class associated types to reference functional dependencies
-------------------------------------+-------------------------------------
        Reporter:  ekmett            |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.10.3
  checker)                           |             Keywords:  TypeFamilies,
      Resolution:                    |  FunctionalDependencies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ekmett):

 A related common idiom you can spot in the wild using the `mtl` is to do
 something like

 {{{#!hs
 newtype M a = M (ReaderT MyEnv (StateT MyState (WriterT MyLog IO)) a)
   deriving (Functor, Applicative, Monad, MonadIO, MonadReader MyEnv,
 MonadState MyState, MonadWriter MyLog, MonadIO)
 }}}

 resulting in a custom monad where you can filter out as many of the
 instances as you don't like in 2 lines rather than in hand-rolling one in
 60.

 E.g. `haskeline`'s `InputT` is more or less an example of this, although
 Judah explicitly hides the `MonadReader` instance.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11534#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list