[Haskell-cafe] Equality constraint "synonyms"

Hugo Pacheco hpacheco at gmail.com
Thu Nov 25 02:41:56 CET 2010


Dear Haskellers,

When programming with type functions, I often find myself with a set of
invariants that are frequent in my programs and can be expressed as equality
constraints on the context of the functions.

I wonder if there is any way in current GHC to express some kind of synonyms
for equality constraints, to avoid a fixed set of constraints for a smaller
expression. The natural way for type classes would be to create a superclass
containing all the desired instances

class (A a, B a) => C a where {}

but as from http://hackage.haskell.org/trac/ghc/ticket/2715, equality
constraints are currently not supported in class contexts, what might be
reasonable.
However, in fact I am just looking for some kind syntactic sugar. Would this
be a desired feature for other people?

Regards,
hugo

-- 
www.di.uminho.pt/~hpacheco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101124/c80dd356/attachment.html


More information about the Haskell-Cafe mailing list