I'm trying to establish the best way to understand a series of embedded anonymous expressions such as:
(\f -> (\g -> (\x -> f (g x) ) ) )
In Haskell. I don't have too much trouble with simpler expressions such as:
(\x -> x + 1)
Which states that the function takes a Number and returns a number:
Num a => a -> a
But when things are embedded like this I get quite lost. My attempt to understand it is that the anonymous function pipes the argument from f to g to x right away, where I should then begin writing the typing as it is where the variable is used. But I've tried rationalizing maybe four or five different explanations and I keep getting caught up on what looks like a recursive function call in the innermost function.
Can the typing of this problem be figured out in an easier manner?