diff options
author | Cornel Punga <cornel.punga@gmail.com> | 2015-03-25 18:08:32 +0200 |
---|---|---|
committer | Cornel Punga <cornel.punga@gmail.com> | 2015-03-25 18:08:32 +0200 |
commit | 2f43da109ffab5a4d3dd582cc51a7c3d95dd4987 (patch) | |
tree | d6afa3d561eb0765df65b3ab6a44a503baaa2dfb /haskell.html.markdown | |
parent | 9fb21f1ce4c02e8cad50046f90d026ccab284626 (diff) |
[haskell.html.markdown] Changed explanation for Haskell '$' operator
Diffstat (limited to 'haskell.html.markdown')
-rw-r--r-- | haskell.html.markdown | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown index f1025d44..6bdc78e0 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -202,10 +202,12 @@ foo = (*5) . (+10) foo 5 -- 75 -- fixing precedence --- Haskell has another function called `$`. Anything appearing after it will --- take precedence over anything that comes before. --- You can use `$` (often in combination with `.`) --- to get rid of a lot of parentheses: +-- Haskell has another operator called `$`. This operator applies a function +-- to a given parameter. In contrast to standard function application, which +-- has highest possible priority of 10 and is left-associative, the `$` operator +-- has priority of 0 and is right-associative. Such a low priority means that +-- all other operators on both sides of `$` will be evaluated before applying +-- the `$`. -- before (even (fib 7)) -- false |