Skip to content

Commit

Permalink
Remove meet judgment, #1719
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 committed Dec 21, 2015
1 parent 1e8f4aa commit 3d84af6
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/Language/PureScript/TypeChecker/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ infer' (Case vals binders) = do
return $ TypedValue True (Case vals' binders') ret
infer' (IfThenElse cond th el) = do
cond' <- check cond tyBoolean
v2@(TypedValue _ _ t2) <- infer th
v3@(TypedValue _ _ t3) <- infer el
(v2', v3', t) <- meet v2 v3 t2 t3
return $ TypedValue True (IfThenElse cond' v2' v3') t
th'@(TypedValue _ _ thTy) <- infer th
el'@(TypedValue _ _ elTy) <- infer el
unifyTypes thTy elTy
return $ TypedValue True (IfThenElse cond' th' el') thTy
infer' (Let ds val) = do
(ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
return $ TypedValue True (Let ds' val') valTy
Expand Down Expand Up @@ -706,25 +706,6 @@ checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} _ =
return (fnTy, App fn dict)
checkFunctionApplication' _ fnTy arg _ = throwError . errorMessage $ CannotApplyFunction fnTy arg

-- | Compute the meet of two types, i.e. the most general type which both types subsume.
-- TODO: is this really needed?
meet ::
(Functor m, Applicative m, MonadState CheckState m, MonadError MultipleErrors m) =>
Expr ->
Expr ->
Type ->
Type ->
m (Expr, Expr, Type)
meet e1 e2 (ForAll ident t1 _) t2 = do
t1' <- replaceVarWithUnknown ident t1
meet e1 e2 t1' t2
meet e1 e2 t1 (ForAll ident t2 _) = do
t2' <- replaceVarWithUnknown ident t2
meet e1 e2 t1 t2'
meet e1 e2 t1 t2 = do
unifyTypes t1 t2
return (e1, e2, t1)

-- |
-- Ensure a set of property names and value does not contain duplicate labels
--
Expand Down

0 comments on commit 3d84af6

Please sign in to comment.