Merge pull request #86 from VitorCBSB/master

Chapter 5: Fixed Type Mismatch message for If.
This commit is contained in:
Stephen Diehl 2016-07-11 14:12:41 -04:00 committed by GitHub
commit 5c515bd386
2 changed files with 3 additions and 3 deletions

View File

@ -404,7 +404,7 @@ typeof expr = case expr of
then throwError $ TypeMismatch ta TBool then throwError $ TypeMismatch ta TBool
else else
if tb /= tc if tb /= tc
then throwError $ TypeMismatch ta tb then throwError $ TypeMismatch tb tc
else return tc else return tc
Tr -> return TBool Tr -> return TBool
@ -484,7 +484,7 @@ We can consider a very simple type system for our language that will consist of
$$ $$
\begin{aligned} \begin{aligned}
\tau :=\ & \t{Int} \\ \tau :=\ & \t{Int} \\
& \t{Bool} \\ & \t{Bool} \\
& \tau \rightarrow \tau \\ & \tau \rightarrow \tau \\
\end{aligned} \end{aligned}
$$ $$

View File

@ -48,7 +48,7 @@ typeof expr = case expr of
then throwError $ TypeMismatch ta TBool then throwError $ TypeMismatch ta TBool
else else
if tb /= tc if tb /= tc
then throwError $ TypeMismatch ta tb then throwError $ TypeMismatch tb tc
else return tc else return tc
check :: Expr -> Either TypeError Type check :: Expr -> Either TypeError Type