paf31 / dovetail

A PureScript interpreter in Haskell
http://functorial.com/dovetail
BSD 3-Clause "New" or "Revised" License
119 stars 3 forks source link

Effect #28

Closed chrisdone closed 2 years ago

chrisdone commented 2 years ago

Hi, do you have a plan already for modelling Effect? The FFI doesn't mention it yet.

Perhaps you plan to add it to the FFI?

Or else, perhaps you might use a tagged approach where the Effect type is a tagged initial free-monad style thing and then it just returns constructors which a user of dovetail could interpret?

Thanks.

paf31 commented 2 years ago

There are a few intersecting issues here that I need to write up: a) effects, b) supporting the core library set, and c) delimited contuinuations. I don't have a concrete plan yet, but I expect I'll probably implement Effect in a separate dovetail-effect library, since there's nothing in the compiler really specific to Effect above the corefn level, so nothing special to support that can't be delegated to a library.

I'm not sure if I want to just keep it simple and offer a barebones do-everything IO monad like PureScript's current Effect, or take the opportunity now that I have an interpreter to revisit the old row-typed effects idea. That would fit nicely with my plan to implement delimited continuations, but would make things more complicated.

I also do want to support purescript-effect along with the other core libraries, so I think the best option is to build this in the context of support for the core libraries, which will be my next big project, and then to add delimited control as FFI primitives separately so that I can build a row-typed effect library on top.

chrisdone commented 2 years ago

Thanks, I'll keep watching this space.