Improved Let syntax and improvements to type system
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index 68e0859..484430d 100644 (file)
--- a/sem.icl
+++ b/sem.icl
@@ -384,13 +384,13 @@ instance type FunDecl where
         (case expected of
             Nothing = pure zero
             Just (FuncType expected_) = lift (unify expected_ given)
-            Just expected_ = lift (unify expected_ given))
-        >>= \s3 ->
+            Just expected_ = lift (unify expected_ given)
+        >>= \s3 ->
         let ftype = subst (compose s3 $ compose s2 s1) given in
-        (case expected of
-            Just (FuncType _) = pure (FuncType ftype)
-            _                 = pure ftype)
-        >>= \ftype_->
+        (case ftype of
+            _ ->> _ = pure ftype
+            _       = pure $ FuncType ftype
+        >>= \ftype_->
         generalize ftype_ >>= \t->
         putGamma outerScope >>|
         changeGamma (extend f t) >>|