Tutorial by Examples

(.) 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) <<&lt...
Control.Category defines (>>>), which, when specialized to functions, is -- (>>>) :: Category cat => cat a b -> cat b c -> cat a c -- (>>>) :: (->) a b -> (->) b c -> (->) a c -- (>>>) :: (a -> b) -> (b -> c) -> (a -> c...
The regular composition works for unary functions. In the case of binary, we can define (f .: g) x y = f (g x y) -- which is also = f ((g x) y) = (f . g x) y -- by definition of (.) = (f .) (g x) y = ((f .) . g) x y Thus,...

Page 1 of 1