[GHC] #10832: Generalize injective type families

GHC ghc-devs at haskell.org
Mon Mar 19 06:02:52 UTC 2018


#10832: Generalize injective type families
-------------------------------------+-------------------------------------
        Reporter:  jstolarek         |                Owner:  jstolarek
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.11
  checker)                           |             Keywords:  TypeFamilies,
      Resolution:                    |  InjectiveFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #6018             |  Differential Rev(s):  Phab:D1287
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 I haven't found so many uses for this, but I wanted to try this lately

 {{{#!hs
 -- Free   :: (Type -> Constraint) -> (Type -> Type)
 -- Forget :: (Type -> Constraint) -> (Type -> Type)

 newtype Free cls a = Free (forall xx. cls xx => (a -> xx) -> xx)

 type family
   Forget cls free = res | res cls -> free where
   Forget cls (Free cls a) = a
 }}}

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


More information about the ghc-tickets mailing list