[Haskell] Re: closure of coercions with classes

oleg at pobox.com oleg at pobox.com
Fri Jun 18 15:16:04 EDT 2004

> The guts of the question is: can one use the class system to code up
> the reflexive, transitive closure

Computing the transitive closure of types is possible:

>   pair :: STRef ((s1, s2), s3) a ->
>           STRef (s1, s2) b ->
>           ST (((s1, s2), s3), s4) (STRefr1 (a, b))
> which isn't as general as I would like, as it imposes a particular order
> on the nested scopes.  

That problem could be solved by open sums, it seems. The HList paper
showed how to achieve that, in current Haskell.

> I've experimented with a few different attempts, but in the best case
> succeeded only in exhausting stack space while searching for satisfying
> instances.

Could it be possible to post the complete code for those attempts? I'd
like to try a few tricks to avoid the divergence.

More information about the Haskell mailing list