|
|
|
|
|
by svanderbleek
3590 days ago
|
|
But if you look at Haskell's Control.Monad you see why the abstraction is helpful [0]. We get things like foldM, it's similar to how you can fold across more than just lists, you can fold across trees and so on, but for all these different structures like State, Either, etc. And yes you are right to point out that some of them have multiple implementations, State can be combined "backwards" or "forwards" (or both). The trade off is you have to invest the time so these abstractions become natural, but once you do so you can use generic control structures that save tons of implementation time. [0] https://hackage.haskell.org/package/base-4.9.0.0/docs/Contro... |
|
It adds complexity, so I'm not convinced I'd save any time.