concept solution in category haskell

appears as: solution, The solution, solutions, solution
Get Programming with Haskell

This is an excerpt from Manning's book Get Programming with Haskell.

It’s great that you have a solution! IIFE works on exactly the same principles as our example of replacing a where statement. Whenever you create a new function, named or not, you create a new scope, which is the context in which a variable is defined. When a variable is used, the program looks at the nearest scope; if the definition of the variable isn’t there, it goes to the next one up. This particular type of variable lookup is called lexical scope. Both Haskell and JavaScript use lexical scoping, which is why IIFE and your lambda function variables behave in a similar fashion. Figure 3.4 shows an example of a variable definition and three function definitions that use lexical scope to change their values.

Figure 30.4. This is the only pattern you need a solution for; the Monad type class provides an answer.