[Haskell-cafe] Function composition

Tiago Miguel Laureano Alves tiagomlalves at gmail.com
Wed Oct 3 13:20:03 EDT 2007


Hi,

I'm playing a little bit with pointfree and function composition and  
I would like to ask you if the following is theoretical correct and  
how can I express it in haskell.

Imagine that I have the following functions
    f :: a -> b -> c -> d
    g :: d -> e

I want to compose these two functions such that:
    (g . f) :: a -> b -> c -> e
in which a, b and c are arguments of the composition. Is this  
theoretically correct?

I tried this in haskell and ghc gives me an error saying that the  
function g should be of type b -> c -> d.
With this I assume that when I specify f :: a -> b -> c -> d I'm  
really specifying f :: a -> (b -> c -> d) and such the composition  
doesn't work, but is it possible to overcome this?

Kind regards,
   Tiago



More information about the Haskell-Cafe mailing list