2010-06-30

superdot


Prelude Control.Applicative> let superdot =
(((<*>).(((<*>).).(((.).).).(.)))<*>const const)
Prelude ...> :t superdot
superdot ::
(b -> b -> c) -> (b1 -> b) -> b1 -> b1 -> c
Prelude ...> superdot compare snd (0, 1) (0, 0)
GT


Hi, it is NISHIO Hirokazu. I just needed "dot" operator for 2-args function.


Prelude ...> let superdot = \f g x y -> f (g x) (g y)
Prelude ...> superdot compare snd (0, 1) (1, 0)
GT


Why such a function isn't in Prelude?

2 comments:

rst76 said...

Data.Function.on ?
http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/Data-Function.html#v:on

NISHIO Hirokazu said...

That's it!
Thank you for information!