[GHC] #14059: COMPLETE sets don't work at all with data family instances

GHC ghc-devs at haskell.org
Mon Jul 31 14:02:13 UTC 2017


#14059: COMPLETE sets don't work at all with data family instances
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms,
                                     |  PatternMatchWarnings
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 RyanGlScott):

 * cc: mpickering (added)


Comment:

 Here's one architectural issue: `COMPLETE` sets currently aren't designed
 with data family instances in mind. Why? Because you can optionally give
 the name of a tycon for a `COMPLETE` set, e.g.,

 {{{#!hs
 {-# COMPLETE False, TooGoodToBeTrue :: Boolean #-}
 }}}

 However, this necessarily needs to be more involved for data family
 instances, because we're dealing with a proper type, not just a tycon. Put
 differently, it wouldn't be enough to say:

 {{{#!hs
 {-# COMPLETE SFalse, STrue :: Sing #-}
 }}}

 This is wrong, since we don't want a `COMPLETE` set for `Sing (a :: k)`,
 we want a `COMPLETE` set for `Sing (a :: Bool)`. But GHC won't let us use:

 {{{#!hs
 {-# COMPLETE SFalse, STrue :: Sing (z :: Bool) #-}
 }}}
 {{{
 Bug.hs:20:47: error: parse error on input ‘(’
    |
 20 | {-# COMPLETE SFalse, STooGoodToBeTrue :: Sing (z :: Bool) #-}
    |
 }}}

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


More information about the ghc-tickets mailing list