git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'singleargs' of github.com:paf31/purescript into singleargs
b2fb541Phil Freeman
examples/failing/NullaryAbs.pursnew file+3
@@ -0,0 +1,3 @@
1+module NullaryAbs where
2+
3+ func = \ -> "no"
examples/passing/Do.purs+6−6
@@ -9,15 +9,15 @@ instance Prelude.Monad Maybe where
9 (>>=) Nothing _ = Nothing
9 (>>=) Nothing _ = Nothing
10 (>>=) (Just a) f = f a
10 (>>=) (Just a) f = f a
11
11
12−test1 = \ -> do
12+test1 = \_ -> do
13 Just "abc"
13 Just "abc"
14
14
15−test2 = \ -> do
15+test2 = \_ -> do
16 (x : _) <- Just [1, 2, 3]
16 (x : _) <- Just [1, 2, 3]
17 (y : _) <- Just [4, 5, 6]
17 (y : _) <- Just [4, 5, 6]
18 Just (x + y)
18 Just (x + y)
19
19
20−test3 = \ -> do
20+test3 = \_ -> do
21 Just 1
21 Just 1
22 Nothing :: Maybe Number
22 Nothing :: Maybe Number
23 Just 2
23 Just 2
@@ -34,11 +34,11 @@ test5 mx my mz = do
34 z <- mz
34 z <- mz
35 Just (z + sum)
35 Just (z + sum)
36
36
37−test6 mx = \ -> do
37+test6 mx = \_ -> do
38 let Just x = mx
38 let Just x = mx
39 Just x
39 Just x
40
40
41−test8 = \ -> do
41+test8 = \_ -> do
42 Just (do
42 Just (do
43 Just 1)
43 Just 1)
44
44
@@ -60,7 +60,7 @@ forever a = do
60 a
60 a
61 forever a
61 forever a
62
62
63−test9 = \ -> foo <$> Just 1 <*> Just 2 <*> Just 3
63+test9 = \_ -> foo <$> Just 1 <*> Just 2 <*> Just 3
64
64
65module Main where
65module Main where
66
66
examples/passing/ExternData.purs+1−1
@@ -12,7 +12,7 @@ module ExternData where
12
12
13 foreign import prompt :: IO String
13 foreign import prompt :: IO String
14
14
15− main = \ -> prompt `bind` \s -> showMessage s
15+ main = \_ -> prompt `bind` \s -> showMessage s
16
16
17module Main where
17module Main where
18
18
examples/passing/FFI.purs+1−1
@@ -9,7 +9,7 @@ module FFIModuleTest where
9
9
10import FFI
10import FFI
11
11
12−baz = \ -> foo "test"
12+baz = \_ -> foo "test"
13
13
14module Main where
14module Main where
15
15
examples/passing/Functions.purs+5−7
@@ -1,16 +1,14 @@
1module Functions where
1module Functions where
2
2
3− test1 = \ -> 0
3+ test1 = \_ -> 0
4
4
5− test2 = \_ -> 0
5+ test2 = \a b c d -> a + b + c + d
6
6
7− test3 = \a b c d -> a + b + c + d
7+ test3 = \a -> a
8
8
9− test4 = \a -> a
9+ test4 = \(%%) -> 1 %% 2
10
10
11− test5 = \(%%) -> 1 %% 2
11+ test5 = \(+++) (***) -> 1 +++ 2 *** 3
12−
13− test6 = \(+++) (***) -> 1 +++ 2 *** 3
14
12
15module Main where
13module Main where
16
14
examples/passing/Rank2Types.purs+1−1
@@ -9,7 +9,7 @@ module Rank2Types where
9
9
10 foreign import exampleST :: forall s. ST s Number
10 foreign import exampleST :: forall s. ST s Number
11
11
12− testST = \ -> runST exampleST
12+ testST = \_ -> runST exampleST
13
13
14 foreign import push :: forall el. el -> [el] -> [el]
14 foreign import push :: forall el. el -> [el] -> [el]
15
15
src/Language/PureScript/Parser/Values.hs+1−1
@@ -54,7 +54,7 @@ parseIdentifierAndValue = (,) <$> (C.indented *> C.identifier <* C.indented <* C
54parseAbs :: P.Parsec String ParseState Value
54parseAbs :: P.Parsec String ParseState Value
55parseAbs = do
55parseAbs = do
56 C.reservedOp "\\"
56 C.reservedOp "\\"
57− args <- P.many (C.indented *> (Abs <$> C.parseIdent))
57+ args <- P.many1 (C.indented *> (Abs <$> C.parseIdent))
58 C.indented *> C.reservedOp "->"
58 C.indented *> C.reservedOp "->"
59 value <- parseValue
59 value <- parseValue
60 return $ toFunction args value
60 return $ toFunction args value
src/Language/PureScript/Sugar/TypeClasses.hs+1−1
@@ -97,7 +97,7 @@ typeInstanceDictionaryDeclaration mn deps name ty decls = do
97 memberName <- mkDictionaryEntryName mn name ty ident
97 memberName <- mkDictionaryEntryName mn name ty ident
98 return (identToJs ident, TypedValue False
98 return (identToJs ident, TypedValue False
99 (if null deps then Var (Qualified Nothing memberName)
99 (if null deps then Var (Qualified Nothing memberName)
100− else foldr App (Var (Qualified Nothing memberName)) (map (\n -> Var (Qualified Nothing (Ident ('_' : show n)))) [1..length deps]))
100+ else foldl App (Var (Qualified Nothing memberName)) (map (\n -> Var (Qualified Nothing (Ident ('_' : show n)))) [1..length deps]))
101 (quantify memberType))
101 (quantify memberType))
102 memberToNameAndValue _ _ = error "Invalid declaration in type instance definition"
102 memberToNameAndValue _ _ = error "Invalid declaration in type instance definition"
103
103
src/Language/PureScript/TypeChecker/Types.hs+3−3
@@ -453,7 +453,7 @@ infer' (Var var) = do
453 ConstrainedType constraints _ -> do
453 ConstrainedType constraints _ -> do
454 env <- getEnv
454 env <- getEnv
455 dicts <- getTypeClassDictionaries
455 dicts <- getTypeClassDictionaries
456− return $ TypedValue True (foldr App (Var var) (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) ty'
456+ return $ TypedValue True (foldl App (Var var) (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) ty'
457 _ -> return $ TypedValue True (Var var) ty'
457 _ -> return $ TypedValue True (Var var) ty'
458infer' (Block ss) = do
458infer' (Block ss) = do
459 ret <- fresh
459 ret <- fresh
@@ -953,7 +953,7 @@ checkFunctionApplication' fn (ConstrainedType constraints fnTy) arg ret = do
953 env <- getEnv
953 env <- getEnv
954 dicts <- getTypeClassDictionaries
954 dicts <- getTypeClassDictionaries
955 Just moduleName <- checkCurrentModule <$> get
955 Just moduleName <- checkCurrentModule <$> get
956− checkFunctionApplication' (foldr App fn (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) fnTy arg ret
956+ checkFunctionApplication' (foldl App fn (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) fnTy arg ret
957checkFunctionApplication' _ fnTy arg ret = throwError $ "Applying a function of type "
957checkFunctionApplication' _ fnTy arg ret = throwError $ "Applying a function of type "
958 ++ prettyPrintType fnTy
958 ++ prettyPrintType fnTy
959 ++ " to argument(s) " ++ prettyPrintValue arg
959 ++ " to argument(s) " ++ prettyPrintValue arg
@@ -987,7 +987,7 @@ subsumes' (Just val) (ConstrainedType constraints ty1) ty2 = do
987 dicts <- getTypeClassDictionaries
987 dicts <- getTypeClassDictionaries
988 Just moduleName <- checkCurrentModule <$> get
988 Just moduleName <- checkCurrentModule <$> get
989 _ <- subsumes' Nothing ty1 ty2
989 _ <- subsumes' Nothing ty1 ty2
990− return . Just $ foldr App val (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))
990+ return . Just $ foldl App val (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))
991subsumes' val ty1 ty2 = do
991subsumes' val ty1 ty2 = do
992 ty1 ?= ty2
992 ty1 ?= ty2
993 return val
993 return val