# Determining type of composed function

We would like to know the type of the function composition $$f \circ f$$. The function in question is typed as follows:

$$f :: (\alpha \rightarrow \beta \rightarrow \gamma) \rightarrow (\alpha \times \beta) \rightarrow \gamma$$

Is there a systematic way to find out types of function compositions, given the types of the composed functions?

Edit: As I forgot to mention, $$\alpha$$, $$\beta$$, $$\gamma$$ are polymorphic types, hence this composition is actually possible. Haskell says the type definition is as follows: $$f \circ f :: (\alpha \rightarrow \beta_1 \rightarrow \beta_2 \rightarrow \gamma) \rightarrow ((\alpha, \beta_1), \beta_2) \rightarrow \gamma$$.

• i can't see how f∘f could be well-typed, since the type of its output ( γ ) doesn't match either of its inputs ( (α→β→γ) and (α×β) ) - unless i'm misunderstanding what you're asking? – Alexis Sep 26 '18 at 10:52