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

State monad + other monads defined in transformers are out of date #7

Open
lehmacdj opened this issue Feb 17, 2022 · 1 comment
Open
Assignees
Labels
enhancement New content or edit request

Comments

@lehmacdj
Copy link

lehmacdj commented Feb 17, 2022

This is a pain point that I still remember from when I first learned Haskell using Learn You a Haskell probably almost 5 years ago.

Is your content edit request related to a problem? Please describe.

The definition of the State monad and probably most monads defined in transformers is outdated. See for example this code snippet; it no longer compiles with modern versions of Haskell/base/transformers because State has been redefined to be type State s a = StateT s Identity a:
https://github.com/learnyouahaskell/learnyouahaskell.github.io/blob/main/docs/for-a-few-monads-more.html#L1405-L1413

Describe the solution you'd like

The code snippet above should be modified to use the state function instead of the State constructor which no longer exists. Unfortunately this isn't a perfect solution because we maybe need to explain / at least somewhat excuse StateT / monad transformers before one really would want to pedagogically.

Describe alternatives you've considered

Encourage people to define the monad themselves and not import it in the examples. Then continue to use the older definition of the state monad throughout. This is maybe better, because it avoids the complications of monad transformers. If we go with this approach it might be a good idea to mention that

Additional context

This same problem also appears to affect at least Writer on the same page.

Link to the page in question

https://learnyouahaskell.github.io/for-a-few-monads-more.html#state

@lehmacdj lehmacdj added the enhancement New content or edit request label Feb 17, 2022
@lehmacdj lehmacdj changed the title State monad + other monads defined in transformers are out of date due to transformerification of them State monad + other monads defined in transformers are out of date Feb 17, 2022
@new-user-name
Copy link

Thanks a lot for your point. What modern book or paper do you suggest to learn the topic?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New content or edit request
Projects
None yet
Development

No branches or pull requests

3 participants