Function Composition

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?

  1. (a -> b) -> (c -> a) -> c -> b
  2. a -> b -> c -> a -> c -> b
  3. (a -> b) -> (c -> a) -> b -> c
  4. (a -> b) -> (c -> a) -> a -> c
  5. (a -> b) -> (b -> c) -> a -> c
4 3 1 5 2

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.

1 solution

Note that for function composition to be able to compose f g f \circ g , the range of g g must be in the domain of f f .

That is why the answer is ( a -> b) -> (c -> a) -> c -> b

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...