Haskell operator vs function precedence

后端 未结 5 444
难免孤独
难免孤独 2020-12-01 05:30

I am trying to verify something for myself about operator and function precedence in Haskell. For instance, the following code

list = map foo $ xs
         


        
5条回答
  •  忘掉有多难
    2020-12-01 06:00

    The difference is that infix operators get placed between their arguments, so this

    list = map foo $ xs
    

    can be rewritten in prefix form as

    list = ($) (map foo) xs
    

    which, by the definition of the $ operator, is simply

    list = (map foo) xs
    

提交回复
热议问题