[GHC] #8177: Roles for type families

GHC ghc-devs at haskell.org
Fri Apr 7 21:44:14 UTC 2017


#8177: Roles for type families
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  ⊥
       Component:  Compiler          |              Version:  7.6.3
      Resolution:                    |             Keywords:  TypeFamilies
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 int-index):

 I want this feature too. My use case is this:

 {{{#!hs
 data family EffDict (eff :: k) (m :: Type -> Type)
 }}}

 this data family represents effect methods for some monad `m`. Its data
 instances match on `eff` only, never on `m`. For example:

 {{{#!hs
 data StateEff s
 data instance EffDict (StateEff s) m =
   StateDict
     { _state :: forall a . (s -> (a,s)) -> m a,
       _get :: m s,
       _put :: s -> m () }
 }}}

 Define a composition of monad transformers as follows:

 {{{#!hs
 newtype TComp t1 t2 m a = TComp (t1 (t2 m) a)
 }}}

 Then I want to be able to do this:
 {{{#!hs
 coerce :: Dict eff (t1 (t2 m)) -> Dict eff (TComp t1 t2 m)
 }}}

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


More information about the ghc-tickets mailing list