The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

197468 (1) [Avatar] Offline
#1
Since "variables aren't variable" perhaps a better heading for section 1.3.1 is "Symbols, not Variables"?

Another detail that surprised me in this section is that when I typed Listing 1.4 into GHCi, it didn't complain. The reason why is explained later in 1.3.2, but perhaps it is important to at least mention that here?

I'd suggest something like "Won't compile since it changes the value mapped to the symbol x, but, as explained in a the next section, GHCi will allow this".

My rationale for making this distinction early is that programmers who have already learned the value of working in the REPL will find it surprising when behavior of the REPL differs from the compiler. It is important to explain these differences at the point when someone is likely to encounter them.

The explanation of "let" in section 1.3.2 the concept here left me a bit confused.

Since "let" is used to introduce local symbol mappings of immutable values in at least several other languages that support functional programming (Clojure, Swift, and Scala, just to name a few), my expectation is that it has a similar purpose in Haskell, not to introduce "variables that are variable".

If, at this point in the book, the point is that GHCi allows you to redefine a symbol, perhaps the example should omit "let"? After all, the example of redefining a symbol works without "let":

% ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Prelude> x = 7
Prelude> x
7
Prelude> x = [1,2,3]
Prelude> x
[1,2,3]


If, instead, the goal of this section is to introduce the concept of symbolic mappings of immutable values, then perhaps it would be good to be explicit about this concept?