3 ms·
Composing things with the dot doesn't execute anything. It creates a new function. In Haskell it's actually composed backwards. The first function executed aft
by kilgnad 4y ago
Composing things with the dot doesn't execute anything.
It creates a new function. In Haskell it's actually composed backwards. The first function executed after you compose your function and apply that function is to the right.
Additionally each composition must have inputs and outputs that match the neighboring functions.
Nobody thinks this way when writing procedures. Each instruction is independent of the other. Composition is about building a pipeline, very very not imperative.
Do notation in Haskell is the closest thing in go to imperative. It is not composition. It's just an series of endlessly nesting closures which technically is even more harder to reason about. Do notation unravels this in ways that are hard to understand what's truly going on.
The point is this. Haskell and elm are not imperative, at times they can imitate imperativeness but to deal with these languages 100 percent involves thinking differently in ways that are unnatural. No amount of bending and breaking is going to turn these languages into something you can call imperative.
- anon291 4y agoYeah and composing things with a semicolon creates a new c program Haskell is an expression language and a runtime environment. The expression language is more powerful than c, but c et al are also expression languages plus environments, just not typically talked about that way. Because the expression language is quite simple. Imperative do this then that is a exactly function composition where the pipeline is the state. In other words imperative languages provide an implicit function. This is most obviously seen with stack based concatenative languages.