July 2023
Intermediate to advanced
670 pages
17h 13m
English
Now that you’ve learned how to create new top-level variables and functions, it’s time to look at how to build more complex functions. In this section, you’ll learn how to build larger and more complex functions by building up intermediate computations using let bindings.
Let bindings allow you to give a name to some particular expression in your program. Let’s start with an example. We’ll rewrite our makeGreeting function from before to use an intermediate value. If you still have access to your previous file where you defined makeGreeting, feel free to re-use it. Otherwise, create a new Main.hs with a function named makeGreeting with the following definition:
| | module Main where |
| | |
| | makeGreeting ... |
Read now
Unlock full access