git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update tests for `return`
67fb0b2Gary Burgess
examples/failing/Do.purs+2−2
@@ -4,5 +4,5 @@ test1 = do let x = 1
4
4
5test2 y = do x <- y
5test2 y = do x <- y
6
6
7−test3 = do ret 1
7+test3 = do return 1
8− ret 2
8+ return 2
examples/failing/SkolemEscape2.purs+1−1
@@ -6,4 +6,4 @@ import ST
6
6
7test _ = do
7test _ = do
8 r <- runST (newSTRef 0)
8 r <- runST (newSTRef 0)
9− ret 0
9+ return 0
examples/passing/Console.purs+1−1
@@ -5,7 +5,7 @@ import Eff
5import Trace
5import Trace
6
6
7replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
7replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
8−replicateM_ 0 _ = ret {}
8+replicateM_ 0 _ = return {}
9replicateM_ n act = do
9replicateM_ n act = do
10 act
10 act
11 replicateM_ (n - 1) act
11 replicateM_ (n - 1) act
examples/passing/Do.purs+1−1
@@ -5,7 +5,7 @@ import Prelude
5data Maybe a = Nothing | Just a
5data Maybe a = Nothing | Just a
6
6
7instance Prelude.Monad Maybe where
7instance Prelude.Monad Maybe where
8− ret = Just
8+ return = Just
9 (>>=) Nothing _ = Nothing
9 (>>=) Nothing _ = Nothing
10 (>>=) (Just a) f = f a
10 (>>=) (Just a) f = f a
11
11
examples/passing/Eff.purs+1−1
@@ -6,7 +6,7 @@ import ST
6import Errors
6import Errors
7import Trace
7import Trace
8
8
9−test1 = catchError (\s -> ret 0) $ do
9+test1 = catchError (\s -> return 0) $ do
10 trace "Testing"
10 trace "Testing"
11 throwError "Error!"
11 throwError "Error!"
12
12
examples/passing/ExternData.purs+1−1
@@ -4,7 +4,7 @@ module ExternData where
4
4
5 foreign import fmap :: forall a b. IO a -> (a -> b) -> IO b
5 foreign import fmap :: forall a b. IO a -> (a -> b) -> IO b
6
6
7− foreign import ret :: forall a. a -> IO a
7+ foreign import return :: forall a. a -> IO a
8
8
9 foreign import bind :: forall a b. IO a -> (a -> IO b) -> IO b
9 foreign import bind :: forall a b. IO a -> (a -> IO b) -> IO b
10
10
examples/passing/JSReserved.purs+4−4
@@ -2,15 +2,15 @@ module Main where
2
2
3 import Prelude
3 import Prelude
4
4
5− const = "test"
5+ yield = "test"
6 member = "test"
6 member = "test"
7
7
8 fortest = {
8 fortest = {
9− var return = 0;
9+ var function = 0;
10 for (i <- 0 until 10) {
10 for (i <- 0 until 10) {
11− return = return + i;
11+ function = function + i;
12 }
12 }
13− return return;
13+ return function;
14 }
14 }
15
15
16 whiletest = {
16 whiletest = {
examples/passing/Maybe.purs+1−1
@@ -8,5 +8,5 @@ main = do
8 let test1 = fromMaybe 0 $ do
8 let test1 = fromMaybe 0 $ do
9 a <- Just 1
9 a <- Just 1
10 b <- Just 2
10 b <- Just 2
11− ret (a + b)
11+ return (a + b)
12 Trace.print test1
12 Trace.print test1
examples/passing/Monad.purs+6−6
@@ -1,27 +1,27 @@
1module MonadTest where
1module MonadTest where
2
2
3− type Monad m = { ret :: forall a. a -> m a
3+ type Monad m = { return :: forall a. a -> m a
4 , bind :: forall a b. m a -> (a -> m b) -> m b }
4 , bind :: forall a b. m a -> (a -> m b) -> m b }
5
5
6 data Id a = Id a
6 data Id a = Id a
7
7
8 id :: Monad Id
8 id :: Monad Id
9− id = { ret : Id
9+ id = { return : Id
10 , bind : \ma f -> case ma of Id a -> f a }
10 , bind : \ma f -> case ma of Id a -> f a }
11
11
12 data Maybe a = Nothing | Just a
12 data Maybe a = Nothing | Just a
13
13
14 maybe :: Monad Maybe
14 maybe :: Monad Maybe
15− maybe = { ret : Just
15+ maybe = { return : Just
16 , bind : \ma f -> case ma of
16 , bind : \ma f -> case ma of
17 Nothing -> Nothing
17 Nothing -> Nothing
18 Just a -> f a
18 Just a -> f a
19 }
19 }
20
20
21 test :: forall m. Monad m -> m Number
21 test :: forall m. Monad m -> m Number
22− test = \m -> m.bind (m.ret 1) (\n1 ->
22+ test = \m -> m.bind (m.return 1) (\n1 ->
23− m.bind (m.ret "Test") (\n2 ->
23+ m.bind (m.return "Test") (\n2 ->
24− m.ret n1))
24+ m.return n1))
25
25
26 test1 = test id
26 test1 = test id
27
27
examples/passing/Rank2Types.purs+3−3
@@ -16,9 +16,9 @@ module Rank2Types where
16 foreign import push :: forall el. el -> [el] -> [el]
16 foreign import push :: forall el. el -> [el] -> [el]
17
17
18 replicateM :: forall m a. (forall a. a -> m a) -> (forall a b. m a -> (a -> m b) -> m b) -> Number -> m a -> m [a]
18 replicateM :: forall m a. (forall a. a -> m a) -> (forall a b. m a -> (a -> m b) -> m b) -> Number -> m a -> m [a]
19− replicateM = \ret bind n m -> case n of
19+ replicateM = \return bind n m -> case n of
20− 0 -> ret []
20+ 0 -> return []
21− n -> bind m (\x -> bind (replicateM ret bind (n - 1) m) (\xs -> ret (push x xs)))
21+ n -> bind m (\x -> bind (replicateM return bind (n - 1) m) (\xs -> return (push x xs)))
22
22
23module Main where
23module Main where
24
24
examples/passing/TypeClasses.purs+6−6
@@ -22,20 +22,20 @@ instance (Prelude.Show a) => Prelude.Show (Data a) where
22test3 = \_ -> show (Data "testing")
22test3 = \_ -> show (Data "testing")
23
23
24instance Prelude.Monad Data where
24instance Prelude.Monad Data where
25− ret = Data
25+ return = Data
26 (>>=) (Data a) f = f a
26 (>>=) (Data a) f = f a
27
27
28data Maybe a = Nothing | Just a
28data Maybe a = Nothing | Just a
29
29
30instance Prelude.Monad Maybe where
30instance Prelude.Monad Maybe where
31− ret = Just
31+ return = Just
32 (>>=) Nothing _ = Nothing
32 (>>=) Nothing _ = Nothing
33 (>>=) (Just a) f = f a
33 (>>=) (Just a) f = f a
34
34
35test4 :: forall a m. (Monad m) => a -> m Number
35test4 :: forall a m. (Monad m) => a -> m Number
36−test4 = \_ -> ret 1
36+test4 = \_ -> return 1
37
37
38−test5 = \_ -> Just 1 >>= \n -> ret (n + 1)
38+test5 = \_ -> Just 1 >>= \n -> return (n + 1)
39
39
40module TypeClasses2 where
40module TypeClasses2 where
41
41
@@ -49,7 +49,7 @@ instance (Prelude.Show a) => Prelude.Show [a] where
49test6 = \_ -> show ["testing"]
49test6 = \_ -> show ["testing"]
50
50
51instance Prelude.Monad (->) r where
51instance Prelude.Monad (->) r where
52− ret a r = a
52+ return a r = a
53 (>>=) f g r = g (f r) r
53 (>>=) f g r = g (f r) r
54
54
55ask r = r
55ask r = r
@@ -58,7 +58,7 @@ runReader r f = f r
58
58
59test9 _ = runReader 0 $ do
59test9 _ = runReader 0 $ do
60 n <- ask
60 n <- ask
61− ret $ n + 1
61+ return $ n + 1
62
62
63module Main where
63module Main where
64
64