Open esad opened 6 years ago
Yes, this is possible. We would have to move the state data types into Internal
like I did for Choice
, and then you could define state :: (s -> Tuple a s) -> Run (state :: STATE s | r) a
in terms of get and modify. It's possible we could also just change the representation of the State
functor.
I think I remember discussing doing this for State
and some other effects in slack a while ago. I remember hearing it kind of defeated the point of extensible effects, so should this be closed?
Would it be possible to make
Run (state ∷ STATE s | r)
instance of MonadState similar to how this has been done forMonadEff
andMonadAff
? I'm trying to use purescript-run with some lenses inside, and the lens functions (use
,assign
etc.) expect the state monad in their signatures.