Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell >.> notation

In the book "The Craft of Function Programming" the symbol '>.>' joins functions together, opposite the direction of '.'. But when I implemented it using ghci, it shows the error '>.>' out of scope. Why? Is it an old notation that is not used anymore?

like image 880
HHC Avatar asked Dec 04 '22 18:12

HHC


1 Answers

>.> is not defined by default, but you could define it yourself:

infixl 9  >.>
(>.>) = flip (.)

or equivalently,

infixl 9  >.>
f >.> g = g . f

(I gave the fixity declaration based on the infixr 9 . in the Prelude.)

like image 59
Prateek Avatar answered Jan 05 '23 23:01

Prateek