[GHC] #14131: Difference between newtype and newtype instance

GHC ghc-devs at haskell.org
Sun Aug 20 02:36:15 UTC 2017


#14131: Difference between newtype and newtype instance
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7938, #9574,     |  Differential Rev(s):  Phab:D3872
  #13985                             |
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * related:  #13985 => #7938, #9574, #13985


Comment:

 It's also worth noting that Phab:D3872 reverses a design decision made in
 #7938 and #9574 to only allow kind variables in the RHSes of associated
 type instances if they're explicitly bound by LHS type patterns. But I
 think this is the right thing to do, because otherwise you can't have
 things like:

 {{{#!hs
 class C k where
   data family Nat :: k -> k -> Type

 instance C (k -> Type) where
   newtype Nat :: (k -> Type) -> (k -> Type) -> Type where
     Nat :: (forall xx. f xx -> g xx) -> Nat f g
 }}}

 And rejecting this feels like the wrong stance to take.

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


More information about the ghc-tickets mailing list