What is the difference between . (dot) and $ (dollar sign)?

后端 未结 13 1987
庸人自扰
庸人自扰 2020-11-22 04:57

What is the difference between the dot (.) and the dollar sign ($)?

As I understand it, they are both syntactic sugar for not needing to us

13条回答
  •  时光取名叫无心
    2020-11-22 05:07

    A great way to learn more about anything (any function) is to remember that everything is a function! That general mantra helps, but in specific cases like operators, it helps to remember this little trick:

    :t (.)
    (.) :: (b -> c) -> (a -> b) -> a -> c
    

    and

    :t ($)
    ($) :: (a -> b) -> a -> b
    

    Just remember to use :t liberally, and wrap your operators in ()!

提交回复
热议问题