
Christian Maeder wrote:
Hoogle did not find a function of type:
(b -> b -> b) -> (a -> b) -> (a -> b) -> a -> b
or (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
But maybe such a function is worth being added to Data.Function.
Hello Christian This is the big Phi or S' combinator. I would certainly second its addition to Data.Function. sprime p q r s = p (q s) (r s) Best wishes Stephen

On Tue, Oct 20, 2009 at 04:29:43PM +0100, Stephen Tetley wrote:
Christian Maeder wrote:
Hoogle did not find a function of type:
(b -> b -> b) -> (a -> b) -> (a -> b) -> a -> b
or (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
But maybe such a function is worth being added to Data.Function.
Hello Christian
This is the big Phi or S' combinator. I would certainly second its addition to Data.Function.
sprime p q r s = p (q s) (r s)
But this function already exists in the standard libraries: it is called liftM2/liftA2, specialized to the ((->) e) monad/applicative instance. This is what the rest of the thread has been talking about. -Brent

Stephen Tetley schrieb:
Christian Maeder wrote:
Hoogle did not find a function of type:
(b -> b -> b) -> (a -> b) -> (a -> b) -> a -> b
or (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
But maybe such a function is worth being added to Data.Function.
I did not find liftM2 (or liftA2) although I "knew" liftM2 and instance Functor/Monad ((->) a).
Hello Christian
This is the big Phi or S' combinator. I would certainly second its addition to Data.Function.
sprime p q r s = p (q s) (r s)
At least for documentation purposes (other than this thread) such an explicit definition makes sense to be put into a source. Be it just to show the (non-)obvious. Cheers Christian Btw. for the actual problem I suggest now: ((< 0.5) . abs)

Excerpts from Christian Maeder's message of Tue Oct 20 12:34:23 -0400 2009:
Stephen Tetley schrieb:
Christian Maeder wrote:
Hoogle did not find a function of type:
(b -> b -> b) -> (a -> b) -> (a -> b) -> a -> b
or (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
But maybe such a function is worth being added to Data.Function.
I did not find liftM2 (or liftA2) although I "knew" liftM2 and instance Functor/Monad ((->) a).
Perhaps a useful feature to add to Hoogle would be the ability to print both the generic type instance, and then a "specialized" version based off of the query that was made. Cheers, Edward
participants (4)
-
Brent Yorgey
-
Christian Maeder
-
Edward Z. Yang
-
Stephen Tetley