> you are correct,but as in the following, > > > (square . fst) :: (Int,b) -> Int > > > > > > (Char.toUpper . snd) :: (a,Char) -> Char > > you get a Int and Char out of the two composed functions, namely square.fst, > Char.toUpper.snd.But in the type declaration of > pair, which appeared to me,it meant its arguments must be two functions which > are of the same type namely a,whereas Int and > Char passed to as arguments are of different types here, and that's the > reason I thought it wouldn't work.
The signature says it takes two functions, which take the same type to *different* types ((a->b), (a->c)). In your case, 'a' is guaranteed the same type because you're applying it to the same value (in this case its type is (Int, Char)). So you are not passing Int or Char but (Int, Char) to 'fst' and 'snd'. The Int -> Int and Char -> Char functions never see the type they don't understand because the selectors 'fst' and 'snd' have stripped those values off. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe