Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Run instance of MonadState? #9

Open
esad opened this issue Nov 19, 2017 · 2 comments
Open

Make Run instance of MonadState? #9

esad opened this issue Nov 19, 2017 · 2 comments

Comments

@esad
Copy link

esad commented Nov 19, 2017

Would it be possible to make Run (state ∷ STATE s | r) instance of MonadState similar to how this has been done for MonadEff and MonadAff? 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.

@natefaubion
Copy link
Owner

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.

@artemisSystem
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants