using composition with multiple argument functions

Dean Herington [email protected]
Sat, 2 Feb 2002 20:42:52 -0500 (EST)


On Fri, 1 Feb 2002, Ashley Yakeley wrote:

> At 2002-02-01 10:45, Dean Herington wrote:
> 
> >h1 :: (a -> a -> (a,a)) -> (a -> a -> (a,a)) -> (a -> a -> (a,a))
> >h1 = f1 # g1
> 
> I think you mean:
> 
> h1 :: (a -> a -> (a,a)) -> (a -> a -> (a,a)) -> (a -> a -> (a,a))
> h1 f g = f # g

Actually, I botched the type declaration.  I meant:

> h1 :: a -> a -> (a,a)
> h1 = f1 # g1

But your suggestion, which compiles without complaint, gives me an inkling
why the above doesn't work.  With `h1 f g = f # g` and the type
declaration for h1, the compiler sees that f1 and g1 must be used at the
same type.  With `h1 = f1 # g1`, that connection is missing.  So I guess
my `Composable` class example can't work in general.

Dean