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

GHC ghc-devs at haskell.org
Mon Feb 22 04:36:28 UTC 2016


#11620: RFC: Type-class type signatures (:: Constraint)
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      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:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Thanks for the response, interesting.

 {{{#!hs
 -- Dependent function syntax
 class
   HRefl :: forall k1. (a::k1) -> forall k2. (b::k2) -> Constraint

 -- Specify variables separately, as in functions and `type families'
 --   foo :: forall a. [a] -> forall b. [b] -> Int
 --   foo xs ys = length xs + length ys
 class
   HEq :: forall k1. k1 -> forall k2. k2 -> Constraint
   HEq a b
 }}}

 Is there an effort to unify all these forms (not only syntactically);
 functions, type families, type classes, GADTs?

 Just for fun

 {{{#!hs
 data
   Vec Nat Type :: Type
   Vec n a

 data
   Vec :: Nat -> Type -> Type
   Vec n a

 class
   Eq :: forall k. k -> k -> Constraint
   Eq a b

   where
     HEq @k a @k b
     a implies b
     b implies a
 }}}

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


More information about the ghc-tickets mailing list