summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2013-11-07 16:36:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2013-11-07 16:36:00 (GMT)
commit185f7bf62d9482c2b1253e2fdd47510dca2aee62 (patch)
tree0dab6e5070020770bb64e96f51bbe3c56df5835a
parent1b1348b9f2fccccd31b9820243ef7c3a39297353 (diff)
version 0.1.50.1.5
-rw-r--r--purescript.cabal2
-rw-r--r--src/Language/PureScript/TypeChecker/Types.hs13
2 files changed, 9 insertions, 6 deletions
diff --git a/purescript.cabal b/purescript.cabal
index cc0fb63..795fa61 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -1,5 +1,5 @@
name: purescript
-version: 0.1.4
+version: 0.1.5
cabal-version: >=1.8
build-type: Simple
license: MIT
diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs
index 247fa8a..489be24 100644
--- a/src/Language/PureScript/TypeChecker/Types.hs
+++ b/src/Language/PureScript/TypeChecker/Types.hs
@@ -436,10 +436,13 @@ typeConstraintsForBinder val b@(NamedBinder name binder) = do
me <- fresh
(cs, m) <- typeConstraintsForBinder val binder
return (TypeConstraint me (TUnknown val) (BinderOrigin b) : cs, M.insert name me m)
-typeConstraintsForBinder val b@(GuardedBinder cond binder) = do
- (cs1, m) <- typeConstraintsForBinder val binder
- (cs2, n) <- typeConstraints m cond
- return (TypeConstraint n Boolean (ValueOrigin cond) : cs1 ++ cs2, m)
+
+typeConstraintsForGuardedBinder :: M.Map Ident Int -> Int -> Binder -> Check ([TypeConstraint], M.Map Ident Int)
+typeConstraintsForGuardedBinder m val b@(GuardedBinder cond binder) = do
+ (cs1, m1) <- typeConstraintsForBinder val binder
+ (cs2, n) <- typeConstraints (m `M.union` m1) cond
+ return (TypeConstraint n Boolean (ValueOrigin cond) : cs1 ++ cs2, m1)
+typeConstraintsForGuardedBinder m val b = typeConstraintsForBinder val b >>= return
constantBinder :: Binder -> Int -> Type -> Check ([TypeConstraint], M.Map Ident Int)
constantBinder b val ty = return ([TypeConstraint val ty (BinderOrigin b)], M.empty)
@@ -447,7 +450,7 @@ constantBinder b val ty = return ([TypeConstraint val ty (BinderOrigin b)], M.em
typeConstraintsForBinders :: M.Map Ident Int -> Int -> Int -> [(Binder, Value)] -> Check [TypeConstraint]
typeConstraintsForBinders _ _ _ [] = return []
typeConstraintsForBinders m nval ret ((binder, val):bs) = do
- (cs1, m1) <- typeConstraintsForBinder nval binder
+ (cs1, m1) <- typeConstraintsForGuardedBinder m nval binder
(cs2, n2) <- typeConstraints (m `M.union` m1) val
cs3 <- typeConstraintsForBinders m nval ret bs
return (TypeConstraint n2 (TUnknown ret) (BinderOrigin binder) : cs1 ++ cs2 ++ cs3)