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

Confusing naming in Chapter 6 (State) #580

Open
disappearer opened this issue Feb 5, 2020 · 2 comments
Open

Confusing naming in Chapter 6 (State) #580

disappearer opened this issue Feb 5, 2020 · 2 comments

Comments

@disappearer
Copy link

This is just a minor complaint/suggestion that I have. Otherwise, enjoying the book very much so far!

I have a problem with the naming of the State class, i.e.

case class State[S, +A](run: S => (A, S))

I'm not sure why it's called State when it refers to an action. In the text it's also referred to as action. Wouldn't it be better if it was simply called Action? Also, run would be applied to an action, rather than a state.

I was finding this part of the book very confusing when every function signature is misleading and I have to constantly remind myself each time I see State that it's not a state, but an action (transition, transformation). I must admit that the content is already hard to grasp for me and this made it even harder. When I replaced every occurrence of State with Action it made everything much clearer.

Once again, love the book, thank you very much!

@philipschwarz
Copy link

philipschwarz commented Feb 5, 2020

hello, while it doesn't address your concerns, I hope this might help understand the State Monad: https://www.slideshare.net/pjschwarz/state-monad-212839068 (download for flawless quality)

image

@otto-dev
Copy link

otto-dev commented Mar 17, 2020

Not a big deal, and maybe this is the idiomatic name, but I have to agree that I experienced the same. My written notes say "would be better named StateTransition" pointing at the State type definition.

Thanks for the slideshare above, will check it out!

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

No branches or pull requests

4 participants