Haskell beginner here having problem deriving the type of (.).(.) --
Prelude> :t ((.).(.))
((.).(.)) :: (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c
This is how I think: suppose (.).(.) takes two arguments A and B, then
(.).(.) A B = (.).(A.B)
and suppose the above takes another argument C --
(.).(A.B) C = (.)((A.B) C)
adding argument D to the above --
(.)((A.B) C) D = ((A.B) C).D
where D, A, B, A.B, and ((A.B) C) are(return) functions, and --
D :: a -> b
(A.B) C :: b -> c
A.B :: d -> b -> c
A :: e -> b -> c
B :: d -> e
C :: d
so (.).(.) :: A -> B -> C -> D becomes --
(.).(.) :: (e -> b -> c) -> (d -> e) -> d -> a -> b
which is light years away from the correct type signature.
What's the proper derivation and what's wrong in my steps?