Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
jules
on Oct 30, 2014
|
parent
|
context
|
favorite
| on:
Type-safe Transducers in Clojure, Scala, and Haske...
You can do that, but it's more elegant if you define a functional stateful transducer analogous to scanl for lists.
davdar
on Oct 30, 2014
[–]
That's like saying "your program is more elegant if it has no monads". It's an incorrect statement. The monadic version is perfectly elegant. Even better: it's the right one.
jules
on Oct 30, 2014
|
parent
[–]
By the same logic scanl should just have the type:
(b -> IO a) -> [b] -> IO [a]
instead of
(a -> b -> a) -> a -> [b] -> [a]
Just putting the whole thing in the IO/ST monad isn't the right solution when you need a very specific form of local state.
Join us for
AI Startup School
this June 16-17 in San Francisco!
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: