Errata

Programming Elm

Errata for Programming Elm

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
https://learning.oreilly.com/library/view/programming-elm/9781680507164/f_0043.xhtml
2nd code block

In the second code block, the following example is provided for running in the Elm REPL:

---
> list = ​List​.range 1 10​ 
[1,2,3,4,5,6,7,8,9,10] : ​List​ ​Int​​ ​

 > list \​ 
| |> ​List​.map (\n -> n * 2) \
​ | |> ​Debug​.log ​"​​doubled"​ \​ 
| |> ​List​.filter (\n -> n > 6) \​ 
| |> ​Debug​.log ​"​​filtered"​ \​ 
| |> ​List​.map (\n -> n * n)​ 

doubled: [2,4,6,8,10,12,14,16,18,20]​ 
filtered: [8,10,12,14,16,18,20]​
[64,100,144,196,256,324,400] : ​List​ ​Int
---
On a Mac, Elm 0.19.1, this results in the following error:
-- SYNTAX PROBLEM --------------------------------------------------------- REPL

I got stuck here:

4| list \
^
Whatever I am running into is confusing me a lot! Normally I can give fairly
specific hints, but something is really tripping me up this time.
----

To resolve this, I recoded the example as follows:
---
> processList list =
| list
| |> List.map (\n -> n * 2)
| |> Debug.log "doubled"
| |> List.filter (\n -> n > 6)
| |> Debug.log "filtered"
| |> List.map (\n -> n * n)
|
<function> : List number -> List number
> processList (List.range 1 10)
doubled: [2,4,6,8,10,12,14,16,18,20]
filtered: [8,10,12,14,16,18,20]
[64,100,144,196,256,324,400] : List Int
>
---
TBH, I'm not sure whether this is a bug in the REPL or maybe a purposeful change. But the second version does not require the backslash mutli-line character.

Mike Gabriel  Jan 30, 2020