About using purescript-run for evented things requiring callbacks



chexxor [4:08 PM]
Oh my, a libuv wrapper in PureScript? That’s neat. Node has that built-in, in a way. It might make sense to write programs which support Node and C backends such that the libuv effects are behind extensible effects, so there can be an interpreter for those effects for each of the backends. So just don’t compile the JS interpreter for the C backend, only the C effect interpreter.

natefaubion [4:16 PM]
Run doesn’t work well with evented things
at least, as is

chexxor [4:43 PM]
Is it possible to make it nicer for evented things while staying within the current design of Run?

natefaubion [4:46 PM]
@chexxor it depends on what you mean. Effects in Run are first-order, which means Effects can’t be parameterized by other effects. Evented things usually require callbacks, and thus doesn’t work well with Run (these things are higher-order). You can have evented things at the edges though which feed into some Run program though.
You can have a version of Run with higher-order effects, which is what I was playing around with this weekend
It does mean you need a different abstraction than Functor though

chexxor [4:55 PM]
@natefaubion What’s an example of an effect which is parametrized by other effects?

natefaubion [4:56 PM]

chexxor [4:56 PM]
Seeing a type signature of s/t similar might help me understand.

natefaubion [4:57 PM]
an effect that takes another effect, and has control over how that effect is run and dispatched
it’s not always apparent in the type signature
for example, catch looks like it takes a higher-order effect, and it kind of does
but it’s implemented as AST substitution
and a proper catch effect, rather than an interpreter, would be higher-order