[Haskell-cafe] extensible effects and open unions

Suhail Shergill suhailshergill at gmail.com
Sun Dec 14 04:11:04 UTC 2014


oleg at okmij.org writes:

> First of all, thank you indeed for taking over as the maintainer of
> the extensible-effects library. 

you're welcome! and thank you for the library in question to begin with; i
intend to port the ideas to scala as well.

> To show that one can indeed implement the interface of OpenUnion.hs as
> it is *without* Typeable or overlapping instances, I have just written
>         http://okmij.org/ftp/Haskell/extensible/OpenUnion4.hs

thanks for the concrete code sample. also, iiuc, if i were to back-port this
code to ghc versions 7.6 and before, i should be able to do away with dependence
on closed type families replacing it with overlapping instances. correct?

if so, i'll try and expose that point in the design space as well since that
would permit us to use effects in the return type of other 'Eff's even in
systems not supporting closed type families. currently we have this for ghc-7.8
as can be seen in the contrived test here:
<https://github.com/bfops/extensible-effects/blob/master/test/Test.hs#L163>

> It is meant to be a drop-in replacement for OpenUnion2.hs. At least
> for my Eff code, it does indeed act that way. Nothing in the code has
> to be changed save for the import declaration. On the down side, in
> OpenUnion4.hs, projections and injections take linear time in the size
> of the union. How much difference it really makes in practice is
> unclear (since the projection and injection operations can be computed
> statically). Only benchmarks could tell.

agreed. i am also contemplating breaking out open unions into an independent
library.

-- 
Suhail


More information about the Haskell-Cafe mailing list