IxpertaSolutions / freer-effects

An implementation of "Freer Monads, More Extensible Effects".
BSD 3-Clause "New" or "Revised" License
65 stars 12 forks source link

Add replaceRelay and friend #27

Closed isovector closed 7 years ago

isovector commented 7 years ago

We've found certain interpreters that want to be implemented in terms of other interpreters; however, if those interpreters themselves have Member constraints, they will leak out into the type signature.

replaceRelay allows us to rewrite the head of the effects in terms of some other effect which need not exist in the effect list. This lets us get around the above issue, and provide leakless abstractions for interpreters.

trskop commented 7 years ago

Thanks!

liskin commented 7 years ago

Can we generalize this so that an effect can be implemented using multiple intermediary effects?

lexi-lambda commented 7 years ago

@liskin I’ve been looking into that a little bit. It’s possible, but it’s currently difficult for GHC to infer, and it requires use of type application or extremely verbose annotation. However, I think with generalized support for injective type families, tracked in GHC ticket #10832, it could be implemented without breaking type inference.