Skip to content

Commit

Permalink
Revert "Remove dodgy check rule"
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 committed Oct 2, 2015
1 parent 7e0fe37 commit 7426149
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Language/PureScript/TypeChecker/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ check' v@(Constructor c) ty = do
check' (Let ds val) ty = do
(ds', val') <- inferLetBinding [] ds val (`check` ty)
return $ TypedValue True (Let ds' val') ty
check' val ty | containsTypeSynonyms ty = do
ty' <- introduceSkolemScope <=< expandAllTypeSynonyms <=< replaceTypeWildcards $ ty
check val ty'
check' val kt@(KindedType ty kind) = do
checkTypeKind ty kind
val' <- check' val ty
Expand All @@ -612,6 +615,12 @@ check' val ty = do
Nothing -> throwError . errorMessage $ SubsumptionCheckFailed
Just v' -> return $ TypedValue True v' ty

containsTypeSynonyms :: Type -> Bool
containsTypeSynonyms = everythingOnTypes (||) go where
go (SaturatedTypeSynonym _ _) = True
go _ = False


-- |
-- Check the type of a collection of named record fields
--
Expand Down

0 comments on commit 7426149

Please sign in to comment.