In Haskell, the
.
operator represents represents
function composition
. That is to say,
(f.g) x = f(g(x))
Using the type variables
a
,
b
and
c
, what would be the type of the function composition operator itself?
(a -> b) -> (c -> a) -> c -> b
a -> b -> c -> a -> c -> b
(a -> b) -> (c -> a) -> b -> c
(a -> b) -> (c -> a) -> a -> c
(a -> b) -> (b -> c) -> a -> c
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Note that for function composition to be able to compose f ∘ g , the range of g must be in the domain of f .
That is why the answer is
( a -> b) -> (c -> a) -> c -> b