Haskell Language Function composition Right-to-left composition


Example

(.) lets us compose two functions, feeding output of one as an input to the other:

(f . g) x = f (g x)

For example, if we want to square the successor of an input number, we can write

((^2) . succ) 1        --    4

There is also (<<<) which is an alias to (.). So,

(+ 1) <<< sqrt $ 25    --    6