Tell me, have you ever used foldr in Purescript? It just doesn't lead to reusable logic there, so I have no idea why you would.
But in Haskell, foldr is used everywhere. Laziness means that logic built with it is actually reusable.
Tell me, have you ever used foldr in Purescript? It just doesn't lead to reusable logic there, so I have no idea why you would.
But in Haskell, foldr is used everywhere. Laziness means that logic built with it is actually reusable.
http://try.purescript.org/?gist=63d81adf9f5257ffa4f576df2658...
I don't understand your point. Why is laziness a requirement to write small reusable functions? Are you thinking about currying?
OCaml is (relatively) similar to Haskell and is not lazy. Function currying does not require laziness.
It's also hard to explain, but if you're used to Haskell, working with an eager-by-default language such as OCaml or ML is mildly annoying. You can adapt, of course, but it does seem as if gluing stuff together is trickier with eager evaluation.
There are downsides to lazy-by-default, of course.
(Not a quick read, but not too huge, and it is a classic that is well worth reading sometime).
Elm, another haskell-like, _strict_ language, models entire applications around the strict left fold over events https://guide.elm-lang.org/architecture/
We actually do the same in Jobmachine. The application is driven by a strict left fold over incoming events and current state.