git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
More examples
commit667eeef3666d1a14891eabe3aceb3c1a1be4b582 authorPhil Freeman <paf31@cantab.net> dateFri 4 Oct 2013, 20:22 (13 years ago) parent79aaba9
3 files changed+19−2
examples/TypeDecl.ps+17 src/PureScript/CodeGen.hs+1−1 src/PureScript/TypeChecker/Types.hs+1−1
examples/TypeDecl.psnew file+17
@@ -0,0 +1,17 @@
1+id :: (a) -> a
2+
3+id = \x -> x
4+
5+k :: (String) -> (Number) -> String
6+
7+k = \x -> \y -> x
8+
9+iterate :: (Number) -> ((a) -> a) -> (a) -> a
10+
11+iterate = \n -> \f -> \a -> {
12+ var result = a;
13+ for (var i = 0; i < n; i = i + 1) {
14+ result = f(result);
15+ }
16+ return result;
17+}
src/PureScript/CodeGen.hs+1−1
@@ -349,7 +349,7 @@ typeToPs = fromMaybe (error "Incomplete pattern") . pattern matchType
349349 operators :: OperatorTable Type String
350350 operators =
351351 OperatorTable $ [ AssocL typeApp $ \f x -> f ++ " " ++ x
352− , Split function $ \args ret -> "(" ++ intercalate "," (map typeToPs args) ++ ") -> " ++ typeToPs ret ]
352+ , Split function $ \args ret -> "(" ++ intercalate ", " (map typeToPs args) ++ ") -> " ++ typeToPs ret ]
353353
354354externToJs :: (String, Type) -> String
355355externToJs (name, ty) = "extern " ++ name ++ " :: " ++ typeToPs ty
src/PureScript/TypeChecker/Types.hs+1−1
@@ -196,7 +196,7 @@ typeConstraints m (Case val binders) = do
196196 return (cs1 ++ cs2, ret)
197197typeConstraints m (TypedValue val ty) = do
198198 (cs, n1) <- typeConstraints m val
199− return ([TypeConstraint n1 ty], n1)
199+ return (TypeConstraint n1 ty : cs, n1)
200200 -- TODO: Kind-check the type
201201
202202unaryOperatorConstraints :: UnaryOperator -> Int -> Int -> [TypeConstraint]