[Haskell-cafe] GADTs vs arrows/typeclasses
Daniel McAllansmith
dm.maillists at gmail.com
Wed Dec 6 16:03:18 EST 2006
On Thursday 07 December 2006 09:44, S. Alexander Jacobson wrote:
> I guess I'm also not sure what belongs in a GADT and what belongs in a
> typeclass e.g. here is an Arrow GADT
>
> data Arrow b c where
> Arr::(b->c) -> Arrow b c
> Compose::Arrow b c -> Arrow c d -> Arrow b d
> First::Arrow a b -> Arrow (a,c) (b,c)
>
> When Arrow is defined like this, rather than write instances you just
> various evaluation functions for the Arrow GADT.
How would the GADT solution handle the behaviours captured in the other Arrow
classes, eg ArrowIf, ArrowLoop etc?
It doesn't seem right to just add constructors for all those extra functions.
Daniel
More information about the Haskell-Cafe
mailing list