lexi-lambda / freer-simple

A friendly effect system for Haskell
https://hackage.haskell.org/package/freer-simple
BSD 3-Clause "New" or "Revised" License
228 stars 20 forks source link

Fixed two errant `runState` uses #4

Closed JustusAdam closed 6 years ago

JustusAdam commented 6 years ago

In the tutorial and the readme you use runState, which returns (a,s) whereas what the rest of the code suggests is that you only want to return a, ergo evalState is needed.

lexi-lambda commented 6 years ago

The use in the README is technically correct, since it later applies fst to the result and returns the state, not the result. The use in the documentation is, however, incorrect in the way you’ve noticed.

JustusAdam commented 6 years ago

Oh. Yes you are correct. I completely skipped the fst.

JustusAdam commented 6 years ago

Should I change the README back to runState or should I drop the fst and make it execState?

lexi-lambda commented 6 years ago

I think either works. The example in the README was inherited from freer and freer-effects, and I’m not sure it’s even an especially good one.

JustusAdam commented 6 years ago

I reverted the change in the REAME.

lexi-lambda commented 6 years ago

Thanks!