
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

On Thu, 2010-11-25 at 10:41 +0900, Hugo Pacheco wrote:
Would this be a desired feature for other people?
I'd like to have Haskell Type Constraints Unleashed http://users.ugent.be/~tschrijv/Research/papers/constraint_families.pdf which includes equality constraint synonyms. Sebastian

Thank you for the info., I didn't know that it had already been proposed.
The constraint families seem definitely useful.
hugo
On Thu, Nov 25, 2010 at 12:53 PM, Sebastian Fischer
On Thu, 2010-11-25 at 10:41 +0900, Hugo Pacheco wrote:
Would this be a desired feature for other people?
I'd like to have Haskell Type Constraints Unleashed
http://users.ugent.be/~tschrijv/Research/papers/constraint_families.pdf
which includes equality constraint synonyms.
Sebastian
-- www.di.uminho.pt/~hpacheco

El Jue, 25 de Noviembre de 2010, 4:53 am, Sebastian Fischer escribió:
I'd like to have Haskell Type Constraints Unleashed
http://users.ugent.be/~tschrijv/Research/papers/constraint_families.pdf
An example from the paper:
constraint Num a = (Additive a, Multiplicative a, FromInteger a)
It seems a very nice feature. I commonly write the same context many times. In other cases, I need to make the same change on many equal contexts. I wonder if there is something negative in this feature. -- Daniel Díaz
participants (3)
-
Daniel Díaz
-
Hugo Pacheco
-
Sebastian Fischer