(.)
takes two functions that take one value and return a value:
(.) :: (b -> c) -> (a -> b) -> a -> c
Since (.)
takes two arguments, I feel like (.).(.)
should be invalid, but it's perfectly fine:
(.).(.) :: (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c
What is going on here? I realize this question is badly worded...all functions really just take one argument thanks to currying. Maybe a better way to say it is that the types don't match up.
Yes this is due to currying.
(.)
as all functions in Haskell only takes one argument. What you are composing is the first partial call to each respective composed(.)
which takes its first argument (the first function of the composition).