From 3583071ab904feb518e21eb58a4d5586d8bcc4d3 Mon Sep 17 00:00:00 2001 From: Vitor Coimbra de Oliveira Date: Thu, 7 Jul 2016 11:44:06 -0300 Subject: [PATCH] Fixed Type Mismatch message for If. --- 004_type_systems.md | 4 ++-- chapter5/calc_typed/Check.hs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/004_type_systems.md b/004_type_systems.md index 4e5ca15..fc26584 100644 --- a/004_type_systems.md +++ b/004_type_systems.md @@ -404,7 +404,7 @@ typeof expr = case expr of then throwError $ TypeMismatch ta TBool else if tb /= tc - then throwError $ TypeMismatch ta tb + then throwError $ TypeMismatch tb tc else return tc Tr -> return TBool @@ -484,7 +484,7 @@ We can consider a very simple type system for our language that will consist of $$ \begin{aligned} \tau :=\ & \t{Int} \\ - & \t{Bool} \\ + & \t{Bool} \\ & \tau \rightarrow \tau \\ \end{aligned} $$ diff --git a/chapter5/calc_typed/Check.hs b/chapter5/calc_typed/Check.hs index f053b59..30273c8 100644 --- a/chapter5/calc_typed/Check.hs +++ b/chapter5/calc_typed/Check.hs @@ -48,7 +48,7 @@ typeof expr = case expr of then throwError $ TypeMismatch ta TBool else if tb /= tc - then throwError $ TypeMismatch ta tb + then throwError $ TypeMismatch tb tc else return tc check :: Expr -> Either TypeError Type