[GHC] #11620: RFC: Type-class type signatures (:: Constraint)

GHC ghc-devs at haskell.org
Sun Feb 21 18:09:59 UTC 2016


#11620: RFC: Type-class type signatures (:: Constraint)
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Data types can be defined:

 {{{#!hs
 data A a b
 -- or
 data A (a :: Bool) (b :: Type)
 -- or
 data A (a :: Bool) (b :: Type) :: Type
 -- or
 data A :: Bool -> Type -> Type

 data B :: Type
 }}}

 while type classes can't:

 {{{#!hs
 class A a b
 -- or
 class A (a :: Bool) (b :: Type)
 -- but not
 -- class A (a :: Bool) (b :: Type) :: Constraint
 -- nor
 -- class A :: Bool -> Type -> Constraint

 -- class B :: Constraint
 }}}

 I foresee problems with how to bind `a` and `b`, but adding a final `::
 Constraint` should be legal:

 {{{#!hs
 class A a b :: Constraint

 class A (a :: Bool) (b :: Type) :: Constraint

 class B :: Constraint
 }}}

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


More information about the ghc-tickets mailing list