Re:Haskell for Web Developers
by mietek on Friday July 26, 2013 @06:15PM
(#6110917)
The `StateT` example in the article is unfortunate, as it reinforces the misguided notion that handling state in Haskell requires complicated machinery, such as monad transformers. This is simply false. You can use a mutable reference, like this:
Haskell's libraries haven't been designed to make this use case as concise as possible, but nothing prevents you from introducing more succinct notation. To illustrate this point: In Haskell, the `forever` control flow operator is not a language keyword, but a function you could write yourself. In Python, could you write `print` yourself?
[ Parent
| on HN ]
>In Python, could you write `print` yourself?
In Python 3, where print is a function? Yes.
In Python 2, not with exactly the same syntax, but you could certainly write a function to provide the same features.