Hello,

 

this is maybe a simple question:

 

 

cbinary :: a -> b -> (a -> b -> b) -> (b -> c) -> c

 

-- Version 1 works:

 

cbinary x y f g = g (f x y)

 

-- Version 2 should be exactly the same according

-- to my understanding of the "." operator definition,

-- but fails with: 

--  Occurs check: cannot construct the infinite type: b = b -> b

--  When generalising the type(s) for `cbinary'

 

-- cbinary x y f g = (g . f) x y

 

 

Can anybody explain why this happens and how I can compose f and g?

Hint: It works fine if f is defined as an unary function.

 

Thank you very much!

 

Axel

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to