mirror of
https://github.com/sdiehl/write-you-a-haskell.git
synced 2024-08-16 15:11:06 +03:00
Added missing TArr to the type definition
TArr is referenced in the code a few times but is never defined. In the code it is part of the Type datatype, so I added it there.
This commit is contained in:
parent
70952229ba
commit
d8bb6deb0c
@ -318,13 +318,15 @@ that would become stuck. Looking at the evaluation rules, each of the guarded
|
||||
pattern matches gives us a hint of where things might "go wrong" whenever a
|
||||
boolean is used in the place of a number and vice versa. We'd like to statically
|
||||
enforce this invariant at compile-time instead, and so we'll introduce a small
|
||||
type system to handle the two syntactic categories of terms that exist. The
|
||||
abstract type of natural numbers and the type of booleans:
|
||||
type system to handle the two syntactic categories of terms that exist. In
|
||||
addition to the arrow type, we add the abstract type of natural numbers and the
|
||||
type of booleans:
|
||||
|
||||
$$
|
||||
\begin{aligned}
|
||||
\tau ::=\ & \t{Bool} \\
|
||||
& \t{Nat} \\
|
||||
& \tau \rightarrow \tau \\
|
||||
\end{aligned}
|
||||
$$
|
||||
|
||||
@ -334,6 +336,7 @@ Which is implemented in Haskell as the following datatype:
|
||||
data Type
|
||||
= TBool
|
||||
| TNat
|
||||
| TArr Type Type
|
||||
```
|
||||
|
||||
Now for the typing rules:
|
||||
|
Loading…
Reference in New Issue
Block a user