4 ms·
>State is not Evil. I agree! You're mistaken if you think Haskell users don't take advantage of state or side effects. They do, you just don't understand the
by coolsunglasses 13y ago
>State is not Evil.
I agree!
You're mistaken if you think Haskell users don't take advantage of state or side effects. They do, you just don't understand the difference.
Try this course:
http://www.seas.upenn.edu/~cis194/lectures.html http://www.seas.upenn.edu/~cis194/lectures.html
Then see LYAH's section on the State monad:
http://learnyouahaskell.com/for-a-few-monads-more http://learnyouahaskell.com/for-a-few-monads-more
Then reflect on ST:
http://www.haskell.org/haskellwiki/Monad/ST http://www.haskell.org/haskellwiki/Monad/ST
Then this example using mutable variables and closures:
http://bitemyapp.com/posts/2014-03-25-when-nested-io-actions-are-wanted.html http://bitemyapp.com/posts/2014-03-25-when-nested-io-actions...
Side-effecting closures mutating variables!
It's not "no state or side effects".
It's about making state and side effects typed and explicit so they can be properly composed and manipulated.