Magnus Jonsson wrote:
I have the same problem too when using Haskell. The more I try to
enforce static guarantees the more I get lots of datatypes that are
similar except for one or two constructors. The best way I have found
to avoid this is to simply give up on some of the static guarantees
and just use one datatype that contains all the constructors. Less
static guarantees but also less needless type coaxing between 90%
similar types. I haven't tried using macros.
In Ocaml, you can frequently use polymorphic variants to get the same
effect.
Which means that if you are willing to do enough type-class-hackery, it
should, in principle, be possible to do the same in Haskell. But it
sure isn't as convenient!
This all points to some clear need for more ``flavours'' of polymorphism
being needed (in Haskell), to be able to express *in the type system*
what TH allows you to say "outside".
Jacques
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe