Skip to content

Commit 3583071

Browse files
committed
Fixed Type Mismatch message for If.
1 parent 63d0d4b commit 3583071

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

004_type_systems.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ typeof expr = case expr of
404404
then throwError $ TypeMismatch ta TBool
405405
else
406406
if tb /= tc
407-
then throwError $ TypeMismatch ta tb
407+
then throwError $ TypeMismatch tb tc
408408
else return tc
409409

410410
Tr -> return TBool
@@ -484,7 +484,7 @@ We can consider a very simple type system for our language that will consist of
484484
$$
485485
\begin{aligned}
486486
\tau :=\ & \t{Int} \\
487-
& \t{Bool} \\
487+
& \t{Bool} \\
488488
& \tau \rightarrow \tau \\
489489
\end{aligned}
490490
$$

chapter5/calc_typed/Check.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ typeof expr = case expr of
4848
then throwError $ TypeMismatch ta TBool
4949
else
5050
if tb /= tc
51-
then throwError $ TypeMismatch ta tb
51+
then throwError $ TypeMismatch tb tc
5252
else return tc
5353

5454
check :: Expr -> Either TypeError Type

0 commit comments

Comments
 (0)