natefaubion / purescript-spork

Elm-like for PureScript
MIT License
157 stars 9 forks source link

More general combinators for interpreters #7

Closed natefaubion closed 6 years ago

natefaubion commented 6 years ago

I changed the way Interpreter works which allows for a more general formulation. The problem with the old combinators was that you couldn't stack your own subscriptions on top of the existing Eff/Aff interpreters, since they were hard coded to no subscriptions. I've added a more general merge combinator that can run two interpreters as a Coproduct, which is what makeApp expects. This means you can do something like:

-- No subscriptions
basicEff `merge` never

-- Custom subscriptions
basicEff `merge` mySubInterpreter