Haskell function composition

后端 未结 6 1490
梦如初夏
梦如初夏 2021-02-01 14:42

I am reading this tutorial on Haskell. They define function composition as the following:

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


        
6条回答
  •  南方客
    南方客 (楼主)
    2021-02-01 15:14

    Fun side note. Function composition is the equivalent of a syllogism in logic:

    All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

    A syllogism composes two material implications into one:

    (Man => Mortal), (Socrates => Man), therefore (Socrates => Mortal)
    

    Therefore...

    (b -> c) -> (a -> b) -> (a -> c)
    

    ... which is the type of the . function.

提交回复
热议问题