
On Mon, Jul 1, 2013 at 2:03 PM, Marc Gorenstein
Here are two examples of operator sections. The first takes the infix operator / and turns it into a prefix operator.
Prelude> let eight_div_by = ((/) 8 ) Prelude> eight_div_by 4 2.0
Yes. A section is just this conversion of an infix operator to a prefix function, but with one parameter carried along with it. You can supply it on either side as appropriate; (/ 8) is the same as (\x -> x / 8) which in turn is the same as (\x -> (/) x 8), whereas (8 /) is (\x -> 8 / x) is (\x -> (/) 8 x). Note that it must be *inside* the parentheses to be a section; if it's outside, then it's a normal function (not operator!) parameter. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net