Closed natefaubion closed 7 years ago
@joneshf @paf31 What do y'all think of this sort of API?
Aaalllrighty then, what about this go around? All the functions now just take handlers from purescript-variant
. This means multi-interpreters just work out. The only difference is instead of case_
, you use send
, which will handle the default case of a variant not matching.
let
multi1 = send
# on _foo runFoo
# on _bar runBar
multi2 = match
{ base1: ...
, base2: ...
}
program
# runWithEffect multi
# runEffect multi2
I'm happy to consider alternative as well. I don't love the idea of requiring send
. I can pass it in automatically, at the expensive of longer, more opaque type signatures.
This is an alternative to #6. I've removed the privileged "base" effect, and done something which I think is more idiomatic.
aff
andeff
are just their own effects like any other, and they can be interpreted together if need be.