Direction of data flow
From HaskellWiki
(Difference between revisions)
(translated table from the german page) |
(let vs. where) |
||
| Line 11: | Line 11: | ||
|- | |- | ||
| monadic composition || <hask> f >>= g </hask> | | monadic composition || <hask> f >>= g </hask> | ||
| + | |- | ||
| + | | let expression || <hask> let x = 2 in x*x </hask> || (first definition, then usage) | ||
|} | |} | ||
| Line 22: | Line 24: | ||
|- | |- | ||
| monadic composition || <hask> g =<< f </hask> | | monadic composition || <hask> g =<< f </hask> | ||
| + | |- | ||
| + | | where clause || <hask> x*x where x = 2 </hask> || (first usage, then definition) | ||
|} | |} | ||
Current revision
In Haskell the direction of data flow symbolized by the notations differs amongst the notations. Both directions occur equally frequently:
from left to right:
| function definition | f x = x*x | (input left, output right) |
| Lambda | \ x -> x*x | |
| do notation | do f; g | |
| monadic composition | f >>= g | |
| let expression | let x = 2 in x*x | (first definition, then usage) |
from right to left:
| function application | f x f $ x | (input right, applied function left) |
| composition | g . f | |
| results of monads | do x <- f | |
| monadic composition | g =<< f | |
| where clause | x*x where x = 2 | (first usage, then definition) |
1 Weblinks
- http://www.haskell.org/pipermail/libraries/2005-August/004315.html
- http://www.iba-cg.de/doc/hal1-haskell-with-style.pdf
2 See also
There is still something to translate from De/Flussrichtung
