chapter5/stlc/Check.hs: make case expression in check function more idiomatic

This commit is contained in:
Christian Sievers 2015-02-13 17:01:57 +01:00
parent c4bf56aa76
commit 8467784d66
2 changed files with 2 additions and 2 deletions

View File

@ -585,7 +585,7 @@ check expr = case expr of
t2 <- check e2
case t1 of
(TArr a b) | a == t2 -> return b
(TArr a _) -> throwError $ Mismatch t2 a
| otherwise -> throwError $ Mismatch t2 a
ty -> throwError $ NotFunction ty
Var x -> lookupVar x

View File

@ -46,7 +46,7 @@ check expr = case expr of
t2 <- check e2
case t1 of
(TArr a b) | a == t2 -> return b
(TArr a _) -> throwError $ Mismatch t2 a
| otherwise -> throwError $ Mismatch t2 a
ty -> throwError $ NotFunction ty
Var x -> lookupVar x