Closed DeVilhena-Paulo closed 1 year ago
Looks good to me! Thanks @DeVilhena-Paulo. I'll merge once the CI is green.
Maybe we can have both examples? One using module another using records?
@dhil in both of the proposed examples, the use of effects is similar, isn’t it? In my mind, the aim of the repo is to collect the uses of effects for implementing useful features. If there are two implementations of the same “feature” that only differ by the non effect handler part of the code, my feeling is to only retain the simpler version of the two. What do you think?
It is fine by me.
@kayceesrk @dhil Many thanks for reviewing this PR! I agree with @kayceesrk: both examples implement ML-like refs by dynamically installing new handlers for freshly generated effects. The implementation with records is slightly simpler, and it also shows that there is no need for first-class effect names. The implementation could be ported to any language with support for allocation of fresh effect names and first-class functions.
Thanks. CI seems to be having some issues. I’ll merge this PR given that we’ve reviewed it.
Instead of using a first-class module containing the effect declarations
Get
andSet
, one can use functions that perform these effects. One can then pack these functions in a record with which aRef
client is resumed.