(This is, in fact, how partial function application
works.) a is still in scope when b is defined, a and b are still in
scope when c is defined.
Brandon, I need to study this again, still dont understood how its related to partial function application.
A function of multiple arguments is actually a function of a single argument which returns a function that takes the next argument, and so on. Partial application therefore happens automatically.
Brandon, This is quite strange thing, the functions can access the globally defined variables and therefore there output is dependent not just on inputs but on those variables too. This goes against the understanding of pure functions.
You may be using a different definition of "pure" than Haskell does; the point of pure functions in Haskell is that they cannot *change* anything outside of the function scope, not that they can't *see* anything.
Also there may be another way to look at this - all the global variables are inputs to all the functions. I think this is how the haskell looks at this scenario.
There are no variables involved. "Variables" can vary; bindings are immutable. This is key to purity.
--