notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

FunctionCompositionOperator.md (441B)


      1 # Function Composition Operator
      2 
      3 **Source:** Effective Haskell
      4 
      5 **Chapter:** 1
      6 
      7 **Definition:** The function composition operator (.) is a [higher-order function](HigherOrderFunction.md) used to combine two functions, yielding a new function that accepts an argument to the right-most function.
      8 
      9 ## Example
     10 
     11 ```haskell
     12 
     13 addOne num = num + 1
     14 timesTwo num = num * 2
     15 
     16 timesTwoPlusOne = timesTwo . addOne
     17 
     18 main = print $ timesTwoPlusOne 10
     19 
     20 ```