@@ -85,8 +85,10 @@ What about doing `5 + "llama"` or `5 == True`?
85
85
Well, if we try the first snippet, we get a big scary error message!
86
86
87
87
``` {.haskell: .ghci}
88
- • No instance for (Num String) arising from a use of ‘+’
89
- • In the expression: 5 + "llama"
88
+ <interactive>:1:1: error: [GHC-39999]
89
+ • No instance for ‘Num String’ arising from the literal ‘5’
90
+ • In the first argument of ‘(+)’, namely ‘5’
91
+ In the expression: 5 + "llama"
90
92
In an equation for ‘it’: it = 5 + "llama"
91
93
```
92
94
@@ -102,6 +104,13 @@ We'll take a closer look at types a bit later.
102
104
Note: you can do ` 5 + 4.0 ` because ` 5 ` is sneaky and can act like an integer or a floating-point number.
103
105
` 4.0 ` can't act like an integer, so ` 5 ` is the one that has to adapt.
104
106
107
+ ::: {.hintbox}
108
+ ** Note:** GHC errors are all assigned unique identifiers such as ` GHC-39999 ` above.
109
+ Whenever you are stuck with a stubborn error, you can look it up at
110
+ [ https://errors.haskell.org/ ] ( https://errors.haskell.org/ ) to learn typical causes
111
+ and solutions.
112
+ :::
113
+
105
114
You may not have known it but we've been using functions now all along.
106
115
For instance, ` * ` is a function that takes two numbers and multiplies them.
107
116
As you've seen, we call it by sandwiching it between them.
@@ -777,8 +786,9 @@ What if we tried to make a shape like `[(1,2),(8,11,5),(4,5)]`?
777
786
Well, we'd get this error:
778
787
779
788
``` {.haskell: .ghci}
780
- • Couldn't match expected type ‘(a, b)’
781
- with actual type ‘(a0, b0, c0)’
789
+ <interactive>:1:8: error: [GHC-83865]
790
+ • Couldn't match expected type: (a, b)
791
+ with actual type: (a0, b0, c0)
782
792
• In the expression: (8, 11, 5)
783
793
In the expression: [(1, 2), (8, 11, 5), (4, 5)]
784
794
In an equation for ‘it’: it = [(1, 2), (8, 11, 5), (4, 5)]
0 commit comments