mirror of
https://github.com/sdiehl/write-you-a-haskell.git
synced 2024-08-16 15:11:06 +03:00
chapter5/stlc/Check.hs: make case expression in check function more idiomatic
This commit is contained in:
parent
c4bf56aa76
commit
8467784d66
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user