[GHC] #11621: GHC doesn't see () as a Constraint in type family

GHC ghc-devs at haskell.org
Wed Mar 2 19:06:35 UTC 2016


#11621: GHC doesn't see () as a Constraint in type family
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.10.1
  checker)                           |
      Resolution:                    |             Keywords:
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 thomie):

 * version:  8.1 => 7.10.1
 * component:  Compiler => Compiler (Type checker)


@@ -5,1 +5,1 @@
- import Data.Kind
+ import GHC.Exts

New description:

 {{{#!hs
 {-# LANGUAGE DataKinds, TypeOperators, KindSignatures,
 MultiParamTypeClasses, TypeFamilies #-}

 import GHC.Exts

 class NotFound

 type family
   F b where
   F 'False = (NotFound :: Constraint)
   F 'True  = (() :: Constraint)
 }}}

 works fine. Removing all constraints and final line it works without any
 annotations and infers the type of `F :: Bool -> Constraint`:

 {{{#!hs
 type family
   F b where
   F 'False = NotFound
 }}}

 GHC seems determined that `() :: Type` unless explicitly told otherwise, I
 would like to be able to write:

 {{{#!hs
 type family
   F b where
   F 'False = NotFound
   F 'True  = ()
 }}}

--

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


More information about the ghc-tickets mailing list