using (manually) pattern matching and rewriting variable types
(.)has a type (b -> c) -> ((a -> b) -> a -> c), so the first argument must be of type b -> c. Now, if we use it again, we must replace bwith b' -> c'and cby (a' -> b') -> a' -> c')(the second (.)must be of type (b' -> c') -> ((a' -> b') -> a' -> c')), and we will get
(a -> b' -> c') -> a -> (a' -> b') -> a' -> c'
which is (after renaming) the same as above.
Please note that I used a -> b -> c = a -> (b -> c)here
using GHCi
, - , GHCi - , , .
:
$ ghci
GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help
Prelude> :t (.)(.)
(.)(.) :: (a -> b -> c) -> a -> (a1 -> b) -> a1 -> c
Prelude>
, (a -> b -> c) -> a -> (a1 -> b) -> a1 -> c
btw: :t :type, :help GHCi.