Appendix: what catches you out
These are the Roc surprises the chapters meet, sorted by where they first show up. The last column names the chapter.
| What you see | What's going on | Chapter |
|---|---|---|
| A method call with no import | A method sits inside its type's braces, and the call finds it from the type of the value before the dot | Functions |
| A helper with no keyword to say it's private | Anything outside a type's braces is private to its module | Where clauses: asking a kind |
A where clause matching the wrong method |
A clause matches a method by its name and type alone, so the pipeline's methods all start with "scenery" | Where clauses: asking a kind |
| A crash with a sentence about a sum | Fraction. crashes on a ratio outside 0 to 1, because such a ratio means the sum behind it is wrong |
Errors as tag unions |
var and while inside a pure function |
A variable lives and dies inside its function, so the function is still pure | Variables and loops: rehearsal |
?? crash on a lookup |
It enforces an invariant: the lookup always finds its value, and a miss is a bug | The bird |
| A frame hash that moves after a sum was regrouped | Floating-point sums and products depend on their order, so the order is part of what they mean | Proving it |
An expect that can't see a type |
An expect can name only what its module imports, so a check that needs several modules lives in gates/expects/ |
Proving it |