[GHC] #14661: Cannot derive (newtype I a b = I (F a -> F b) deriving newtype Category) for type family F

GHC ghc-devs at haskell.org
Thu Jan 11 19:55:34 UTC 2018


#14661: Cannot derive (newtype I a b = I (F a -> F b) deriving newtype Category)
for type family F
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.4.1-alpha1
      Resolution:                    |             Keywords:
                                     |  DerivingStrategies, deriving,
                                     |  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:                    |
-------------------------------------+-------------------------------------
Changes (by Iceland_jack):

 * type:  bug => feature request


Comment:

 Changed it to a feature request. This is actually a new deriving strategy.

 A second derivation for the same thing: I am able to mechanically write
 type constructors like this (clever / insider knowledge? I don't think so)
 and it compiles:

 {{{#!hs
 instance Category Ixed where
   id = Ixed id
   Ixed f . Ixed g = Ixed (f . g)
 }}}

 With this derivation your other example `newtype Ixed ix ix' = Ixed
 (Interp ix -> Maybe (Interp ix'))` does not compile.

 I am experimenting with categories over type families / data types and the
 above instance is boilerplate. This space may be too limited to be worth
 it, maybe someone else has useful examples of a different character.

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


More information about the ghc-tickets mailing list