mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
[haskell.html.markdown] Explanation for Haskell '$' operator
with support from @geoffliu
This commit is contained in:
parent
2f43da109f
commit
e8a1ee8912
@ -205,9 +205,8 @@ foo 5 -- 75
|
|||||||
-- Haskell has another operator called `$`. This operator applies a function
|
-- Haskell has another operator called `$`. This operator applies a function
|
||||||
-- to a given parameter. In contrast to standard function application, which
|
-- to a given parameter. In contrast to standard function application, which
|
||||||
-- has highest possible priority of 10 and is left-associative, the `$` operator
|
-- 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
|
-- 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 expression on its right is applied as the parameter to the function on its left.
|
||||||
-- the `$`.
|
|
||||||
|
|
||||||
-- before
|
-- before
|
||||||
(even (fib 7)) -- false
|
(even (fib 7)) -- false
|
||||||
|
Loading…
Reference in New Issue
Block a user