git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fixed bugs with JS output for typeclass dictionaries
a86e71aGary Burgess
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/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/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
@@ -452,7 +452,7 @@ infer' (Var var) = do
452 ConstrainedType constraints _ -> do
452 ConstrainedType constraints _ -> do
453 env <- getEnv
453 env <- getEnv
454 dicts <- getTypeClassDictionaries
454 dicts <- getTypeClassDictionaries
455− return $ TypedValue True (foldr App (Var var) (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) ty'
455+ return $ TypedValue True (foldl App (Var var) (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) ty'
456 _ -> return $ TypedValue True (Var var) ty'
456 _ -> return $ TypedValue True (Var var) ty'
457infer' (Block ss) = do
457infer' (Block ss) = do
458 ret <- fresh
458 ret <- fresh
@@ -952,7 +952,7 @@ checkFunctionApplication' fn (ConstrainedType constraints fnTy) arg ret = do
952 env <- getEnv
952 env <- getEnv
953 dicts <- getTypeClassDictionaries
953 dicts <- getTypeClassDictionaries
954 Just moduleName <- checkCurrentModule <$> get
954 Just moduleName <- checkCurrentModule <$> get
955− checkFunctionApplication' (foldr App fn (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) fnTy arg ret
955+ checkFunctionApplication' (foldl App fn (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))) fnTy arg ret
956checkFunctionApplication' _ fnTy arg ret = throwError $ "Applying a function of type "
956checkFunctionApplication' _ fnTy arg ret = throwError $ "Applying a function of type "
957 ++ prettyPrintType fnTy
957 ++ prettyPrintType fnTy
958 ++ " to argument(s) " ++ prettyPrintValue arg
958 ++ " to argument(s) " ++ prettyPrintValue arg
@@ -986,7 +986,7 @@ subsumes' (Just val) (ConstrainedType constraints ty1) ty2 = do
986 dicts <- getTypeClassDictionaries
986 dicts <- getTypeClassDictionaries
987 Just moduleName <- checkCurrentModule <$> get
987 Just moduleName <- checkCurrentModule <$> get
988 _ <- subsumes' Nothing ty1 ty2
988 _ <- subsumes' Nothing ty1 ty2
989− return . Just $ foldr App val (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))
989+ return . Just $ foldl App val (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))
990subsumes' val ty1 ty2 = do
990subsumes' val ty1 ty2 = do
991 ty1 ?= ty2
991 ty1 ?= ty2
992 return val
992 return val