[GHC] #12159: Record-like GADTs with repeated fields (of same type) rejected

GHC ghc-devs at haskell.org
Fri Jun 10 14:18:32 UTC 2016


#12159: Record-like GADTs with repeated fields (of same type) rejected
-------------------------------------+-------------------------------------
        Reporter:  heisenbug         |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Iavor adds a couple more tricky examples:
 {{{
 data S :: * -> * where
    S1 :: { s :: Bool } -> S (Int,Char)
    S2 :: { s :: Bool } -> S (Int,Int)
 }}}
 In this case, the anti-unifier would compute:
 {{{
 s :: S (Int, a) -> Bool
 }}}
 However, the `Int` part is accidental, and we can use the more general:
 {{{
 s :: S a -> Bool
 }}}
 Another example:
 {{{
 data T :: * -> * where
    T1 :: { t :: Bool } -> T Bool
 }}}
 In this case we have the usual GADT problems of not knowing how much to
 abstract:
 {{{
 t :: T a -> a
 t :: T a -> Bool
 }}}
 Neither of these is more general than the other, so it is not clear what
 to do.

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


More information about the ghc-tickets mailing list