git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'singleargs' of github.com:paf31/purescript into singleargs
commitb2fb5419e108dfb0cbb77f10999fc27bb42926cb authorPhil Freeman <paf31@cantab.net> dateFri 31 Jan 2014, 17:34 (13 years ago) parent36079964017b55
9 files changed+22−21
examples/failing/NullaryAbs.purs+3 examples/passing/Do.purs+6−6 examples/passing/ExternData.purs+1−1 examples/passing/FFI.purs+1−1 examples/passing/Functions.purs+5−7 examples/passing/Rank2Types.purs+1−1 src/Language/PureScript/Parser/Values.hs+1−1 src/Language/PureScript/Sugar/TypeClasses.hs+1−1 src/Language/PureScript/TypeChecker/Types.hs+3−3
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
99 (>>=) Nothing _ = Nothing
1010 (>>=) (Just a) f = f a
1111
12−test1 = \ -> do
12+test1 = \_ -> do
1313 Just "abc"
1414
15−test2 = \ -> do
15+test2 = \_ -> do
1616 (x : _) <- Just [1, 2, 3]
1717 (y : _) <- Just [4, 5, 6]
1818 Just (x + y)
1919
20−test3 = \ -> do
20+test3 = \_ -> do
2121 Just 1
2222 Nothing :: Maybe Number
2323 Just 2
@@ -34,11 +34,11 @@ test5 mx my mz = do
3434 z <- mz
3535 Just (z + sum)
3636
37−test6 mx = \ -> do
37+test6 mx = \_ -> do
3838 let Just x = mx
3939 Just x
4040
41−test8 = \ -> do
41+test8 = \_ -> do
4242 Just (do
4343 Just 1)
4444
@@ -60,7 +60,7 @@ forever a = do
6060 a
6161 forever a
6262
63−test9 = \ -> foo <$> Just 1 <*> Just 2 <*> Just 3
63+test9 = \_ -> foo <$> Just 1 <*> Just 2 <*> Just 3
6464
6565module Main where
6666
examples/passing/ExternData.purs+1−1
@@ -12,7 +12,7 @@ module ExternData where
1212
1313 foreign import prompt :: IO String
1414
15− main = \ -> prompt `bind` \s -> showMessage s
15+ main = \_ -> prompt `bind` \s -> showMessage s
1616
1717module Main where
1818
examples/passing/FFI.purs+1−1
@@ -9,7 +9,7 @@ module FFIModuleTest where
99
1010import FFI
1111
12−baz = \ -> foo "test"
12+baz = \_ -> foo "test"
1313
1414module Main where
1515
examples/passing/Functions.purs+5−7
@@ -1,16 +1,14 @@
11module Functions where
22
3− test1 = \ -> 0
3+ test1 = \_ -> 0
44
5− test2 = \_ -> 0
5+ test2 = \a b c d -> a + b + c + d
66
7− test3 = \a b c d -> a + b + c + d
7+ test3 = \a -> a
88
9− test4 = \a -> a
9+ test4 = \(%%) -> 1 %% 2
1010
11− test5 = \(%%) -> 1 %% 2
12−
13− test6 = \(+++) (***) -> 1 +++ 2 *** 3
11+ test5 = \(+++) (***) -> 1 +++ 2 *** 3
1412
1513module Main where
1614
examples/passing/Rank2Types.purs+1−1
@@ -9,7 +9,7 @@ module Rank2Types where
99
1010 foreign import exampleST :: forall s. ST s Number
1111
12− testST = \ -> runST exampleST
12+ testST = \_ -> runST exampleST
1313
1414 foreign import push :: forall el. el -> [el] -> [el]
1515
src/Language/PureScript/Parser/Values.hs+1−1
@@ -54,7 +54,7 @@ parseIdentifierAndValue = (,) <$> (C.indented *> C.identifier <* C.indented <* C
5454parseAbs :: P.Parsec String ParseState Value
5555parseAbs = do
5656 C.reservedOp "\\"
57− args <- P.many (C.indented *> (Abs <$> C.parseIdent))
57+ args <- P.many1 (C.indented *> (Abs <$> C.parseIdent))
5858 C.indented *> C.reservedOp "->"
5959 value <- parseValue
6060 return $ toFunction args value
src/Language/PureScript/Sugar/TypeClasses.hs+1−1
@@ -97,7 +97,7 @@ typeInstanceDictionaryDeclaration mn deps name ty decls = do
9797 memberName <- mkDictionaryEntryName mn name ty ident
9898 return (identToJs ident, TypedValue False
9999 (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]))
101101 (quantify memberType))
102102 memberToNameAndValue _ _ = error "Invalid declaration in type instance definition"
103103
src/Language/PureScript/TypeChecker/Types.hs+3−3
@@ -453,7 +453,7 @@ infer' (Var var) = do
453453 ConstrainedType constraints _ -> do
454454 env <- getEnv
455455 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'
457457 _ -> return $ TypedValue True (Var var) ty'
458458infer' (Block ss) = do
459459 ret <- fresh
@@ -953,7 +953,7 @@ checkFunctionApplication' fn (ConstrainedType constraints fnTy) arg ret = do
953953 env <- getEnv
954954 dicts <- getTypeClassDictionaries
955955 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
957957checkFunctionApplication' _ fnTy arg ret = throwError $ "Applying a function of type "
958958 ++ prettyPrintType fnTy
959959 ++ " to argument(s) " ++ prettyPrintValue arg
@@ -987,7 +987,7 @@ subsumes' (Just val) (ConstrainedType constraints ty1) ty2 = do
987987 dicts <- getTypeClassDictionaries
988988 Just moduleName <- checkCurrentModule <$> get
989989 _ <- 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))
991991subsumes' val ty1 ty2 = do
992992 ty1 ?= ty2
993993 return val