Writing in pointfree style f x = g x x

前端 未结 3 1674
自闭症患者
自闭症患者 2020-12-06 10:20

I am learning Haskell. I\'m sorry for asking a very basic question but I cant seem to find the answer. I have a function f defined by :

f x = g x x
         


        
3条回答
  •  半阙折子戏
    2020-12-06 10:52

    f can be written with Control.Monad.join:

    f = join g
    

    join on the function monad is one of the primitives used when constructing point-free expressions, as it cannot be defined in a point-free style itself (its SKI calculus equivalent, SIIap id id in Haskell — doesn't type).

提交回复
热议问题