If you read the book carefully, it says (emphasis mine):
Open up your favorite text editor and punch in this function that takes a number and multiplies it by two.
doubleMe x = x + x
Which is fine for ghc, because it can understand that it's a function declaration (and the book didn't tell you to try it in ghci. In fact, shortly after it explains how let
can be used "to define a name right in GHCI. Doing let a = 1 inside GHCI is the equivalent of writing a = 1 in a script and then loading it."). To make ghci understand that you are defining a function you need to use let
:
Prelude> let doubleMe x = x + x
Prelude> doubleMe 10
20