git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Tests
fff79d5Phil Freeman
examples/passing/Arrays.purs+5−5
@@ -2,23 +2,23 @@ module Main where
2
2
3import Prelude.Unsafe (unsafeIndex)
3import Prelude.Unsafe (unsafeIndex)
4
4
5−test1 arr = arr `unsafeIndex` 0 + arr `unsafeIndex` 1 + 1
5+test1 arr = arr `unsafeIndex` 0.0 + arr `unsafeIndex` 1.0 + 1.0
6
6
7test2 = \arr -> case arr of
7test2 = \arr -> case arr of
8 [x, y] -> x + y
8 [x, y] -> x + y
9 [x] -> x
9 [x] -> x
10− [] -> 0
10+ [] -> 0.0
11 (x : y : _) -> x + y
11 (x : y : _) -> x + y
12
12
13data Tree = One Number | Some [Tree]
13data Tree = One Number | Some [Tree]
14
14
15test3 = \tree sum -> case tree of
15test3 = \tree sum -> case tree of
16 One n -> n
16 One n -> n
17− Some (n1 : n2 : rest) -> test3 n1 sum * 10 + test3 n2 sum * 5 + sum rest
17+ Some (n1 : n2 : rest) -> test3 n1 sum * 10.0 + test3 n2 sum * 5.0 + sum rest
18
18
19test4 = \arr -> case arr of
19test4 = \arr -> case arr of
20− [] -> 0
20+ [] -> 0.0
21− [_] -> 0
21+ [_] -> 0.0
22 x : y : xs -> x * y + test4 xs
22 x : y : xs -> x * y + test4 xs
23
23
24main = Debug.Trace.trace "Done"
24main = Debug.Trace.trace "Done"
examples/passing/AutoPrelude.purs+3−3
@@ -2,7 +2,7 @@ module Main where
2
2
3import Debug.Trace
3import Debug.Trace
4
4
5−f x = x * 10
5+f x = x * 10.0
6−g y = y - 10
6+g y = y - 10.0
7
7
8−main = trace $ show $ (f <<< g) 100
8+main = trace $ show $ (f <<< g) 100.0
examples/passing/BindersInFunctions.purs+2−2
@@ -12,7 +12,7 @@ foreign import error
12 """ :: forall a. String -> a
12 """ :: forall a. String -> a
13
13
14main =
14main =
15− let ts = tail [1, 2, 3] in
15+ let ts = tail [1.0, 2.0, 3.0] in
16− if ts == [2, 3]
16+ if ts == [2.0, 3.0]
17 then Debug.Trace.trace "Done"
17 then Debug.Trace.trace "Done"
18 else error "Incorrect result from 'tails'."
18 else error "Incorrect result from 'tails'."
examples/passing/BindingGroups.purs+2−2
@@ -1,8 +1,8 @@
1module Main where
1module Main where
2
2
3foo = bar
3foo = bar
4− where bar r = r + 1
4+ where bar r = r + 1.0
5
5
6−r = foo 2
6+r = foo 2.0
7
7
8main = Debug.Trace.trace "Done"
8main = Debug.Trace.trace "Done"
examples/passing/CheckFunction.purs+1−1
@@ -1,5 +1,5 @@
1module Main where
1module Main where
2
2
3−test = ((\x -> x+1) >>> (\x -> x*2)) 4
3+test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
4
4
5main = Debug.Trace.trace "Done"
5main = Debug.Trace.trace "Done"
examples/passing/Collatz.purs+5−5
@@ -18,12 +18,12 @@ infixl 7 %
18collatz :: Number -> Number
18collatz :: Number -> Number
19collatz n = runPure (runST (do
19collatz n = runPure (runST (do
20 r <- newSTRef n
20 r <- newSTRef n
21− count <- newSTRef 0
21+ count <- newSTRef 0.0
22 untilE $ do
22 untilE $ do
23− modifySTRef count $ (+) 1
23+ modifySTRef count $ (+) 1.0
24 m <- readSTRef r
24 m <- readSTRef r
25− writeSTRef r $ if m % 2 == 0 then m / 2 else 3 * m + 1
25+ writeSTRef r $ if m % 2.0 == 0.0 then m / 2.0 else 3.0 * m + 1.0
26− return $ m == 1
26+ return $ m == 1.0
27 readSTRef count))
27 readSTRef count))
28
28
29−main = Debug.Trace.print $ collatz 1000
29+main = Debug.Trace.print $ collatz 1000.0
examples/passing/Comparisons.purs+3−3
@@ -16,9 +16,9 @@ foreign import assert
16 """ :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
16 """ :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
17
17
18main = do
18main = do
19− assert (1 < 2)
19+ assert (1.0 < 2.0)
20− assert (2 == 2)
20+ assert (2.0 == 2.0)
21− assert (3 > 1)
21+ assert (3.0 > 1.0)
22 assert ("a" < "b")
22 assert ("a" < "b")
23 assert ("a" == "a")
23 assert ("a" == "a")
24 assert ("z" > "a")
24 assert ("z" > "a")
examples/passing/Console.purs+3−3
@@ -5,9 +5,9 @@ import Control.Monad.Eff
5import Debug.Trace
5import Debug.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 _ = return {}
8+replicateM_ 0.0 _ = return {}
9replicateM_ n act = do
9replicateM_ n act = do
10 act
10 act
11− replicateM_ (n - 1) act
11+ replicateM_ (n - 1.0) act
12
12
13−main = replicateM_ 10 (trace "Hello World!")
13+main = replicateM_ 10.0 (trace "Hello World!")
examples/passing/DeepArrayBinder.purs+3−3
@@ -4,7 +4,7 @@ import Control.Monad.Eff
4
4
5match2 :: [Number] -> Number
5match2 :: [Number] -> Number
6match2 (x : y : xs) = x * y + match2 xs
6match2 (x : y : xs) = x * y + match2 xs
7−match2 _ = 0
7+match2 _ = 0.0
8
8
9foreign import explode
9foreign import explode
10 """
10 """
@@ -13,6 +13,6 @@ foreign import explode
13 }
13 }
14 """ :: forall eff a. Eff eff a
14 """ :: forall eff a. Eff eff a
15
15
16−main = case match2 [1, 2, 3, 4, 5, 6, 7, 8, 9] of
16+main = case match2 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] of
17− 100 -> Debug.Trace.trace "Done"
17+ 100.0 -> Debug.Trace.trace "Done"
18 _ -> explode
18 _ -> explode
examples/passing/DeepCase.purs+3−3
@@ -7,8 +7,8 @@ import Control.Monad.ST
7f x y =
7f x y =
8 let
8 let
9 g = case y of
9 g = case y of
10− 0 -> x
10+ 0.0 -> x
11− x -> 1 + x * x
11+ x -> 1.0 + x * x
12 in g + x + y
12 in g + x + y
13
13
14−main = print $ f 1 10
14+main = print $ f 1.0 10.0
examples/passing/Do.purs+11−11
@@ -25,26 +25,26 @@ test1 = \_ -> do
25 Just "abc"
25 Just "abc"
26
26
27test2 = \_ -> do
27test2 = \_ -> do
28− (x : _) <- Just [1, 2, 3]
28+ (x : _) <- Just [1.0, 2.0, 3.0]
29− (y : _) <- Just [4, 5, 6]
29+ (y : _) <- Just [4.0, 5.0, 6.0]
30 Just (x + y)
30 Just (x + y)
31
31
32test3 = \_ -> do
32test3 = \_ -> do
33− Just 1
33+ Just 1.0
34 Nothing :: Maybe Number
34 Nothing :: Maybe Number
35− Just 2
35+ Just 2.0
36
36
37test4 mx my = do
37test4 mx my = do
38 x <- mx
38 x <- mx
39 y <- my
39 y <- my
40− Just (x + y + 1)
40+ Just (x + y + 1.0)
41
41
42test5 mx my mz = do
42test5 mx my mz = do
43 x <- mx
43 x <- mx
44 y <- my
44 y <- my
45 let sum = x + y
45 let sum = x + y
46 z <- mz
46 z <- mz
47− Just (z + sum + 1)
47+ Just (z + sum + 1.0)
48
48
49test6 mx = \_ -> do
49test6 mx = \_ -> do
50 let
50 let
@@ -54,14 +54,14 @@ test6 mx = \_ -> do
54
54
55test8 = \_ -> do
55test8 = \_ -> do
56 Just (do
56 Just (do
57− Just 1)
57+ Just 1.0)
58
58
59−test9 = \_ -> (+) <$> Just 1 <*> Just 2
59+test9 = \_ -> (+) <$> Just 1.0 <*> Just 2.0
60
60
61test10 _ = do
61test10 _ = do
62 let
62 let
63− f x = g x * 3
63+ f x = g x * 3.0
64− g x = f x / 2
64+ g x = f x / 2.0
65− Just (f 10)
65+ Just (f 10.0)
66
66
67main = Debug.Trace.trace "Done"
67main = Debug.Trace.trace "Done"
examples/passing/Eff.purs+4−4
@@ -10,13 +10,13 @@ test1 = do
10 trace "Line 2"
10 trace "Line 2"
11
11
12test2 = runPure (runST (do
12test2 = runPure (runST (do
13− ref <- newSTRef 0
13+ ref <- newSTRef 0.0
14− modifySTRef ref $ \n -> n + 1
14+ modifySTRef ref $ \n -> n + 1.0
15 readSTRef ref))
15 readSTRef ref))
16
16
17test3 = pureST (do
17test3 = pureST (do
18− ref <- newSTRef 0
18+ ref <- newSTRef 0.0
19− modifySTRef ref $ \n -> n + 1
19+ modifySTRef ref $ \n -> n + 1.0
20 readSTRef ref)
20 readSTRef ref)
21
21
22main = do
22main = do
examples/passing/EqOrd.purs+1−1
@@ -11,4 +11,4 @@ instance eqPair :: (Eq a, Eq b) => Eq (Pair a b) where
11 (==) (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2
11 (==) (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2
12 (/=) (Pair a1 b1) (Pair a2 b2) = a1 /= a2 || b1 /= b2
12 (/=) (Pair a1 b1) (Pair a2 b2) = a1 /= a2 || b1 /= b2
13
13
14−main = Debug.Trace.print $ Pair 1 2 == Pair 1 2
14+main = Debug.Trace.print $ Pair 1.0 2.0 == Pair 1.0 2.0
examples/passing/ExtendedInfixOperators.purs+3−3
@@ -5,15 +5,15 @@ zipWith _ [] _ = []
5zipWith _ _ [] = []
5zipWith _ _ [] = []
6zipWith f (x:xs) (y:ys) = f x y : zipWith f xs ys
6zipWith f (x:xs) (y:ys) = f x y : zipWith f xs ys
7
7
8−test1 = [1, 2, 3] `zipWith (+)` [4, 5, 6]
8+test1 = [1.0, 2.0, 3.0] `zipWith (+)` [4.0, 5.0, 6.0]
9
9
10comparing :: forall a b. (Ord b) => (a -> b) -> a -> a -> Ordering
10comparing :: forall a b. (Ord b) => (a -> b) -> a -> a -> Ordering
11comparing f = compare `Data.Function.on` f
11comparing f = compare `Data.Function.on` f
12
12
13−sum [] = 0
13+sum [] = 0.0
14sum (x:xs) = x + sum xs
14sum (x:xs) = x + sum xs
15
15
16−test2 = [1, 2, 3] `comparing sum` [4, 5, 6]
16+test2 = [1.0, 2.0, 3.0] `comparing sum` [4.0, 5.0, 6.0]
17
17
18main = do
18main = do
19 Debug.Trace.print test1
19 Debug.Trace.print test1
examples/passing/Fib.purs+3−3
@@ -5,9 +5,9 @@ import Control.Monad.Eff
5import Control.Monad.ST
5import Control.Monad.ST
6
6
7main = runST (do
7main = runST (do
8− n1 <- newSTRef 1
8+ n1 <- newSTRef 1.0
9− n2 <- newSTRef 1
9+ n2 <- newSTRef 1.0
10− whileE ((>) 1000 <$> readSTRef n1) $ do
10+ whileE ((>) 1000.0 <$> readSTRef n1) $ do
11 n1' <- readSTRef n1
11 n1' <- readSTRef n1
12 n2' <- readSTRef n2
12 n2' <- readSTRef n2
13 writeSTRef n2 $ n1' + n2'
13 writeSTRef n2 $ n1' + n2'
examples/passing/FinalTagless.purs+1−1
@@ -17,6 +17,6 @@ instance exprId :: E Id where
17runId (Id a) = a
17runId (Id a) = a
18
18
19three :: Expr Number
19three :: Expr Number
20−three = add (num 1) (num 2)
20+three = add (num 1.0) (num 2.0)
21
21
22main = Debug.Trace.print $ runId three
22main = Debug.Trace.print $ runId three
examples/passing/ForeignInstance.purs+1−1
@@ -13,7 +13,7 @@ foreign import fooString "var fooString = {};" :: Unit
13foreign import fooNumber "var fooNumber = {};" :: Unit
13foreign import fooNumber "var fooNumber = {};" :: Unit
14foreign import fooArray "var fooArray = {};" :: Unit
14foreign import fooArray "var fooArray = {};" :: Unit
15
15
16−test1 _ = foo [1, 2, 3]
16+test1 _ = foo [1.0, 2.0, 3.0]
17
17
18test2 _ = foo "Test"
18test2 _ = foo "Test"
19
19
examples/passing/FunctionScope.purs+2−2
@@ -13,7 +13,7 @@ module Main where
13 """ :: forall a. String -> a
13 """ :: forall a. String -> a
14
14
15 main = do
15 main = do
16− let value = mkValue 1
16+ let value = mkValue 1.0
17− if value == 1
17+ if value == 1.0
18 then Debug.Trace.trace "Done"
18 then Debug.Trace.trace "Done"
19 else error "Not done"
19 else error "Not done"
examples/passing/Functions.purs+4−4
@@ -2,14 +2,14 @@ module Main where
2
2
3 import Prelude
3 import Prelude
4
4
5− test1 = \_ -> 0
5+ test1 = \_ -> 0.0
6
6
7− test2 = \a b -> a + b + 1
7+ test2 = \a b -> a + b + 1.0
8
8
9 test3 = \a -> a
9 test3 = \a -> a
10
10
11− test4 = \(%%) -> 1 %% 2
11+ test4 = \(%%) -> 1.0 %% 2.0
12
12
13− test5 = \(+++) (***) -> 1 +++ 2 *** 3
13+ test5 = \(+++) (***) -> 1.0 +++ 2.0 *** 3.0
14
14
15 main = Debug.Trace.trace "Done"
15 main = Debug.Trace.trace "Done"
examples/passing/Guards.purs+5−5
@@ -13,13 +13,13 @@ infixl 7 %
13(%) = jsMod
13(%) = jsMod
14
14
15collatz = \x -> case x of
15collatz = \x -> case x of
16− y | y % 2 == 0 -> y / 2
16+ y | y % 2.0 == 0.0 -> y / 2.0
17− y -> y * 3 + 1
17+ y -> y * 3.0 + 1.0
18
18
19-- Guards have access to current scope
19-- Guards have access to current scope
20collatz2 = \x y -> case x of
20collatz2 = \x y -> case x of
21− z | y > 0 -> z / 2
21+ z | y > 0.0 -> z / 2.0
22− z -> z * 3 + 1
22+ z -> z * 3.0 + 1.0
23
23
24min :: forall a. (Ord a) => a -> a -> a
24min :: forall a. (Ord a) => a -> a -> a
25min n m | n < m = n
25min n m | n < m = n
@@ -31,7 +31,7 @@ max n m = case unit of
31 | otherwise -> m
31 | otherwise -> m
32
32
33testIndentation :: Number -> Number -> Number
33testIndentation :: Number -> Number -> Number
34−testIndentation x y | x > 0
34+testIndentation x y | x > 0.0
35 = x + y
35 = x + y
36 | otherwise
36 | otherwise
37 = y - x
37 = y - x
examples/passing/HoistError.purs+2−2
@@ -13,7 +13,7 @@ foreign import f
13 """ :: forall e. Number -> Eff e Number
13 """ :: forall e. Number -> Eff e Number
14
14
15main = do
15main = do
16− let x = 0
16+ let x = 0.0
17 f x
17 f x
18− let x = 1 + 1
18+ let x = 1.0 + 1.0
19 trace "Done"
19 trace "Done"
examples/passing/ImportHiding.purs+1−1
@@ -7,7 +7,7 @@ import Prelude hiding (
7 Unit(..) -- a constructor
7 Unit(..) -- a constructor
8 )
8 )
9
9
10−show = 1
10+show = 1.0
11
11
12class Show a where
12class Show a where
13 noshow :: a -> a
13 noshow :: a -> a
examples/passing/InferRecFunWithConstrainedArgument.purs+3−3
@@ -2,7 +2,7 @@ module Main where
2
2
3import Prelude
3import Prelude
4
4
5−test 100 = 100
5+test 100.0 = 100.0
6−test n = test(1 + n)
6+test n = test(1.0 + n)
7
7
8−main = Debug.Trace.print $ test 0
8+main = Debug.Trace.print $ test 0.0
examples/passing/InstanceBeforeClass.purs+1−1
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3instance fooNumber :: Foo Number where
3instance fooNumber :: Foo Number where
4− foo = 0
4+ foo = 0.0
5
5
6class Foo a where
6class Foo a where
7 foo :: a
7 foo :: a
examples/passing/IntAndChar.pursnew file+25
@@ -0,0 +1,25 @@
1+module Main where
2+
3+import Control.Monad.Eff
4+
5+f 1 = 1
6+f _ = 0
7+
8+g 'a' = 'a'
9+g _ = 'b'
10+
11+foreign import assertEqual
12+ """
13+ function assertEqual(a) { return function(b) { return function() {
14+ if (a != b) {
15+ throw new Error('Assertion failed!');
16+ }
17+ }; }; }
18+ """ :: forall eff a. a -> a -> Eff eff Unit
19+
20+main = do
21+ assertEqual (f 1) 1
22+ assertEqual (f 0) 0
23+ assertEqual (g 'a') 'a'
24+ assertEqual (g 'b') 'b'
25+ Debug.Trace.trace "Done"
examples/passing/Let.purs+19−19
@@ -6,59 +6,59 @@ import Control.Monad.ST
6
6
7test1 x = let
7test1 x = let
8 y :: Number
8 y :: Number
9− y = x + 1
9+ y = x + 1.0
10 in y
10 in y
11
11
12test2 x y =
12test2 x y =
13− let x' = x + 1 in
13+ let x' = x + 1.0 in
14− let y' = y + 1 in
14+ let y' = y + 1.0 in
15 x' + y'
15 x' + y'
16
16
17test3 = let f x y z = x + y + z in
17test3 = let f x y z = x + y + z in
18− f 1 2 3
18+ f 1.0 2.0 3.0
19
19
20test4 = let f x [y, z] = x y z in
20test4 = let f x [y, z] = x y z in
21− f (+) [1, 2]
21+ f (+) [1.0, 2.0]
22
22
23test5 = let
23test5 = let
24− f x | x > 0 = g (x / 2) + 1
24+ f x | x > 0.0 = g (x / 2.0) + 1.0
25− f x = 0
25+ f x = 0.0
26− g x = f (x - 1) + 1
26+ g x = f (x - 1.0) + 1.0
27− in f 10
27+ in f 10.0
28
28
29test6 = runPure (runST (do
29test6 = runPure (runST (do
30− r <- newSTRef 0
30+ r <- newSTRef 0.0
31 (let
31 (let
32 go [] = readSTRef r
32 go [] = readSTRef r
33 go (n : ns) = do
33 go (n : ns) = do
34 modifySTRef r ((+) n)
34 modifySTRef r ((+) n)
35 go ns
35 go ns
36− in go [1, 2, 3, 4, 5])
36+ in go [1.0, 2.0, 3.0, 4.0, 5.0])
37 ))
37 ))
38
38
39test7 = let
39test7 = let
40 f :: forall a. a -> a
40 f :: forall a. a -> a
41 f x = x
41 f x = x
42− in if f true then f 1 else f 2
42+ in if f true then f 1.0 else f 2.0
43
43
44test8 :: Number -> Number
44test8 :: Number -> Number
45test8 x = let
45test8 x = let
46 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
46 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
47− go y = go $ (y + x / y) / 2
47+ go y = go $ (y + x / y) / 2.0
48 in go x
48 in go x
49
49
50test10 _ =
50test10 _ =
51 let
51 let
52− f x = g x * 3
52+ f x = g x * 3.0
53− g x = f x / 2
53+ g x = f x / 2.0
54− in f 10
54+ in f 10.0
55
55
56main = do
56main = do
57− Debug.Trace.print (test1 1)
57+ Debug.Trace.print (test1 1.0)
58− Debug.Trace.print (test2 1 2)
58+ Debug.Trace.print (test2 1.0 2.0)
59 Debug.Trace.print test3
59 Debug.Trace.print test3
60 Debug.Trace.print test4
60 Debug.Trace.print test4
61 Debug.Trace.print test5
61 Debug.Trace.print test5
62 Debug.Trace.print test6
62 Debug.Trace.print test6
63 Debug.Trace.print test7
63 Debug.Trace.print test7
64− Debug.Trace.print (test8 100)
64+ Debug.Trace.print (test8 100.0)
examples/passing/Let2.purs+5−5
@@ -2,14 +2,14 @@ module Main where
2
2
3test =
3test =
4 let f :: Number -> Boolean
4 let f :: Number -> Boolean
5− f 0 = false
5+ f 0.0 = false
6− f n = g (n - 1)
6+ f n = g (n - 1.0)
7
7
8 g :: Number -> Boolean
8 g :: Number -> Boolean
9− g 0 = true
9+ g 0.0 = true
10− g n = f (n - 1)
10+ g n = f (n - 1.0)
11
11
12− x = f 1
12+ x = f 1.0
13 in not x
13 in not x
14
14
15main = Debug.Trace.print test
15main = Debug.Trace.print test
examples/passing/Monad.purs+1−1
@@ -21,7 +21,7 @@ module Main where
21 }
21 }
22
22
23 test :: forall m. Monad m -> m Number
23 test :: forall m. Monad m -> m Number
24− test = \m -> m.bind (m.return 1) (\n1 ->
24+ test = \m -> m.bind (m.return 1.0) (\n1 ->
25 m.bind (m.return "Test") (\n2 ->
25 m.bind (m.return "Test") (\n2 ->
26 m.return n1))
26 m.return n1))
27
27
examples/passing/MultiArgFunctions.purs+14−14
@@ -7,20 +7,20 @@ import Debug.Trace
7f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a
7f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a
8
8
9g = mkFn2 $ \a b -> case {} of
9g = mkFn2 $ \a b -> case {} of
10− _ | a <= 0 || b <= 0 -> b
10+ _ | a <= 0.0 || b <= 0.0 -> b
11− _ -> runFn2 f (a - 1) (b - 1)
11+ _ -> runFn2 f (a - 0.0) (b - 0.0)
12
12
13main = do
13main = do
14− runFn0 (mkFn0 $ \_ -> trace $ show 0)
14+ runFn0 (mkFn0 $ \_ -> trace $ show 0.0)
15− runFn1 (mkFn1 $ \a -> trace $ show a) 1
15+ runFn1 (mkFn1 $ \a -> trace $ show a) 0.0
16− runFn2 (mkFn2 $ \a b -> trace $ show [a, b]) 1 2
16+ runFn2 (mkFn2 $ \a b -> trace $ show [a, b]) 0.0 0.0
17− runFn3 (mkFn3 $ \a b c -> trace $ show [a, b, c]) 1 2 3
17+ runFn3 (mkFn3 $ \a b c -> trace $ show [a, b, c]) 0.0 0.0 0.0
18− runFn4 (mkFn4 $ \a b c d -> trace $ show [a, b, c, d]) 1 2 3 4
18+ runFn4 (mkFn4 $ \a b c d -> trace $ show [a, b, c, d]) 0.0 0.0 0.0 0.0
19− runFn5 (mkFn5 $ \a b c d e -> trace $ show [a, b, c, d, e]) 1 2 3 4 5
19+ runFn5 (mkFn5 $ \a b c d e -> trace $ show [a, b, c, d, e]) 0.0 0.0 0.0 0.0 0.0
20− runFn6 (mkFn6 $ \a b c d e f -> trace $ show [a, b, c, d, e, f]) 1 2 3 4 5 6
20+ runFn6 (mkFn6 $ \a b c d e f -> trace $ show [a, b, c, d, e, f]) 0.0 0.0 0.0 0.0 0.0 0.0
21− runFn7 (mkFn7 $ \a b c d e f g -> trace $ show [a, b, c, d, e, f, g]) 1 2 3 4 5 6 7
21+ runFn7 (mkFn7 $ \a b c d e f g -> trace $ show [a, b, c, d, e, f, g]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0
22− runFn8 (mkFn8 $ \a b c d e f g h -> trace $ show [a, b, c, d, e, f, g, h]) 1 2 3 4 5 6 7 8
22+ runFn8 (mkFn8 $ \a b c d e f g h -> trace $ show [a, b, c, d, e, f, g, h]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
23− runFn9 (mkFn9 $ \a b c d e f g h i -> trace $ show [a, b, c, d, e, f, g, h, i]) 1 2 3 4 5 6 7 8 9
23+ runFn9 (mkFn9 $ \a b c d e f g h i -> trace $ show [a, b, c, d, e, f, g, h, i]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
24− runFn10 (mkFn10 $ \a b c d e f g h i j-> trace $ show [a, b, c, d, e, f, g, h, i, j]) 1 2 3 4 5 6 7 8 9 10
24+ runFn10 (mkFn10 $ \a b c d e f g h i j-> trace $ show [a, b, c, d, e, f, g, h, i, j]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
25− print $ runFn2 g 15 12
25+ print $ runFn2 g 0.0 0.0
26 trace "Done!"
26 trace "Done!"
examples/passing/MultipleConstructorArgs.purs+3−3
@@ -12,10 +12,10 @@ idP = runP P
12
12
13testCase = \p -> case p of
13testCase = \p -> case p of
14 P (x:xs) (y:ys) -> x + y
14 P (x:xs) (y:ys) -> x + y
15− P _ _ -> 0
15+ P _ _ -> 0.0
16
16
17−test1 = testCase (P [1, 2, 3] [4, 5, 6])
17+test1 = testCase (P [0.0, 0.0, 0.0] [0.0, 0.0, 0.0])
18
18
19main = do
19main = do
20− Debug.Trace.trace (runP (\s n -> s ++ show n) (P "Test" 1))
20+ Debug.Trace.trace (runP (\s n -> s ++ show n) (P "Test" 0.0))
21 Debug.Trace.print test1
21 Debug.Trace.print test1
examples/passing/MutRec.purs+6−6
@@ -2,18 +2,18 @@ module Main where
2
2
3 import Prelude
3 import Prelude
4
4
5− f 0 = 0
5+ f 0.0 = 0.0
6− f x = g x + 1
6+ f x = g x + 0.0
7
7
8− g x = f (x / 2)
8+ g x = f (x / 0.0)
9
9
10 data Even = Zero | Even Odd
10 data Even = Zero | Even Odd
11
11
12 data Odd = Odd Even
12 data Odd = Odd Even
13
13
14− evenToNumber Zero = 0
14+ evenToNumber Zero = 0.0
15− evenToNumber (Even n) = oddToNumber n + 1
15+ evenToNumber (Even n) = oddToNumber n + 0.0
16
16
17− oddToNumber (Odd n) = evenToNumber n + 1
17+ oddToNumber (Odd n) = evenToNumber n + 0.0
18
18
19 main = Debug.Trace.trace "Done"
19 main = Debug.Trace.trace "Done"
examples/passing/NegativeBinder.purs+1−1
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3test :: Number -> Boolean
3test :: Number -> Boolean
4−test -1 = false
4+test -1.0 = false
5test _ = true
5test _ = true
6
6
7main = Debug.Trace.trace "Done"
7main = Debug.Trace.trace "Done"
examples/passing/NestedWhere.purs+1−1
@@ -4,7 +4,7 @@ f x = g x
4 where
4 where
5 g x = go x
5 g x = go x
6 where
6 where
7− go x = go1 (x - 1)
7+ go x = go1 (x - 1.0)
8 go1 x = go x
8 go1 x = go x
9
9
10main = Debug.Trace.trace "Done"
10main = Debug.Trace.trace "Done"
examples/passing/Newtype.purs+2−2
@@ -17,6 +17,6 @@ apply f x = f x
17
17
18main = do
18main = do
19 print $ Thing "hello"
19 print $ Thing "hello"
20− print $ Box 42
20+ print $ Box 42.0
21− print $ apply Box 9000
21+ print $ apply Box 9000.0
22 trace "Done"
22 trace "Done"
examples/passing/NewtypeWithRecordUpdate.purs+3−3
@@ -1,4 +1,4 @@
1−-- https://github.com/purescript/purescript/issues/812
1+-- https://github.com/purescript/purescript/issues/812.0
2
2
3module Main where
3module Main where
4
4
@@ -7,9 +7,9 @@ import Debug.Trace
7newtype NewType a = NewType (Object a)
7newtype NewType a = NewType (Object a)
8
8
9rec1 :: Object (a :: Number, b :: Number, c:: Number)
9rec1 :: Object (a :: Number, b :: Number, c:: Number)
10−rec1 = { a: 0, b: 0, c: 0 }
10+rec1 = { a: 0.0, b: 0.0, c: 0.0 }
11
11
12rec2 :: NewType (a :: Number, b :: Number, c :: Number)
12rec2 :: NewType (a :: Number, b :: Number, c :: Number)
13−rec2 = NewType (rec1 { a = 1 })
13+rec2 = NewType (rec1 { a = 1.0 })
14
14
15main = trace "Done"
15main = trace "Done"
examples/passing/ObjectGetter.purs+1−1
@@ -2,7 +2,7 @@ module Main where
2
2
3getX = _.x
3getX = _.x
4
4
5−point = { x: 1, y: 0 }
5+point = { x: 1.0, y: 0.0 }
6
6
7main = do
7main = do
8 Debug.Trace.print $ getX point
8 Debug.Trace.print $ getX point
examples/passing/ObjectSynonym.purs+1−1
@@ -3,7 +3,7 @@ module Main where
3type Inner = Number
3type Inner = Number
4
4
5inner :: Inner
5inner :: Inner
6−inner = 0
6+inner = 0.0
7
7
8type Outer = { inner :: Inner }
8type Outer = { inner :: Inner }
9
9
examples/passing/ObjectUpdater.purs+7−7
@@ -24,12 +24,12 @@ main = do
24 record' <- record { value = _ } <$> getValue
24 record' <- record { value = _ } <$> getValue
25 print $ record'.value === true
25 print $ record'.value === true
26
26
27− let point = { x: 1, y: 1 }
27+ let point = { x: 1.0, y: 1.0 }
28− x = 10
28+ x = 10.0
29− point' = (point { x = _, y = x }) 100
29+ point' = (point { x = _, y = x }) 100.0
30
30
31− print $ point'.x === 100
31+ print $ point'.x === 100.0
32− print $ point'.y === 10
32+ print $ point'.y === 10.0
33
33
34− let record2 = (_ { x = _ }) { x: 0 } 10
34+ let record2 = (_ { x = _ }) { x: 0.0 } 10.0
35− print $ record2.x === 10
35+ print $ record2.x === 10.0
examples/passing/ObjectWildcards.purs+5−5
@@ -24,8 +24,8 @@ infixl 4 ===
24main = do
24main = do
25 obj <- { value: _ } <$> getValue
25 obj <- { value: _ } <$> getValue
26 print obj.value
26 print obj.value
27− let x = 1
27+ let x = 1.0
28− point <- { x: _, y: x } <$> return 2
28+ point <- { x: _, y: x } <$> return 2.0
29− print $ point.x === 2
29+ print $ point.x === 2.0
30− print $ point.y === 1
30+ print $ point.y === 1.0
31− trace (mkRecord 1 "Done!").bar
31+ trace (mkRecord 1.0 "Done!").bar
examples/passing/Objects.purs+8−8
@@ -2,18 +2,18 @@ module Main where
2
2
3 import Prelude
3 import Prelude
4
4
5− test = \x -> x.foo + x.bar + 1
5+ test = \x -> x.foo + x.bar + 1.0
6
6
7− append = \o -> { foo: o.foo, bar: 1 }
7+ append = \o -> { foo: o.foo, bar: 1.0 }
8
8
9 apTest = append({foo : "Foo", baz: "Baz"})
9 apTest = append({foo : "Foo", baz: "Baz"})
10
10
11− f = (\a -> a.b.c) { b: { c: 1, d: "Hello" }, e: "World" }
11+ f = (\a -> a.b.c) { b: { c: 1.0, d: "Hello" }, e: "World" }
12
12
13− g = (\a -> a.f { x: 1, y: "y" }) { f: \o -> o.x + 1 }
13+ g = (\a -> a.f { x: 1.0, y: "y" }) { f: \o -> o.x + 1.0 }
14
14
15 typed :: { foo :: Number }
15 typed :: { foo :: Number }
16− typed = { foo: 0 }
16+ typed = { foo: 0.0 }
17
17
18 test2 = \x -> x."!@#"
18 test2 = \x -> x."!@#"
19
19
@@ -22,12 +22,12 @@ module Main where
22 test4 = test2 weirdObj
22 test4 = test2 weirdObj
23 where
23 where
24 weirdObj :: { "!@#" :: Number }
24 weirdObj :: { "!@#" :: Number }
25− weirdObj = { "!@#": 1 }
25+ weirdObj = { "!@#": 1.0 }
26
26
27− test5 = case { "***": 1 } of
27+ test5 = case { "***": 1.0 } of
28 { "***" = n } -> n
28 { "***" = n } -> n
29
29
30− test6 = case { "***": 1 } of
30+ test6 = case { "***": 1.0 } of
31 { "***": n } -> n
31 { "***": n } -> n
32
32
33 test7 {a: snoog , b : blah } = blah
33 test7 {a: snoog , b : blah } = blah
examples/passing/OperatorAssociativity.purs+14−14
@@ -18,7 +18,7 @@ foreign import assert
18 """ :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit
18 """ :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit
19
19
20bug :: Number -> Number -> Number
20bug :: Number -> Number -> Number
21−bug a b = 0 - (a - b)
21+bug a b = 0.0 - (a - b)
22
22
23foreign import explode
23foreign import explode
24 """
24 """
@@ -28,23 +28,23 @@ foreign import explode
28 """ :: forall eff a. Eff eff a
28 """ :: forall eff a. Eff eff a
29
29
30main = do
30main = do
31− assert (bug 0 2 == 2) "bug 0 2 == 2"
31+ assert (bug 0.0 2.0 == 2.0) "bug 0.0 2.0 == 2.0"
32− assert (0 - (0 - 2) == 2) "0 - (0 - 2) == 2"
32+ assert (0.0 - (0.0 - 2.0) == 2.0) "0.0 - (0.0 - 2.0) == 2.0"
33− assert (0 - (0 + 2) == -2) "0 - (0 + 2) == -2"
33+ assert (0.0 - (0.0 + 2.0) == -2.0) "0.0 - (0.0 + 2.0) == -2.0"
34
34
35− assert (6 / (3 * 2) == 1) "6 / (3 * 2) == 1"
35+ assert (6.0 / (3.0 * 2.0) == 1.0) "6.0 / (3.0 * 2.0) == 1.0"
36− assert ((6 / 3) * 2 == 4) "(6 / 3) * 2 == 4"
36+ assert ((6.0 / 3.0) * 2.0 == 4.0) "(6.0 / 3.0) * 2.0 == 4.0"
37
37
38− assert (not (1 < 0) == true) "not (1 < 0) == true"
38+ assert (not (1.0 < 0.0) == true) "not (1.0 < 0.0) == true"
39− assert (not ((negate 1) < 0) == false) "not ((negate 1) < 0) == false"
39+ assert (not ((negate 1.0) < 0.0) == false) "not ((negate 1.0) < 0.0) == false"
40
40
41− assert (negate (1 + 10) == -11) "negate (1 + 10) == -11"
41+ assert (negate (1.0 + 10.0) == -11.0) "negate (1.0 + 10.0) == -11.0"
42
42
43− assert (2 * 3 / 4 == 1.5) "2 * 3 / 4 == 1.5"
43+ assert (2.0 * 3.0 / 4.0 == 1.5) "2.0 * 3.0 / 4.0 == 1.5"
44− assert (1 * 2 * 3 * 4 * 5 / 6 == 20) "1 * 2 * 3 * 4 * 5 / 6 == 20"
44+ assert (1.0 * 2.0 * 3.0 * 4.0 * 5.0 / 6.0 == 20.0) "1.0 * 2.0 * 3.0 * 4.0 * 5.0 / 6.0 == 20.0"
45
45
46− assert (1 + 10 - 5 == 6) "1 + 10 - 5 == 6"
46+ assert (1.0 + 10.0 - 5.0 == 6.0) "1.0 + 10.0 - 5.0 == 6.0"
47− assert (1 + 10 * 5 == 51) "1 + 10 * 5 == 51"
47+ assert (1.0 + 10.0 * 5.0 == 51.0) "1.0 + 10.0 * 5.0 == 51.0"
48− assert (10 * 5 - 1 == 49) "10 * 5 - 1 == 49"
48+ assert (10.0 * 5.0 - 1.0 == 49.0) "10.0 * 5.0 - 1.0 == 49.0"
49
49
50 trace "Success!"
50 trace "Success!"
examples/passing/OperatorInlining.purs+12−12
@@ -5,26 +5,26 @@ import Debug.Trace
5main = do
5main = do
6
6
7 -- semiringNumber
7 -- semiringNumber
8− print (1 + 2)
8+ print (1.0 + 2.0)
9− print (1 * 2)
9+ print (1.0 * 2.0)
10
10
11 -- ringNumber
11 -- ringNumber
12− print (1 - 2)
12+ print (1.0 - 2.0)
13− print (negate 1)
13+ print (negate 1.0)
14
14
15 -- moduleSemiringNumber
15 -- moduleSemiringNumber
16− print (1 / 2)
16+ print (1.0 / 2.0)
17
17
18 -- ordNumber
18 -- ordNumber
19− print (1 > 2)
19+ print (1.0 > 2.0)
20− print (1 < 2)
20+ print (1.0 < 2.0)
21− print (1 <= 2)
21+ print (1.0 <= 2.0)
22− print (1 >= 2)
22+ print (1.0 >= 2.0)
23− print (1 == 2)
23+ print (1.0 == 2.0)
24
24
25 -- eqNumber
25 -- eqNumber
26− print (1 == 2)
26+ print (1.0 == 2.0)
27− print (1 /= 2)
27+ print (1.0 /= 2.0)
28
28
29 -- eqString
29 -- eqString
30 print ("foo" == "bar")
30 print ("foo" == "bar")
examples/passing/OperatorSections.purs+4−4
@@ -14,8 +14,8 @@ foreign import eqeqeq
14infixl 4 ===
14infixl 4 ===
15
15
16main = do
16main = do
17− Debug.Trace.print $ (/ 2) 4 === 2
17+ Debug.Trace.print $ (/ 2.0) 4.0 === 2.0
18− Debug.Trace.print $ (2 /) 4 === 0.5
18+ Debug.Trace.print $ (2.0 /) 4.0 === 0.5
19− Debug.Trace.print $ (`const` 1) 2 === 2
19+ Debug.Trace.print $ (`const` 1.0) 2.0 === 2.0
20− Debug.Trace.print $ (1 `const`) 2 === 1
20+ Debug.Trace.print $ (1.0 `const`) 2.0 === 1.0
21 Debug.Trace.trace "Done!"
21 Debug.Trace.trace "Done!"
examples/passing/OptimizerBug.purs+1−1
@@ -2,7 +2,7 @@ module Main where
2
2
3import Prelude
3import Prelude
4
4
5−x a = 1 + y a
5+x a = 1.0 + y a
6
6
7y a = x a
7y a = x a
8
8
examples/passing/PartialFunction.purs+3−3
@@ -13,7 +13,7 @@ foreign import testError
13 """ :: (Unit -> Number) -> String
13 """ :: (Unit -> Number) -> String
14
14
15fn :: Number -> Number
15fn :: Number -> Number
16−fn 0 = 0
16+fn 0.0 = 0.0
17−fn 1 = 2
17+fn 1.0 = 2.0
18
18
19−main = Debug.Trace.trace (show $ testError $ \_ -> fn 2)
19+main = Debug.Trace.trace (show $ testError $ \_ -> fn 2.0)
examples/passing/Rank2Data.purs+1−1
@@ -10,7 +10,7 @@ module Main where
10 data Nat = Nat forall r. r -> (r -> r) -> r
10 data Nat = Nat forall r. r -> (r -> r) -> r
11
11
12 runNat = \nat -> case nat of
12 runNat = \nat -> case nat of
13− Nat f -> f 0 (\n -> n + 1)
13+ Nat f -> f 0.0 (\n -> n + 1.0)
14
14
15 zero' = Nat (\zero' _ -> zero')
15 zero' = Nat (\zero' _ -> zero')
16
16
examples/passing/Rank2Object.purs+1−1
@@ -5,6 +5,6 @@ import Debug.Trace
5data Foo = Foo { id :: forall a. a -> a }
5data Foo = Foo { id :: forall a. a -> a }
6
6
7foo :: Foo -> Number
7foo :: Foo -> Number
8−foo (Foo { id = f }) = f 0
8+foo (Foo { id = f }) = f 0.0
9
9
10main = trace "Done"
10main = trace "Done"
examples/passing/Rank2TypeSynonym.purs+1−1
@@ -8,7 +8,7 @@ foo :: forall a. a -> Foo a
8foo x = pure x
8foo x = pure x
9
9
10bar :: Foo Number
10bar :: Foo Number
11−bar = foo 3
11+bar = foo 3.0
12
12
13main = do
13main = do
14 x <- bar
14 x <- bar
examples/passing/Rank2Types.purs+1−1
@@ -3,7 +3,7 @@ module Main where
3 import Prelude
3 import Prelude
4
4
5 test1 :: (forall a. (a -> a)) -> Number
5 test1 :: (forall a. (a -> a)) -> Number
6− test1 = \f -> f 0
6+ test1 = \f -> f 0.0
7
7
8 forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
8 forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
9 forever = \bind action -> bind action $ \_ -> forever bind action
9 forever = \bind action -> bind action $ \_ -> forever bind action
examples/passing/Recursion.purs+3−3
@@ -3,8 +3,8 @@ module Main where
3 import Prelude
3 import Prelude
4
4
5 fib = \n -> case n of
5 fib = \n -> case n of
6− 0 -> 1
6+ 0.0 -> 1.0
7− 1 -> 1
7+ 1.0 -> 1.0
8− n -> fib (n - 1) + fib (n - 2)
8+ n -> fib (n - 1.0) + fib (n - 2.0)
9
9
10 main = Debug.Trace.trace "Done"
10 main = Debug.Trace.trace "Done"
examples/passing/RowConstructors.purs+5−5
@@ -5,10 +5,10 @@ type Bar = (x :: Number, y :: Number, z :: Number)
5type Baz = { w :: Number | Bar }
5type Baz = { w :: Number | Bar }
6
6
7foo :: { | Foo }
7foo :: { | Foo }
8−foo = { x: 0, y: 0, z: 0 }
8+foo = { x: 0.0, y: 0.0, z: 0.0 }
9
9
10bar :: { | Bar }
10bar :: { | Bar }
11−bar = { x: 0, y: 0, z: 0 }
11+bar = { x: 0.0, y: 0.0, z: 0.0 }
12
12
13id' :: Object Foo -> Object Bar
13id' :: Object Foo -> Object Bar
14id' = id
14id' = id
@@ -20,16 +20,16 @@ bar' :: { | Bar }
20bar' = id' bar
20bar' = id' bar
21
21
22baz :: Baz
22baz :: Baz
23−baz = { x: 0, y: 0, z: 0, w: 0 }
23+baz = { x: 0.0, y: 0.0, z: 0.0, w: 0.0 }
24
24
25type Quux r = (q :: Number | r)
25type Quux r = (q :: Number | r)
26type Norf r = (q' :: Number | Quux r)
26type Norf r = (q' :: Number | Quux r)
27
27
28quux :: { f :: { | Foo } | Quux Bar }
28quux :: { f :: { | Foo } | Quux Bar }
29−quux = { f: foo', x: 0, y: 0, z: 0, q: 0 }
29+quux = { f: foo', x: 0.0, y: 0.0, z: 0.0, q: 0.0 }
30
30
31quux' :: { | Norf Bar }
31quux' :: { | Norf Bar }
32−quux' = { x: 0, y: 0, z: 0, q: 0, q': 0 }
32+quux' = { x: 0.0, y: 0.0, z: 0.0, q: 0.0, q': 0.0 }
33
33
34wildcard :: { w :: Number | _ } -> Baz
34wildcard :: { w :: Number | _ } -> Baz
35wildcard { w: w } = { x: w, y: w, z: w, w: w }
35wildcard { w: w } = { x: w, y: w, z: w, w: w }
examples/passing/RowSynonyms.purs+1−1
@@ -35,7 +35,7 @@ withIt :: forall bindings eff a. Shadow (Object bindings) ->
35 ({addition :: Number | bindings} -> Eff eff a) -> Eff eff a
35 ({addition :: Number | bindings} -> Eff eff a) -> Eff eff a
36withIt (Shadow str) success = do
36withIt (Shadow str) success = do
37 b <- withBindings
37 b <- withBindings
38− success (b{addition = 1})
38+ success (b{addition = 1.0})
39
39
40foreign import withBindings
40foreign import withBindings
41"""
41"""
examples/passing/RuntimeScopeIssue.purs+5−5
@@ -9,11 +9,11 @@ class B a where
9 b :: a -> Boolean
9 b :: a -> Boolean
10
10
11instance aNumber :: A Number where
11instance aNumber :: A Number where
12− a 0 = true
12+ a 0.0 = true
13− a n = b (n - 1)
13+ a n = b (n - 1.0)
14
14
15instance bNumber :: B Number where
15instance bNumber :: B Number where
16− b 0 = false
16+ b 0.0 = false
17− b n = a (n - 1)
17+ b n = a (n - 1.0)
18
18
19−main = Debug.Trace.print $ a 10
19+main = Debug.Trace.print $ a 10.0
examples/passing/ScopedTypeVariables.purs+1−1
@@ -16,7 +16,7 @@ test2 = h
16 g y = f (f y)
16 g y = f (f y)
17
17
18test3 :: Number
18test3 :: Number
19−test3 = ((\b -> b :: b) :: forall b. b -> b) 0
19+test3 = ((\b -> b :: b) :: forall b. b -> b) 0.0
20
20
21test4 :: forall a. (a -> a) -> a -> a
21test4 :: forall a. (a -> a) -> a -> a
22test4 = h
22test4 = h
examples/passing/ShadowedRename.purs+3−3
@@ -7,15 +7,15 @@ foreign import f
7 """
7 """
8 function f(x) {
8 function f(x) {
9 return function() {
9 return function() {
10− if (x !== 2) throw new Error('x is not 2');
10+ if (x !== 2.0) throw new Error('x is not 2.0');
11 };
11 };
12 }
12 }
13 """ :: forall e. Number -> Eff e Number
13 """ :: forall e. Number -> Eff e Number
14
14
15foo foo = let foo_1 = \_ -> foo
15foo foo = let foo_1 = \_ -> foo
16− foo_2 = foo_1 unit + 1
16+ foo_2 = foo_1 unit + 1.0
17 in foo_2
17 in foo_2
18
18
19main = do
19main = do
20− f (foo 1)
20+ f (foo 1.0)
21 trace "Done"
21 trace "Done"
examples/passing/ShadowedTCO.purs+1−1
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2
2
3−runNat f = f 0 (\n -> n + 1)
3+runNat f = f 0.0 (\n -> n + 1.0)
4
4
5zero' z _ = z
5zero' z _ = z
6
6
examples/passing/ShadowedTCOLet.purs+2−2
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3f x y z =
3f x y z =
4− let f 1 2 3 = 1
4+ let f 1.0 2.0 3.0 = 1.0
5 in f x z y
5 in f x z y
6
6
7−main = Debug.Trace.trace $ show $ f 1 3 2
7+main = Debug.Trace.trace $ show $ f 1.0 3.0 2.0
examples/passing/SignedNumericLiterals.purs+4−4
@@ -1,15 +1,15 @@
1module Main where
1module Main where
2
2
3 p = 0.5
3 p = 0.5
4− q = 1
4+ q = 1.0
5− x = -1
5+ x = -1.0
6 y = -0.5
6 y = -0.5
7 z = 0.5
7 z = 0.5
8− w = 1
8+ w = 1.0
9
9
10 f :: Number -> Number
10 f :: Number -> Number
11 f x = -x
11 f x = -x
12
12
13− test1 = 2 - 1
13+ test1 = 2.0 - 1.0
14
14
15 main = Debug.Trace.trace "Done"
15 main = Debug.Trace.trace "Done"
examples/passing/Superclasses1.purs+2−2
@@ -7,7 +7,7 @@ class (Su a) <= Cl a where
7 cl :: a -> a -> a
7 cl :: a -> a -> a
8
8
9instance suNumber :: Su Number where
9instance suNumber :: Su Number where
10− su n = n + 1
10+ su n = n + 1.0
11
11
12instance clNumber :: Cl Number where
12instance clNumber :: Cl Number where
13 cl n m = n + m
13 cl n m = n + m
@@ -15,4 +15,4 @@ instance clNumber :: Cl Number where
15test :: forall a. (Cl a) => a -> a
15test :: forall a. (Cl a) => a -> a
16test a = su (cl a a)
16test a = su (cl a a)
17
17
18−main = Debug.Trace.print $ test 10
18+main = Debug.Trace.print $ test 10.0
examples/passing/Superclasses2.purs+2−2
@@ -9,7 +9,7 @@ class (Su [a]) <= Cl a where
9 cl :: a -> a -> a
9 cl :: a -> a -> a
10
10
11instance suNumber :: Su Number where
11instance suNumber :: Su Number where
12− su n = n + 1
12+ su n = n + 1.0
13
13
14instance suArray :: (Su a) => Su [a] where
14instance suArray :: (Su a) => Su [a] where
15 su (x : _) = [su x]
15 su (x : _) = [su x]
@@ -20,4 +20,4 @@ instance clNumber :: Cl Number where
20test :: forall a. (Cl a) => a -> [a]
20test :: forall a. (Cl a) => a -> [a]
21test x = su [cl x x]
21test x = su [cl x x]
22
22
23−main = Debug.Trace.print $ test 10 `unsafeIndex` 0
23+main = Debug.Trace.print $ test 10.0 `unsafeIndex` 0.0
examples/passing/Superclasses3.purs+1−1
@@ -8,7 +8,7 @@ class (Monad m) <= MonadWriter w m where
8 tell :: w -> m Unit
8 tell :: w -> m Unit
9
9
10testFunctor :: forall m. (Monad m) => m Number -> m Number
10testFunctor :: forall m. (Monad m) => m Number -> m Number
11−testFunctor n = (+) 1 <$> n
11+testFunctor n = (+) 1.0 <$> n
12
12
13test :: forall w m. (Monad m, MonadWriter w m) => w -> m Unit
13test :: forall w m. (Monad m, MonadWriter w m) => w -> m Unit
14test w = do
14test w = do
examples/passing/TCOCase.purs+3−3
@@ -2,9 +2,9 @@ module Main where
2
2
3data Data = One | More Data
3data Data = One | More Data
4
4
5−main = Debug.Trace.trace (from (to 10000 One))
5+main = Debug.Trace.trace (from (to 10000.0 One))
6 where
6 where
7− to 0 a = a
7+ to 0.0 a = a
8− to n a = to (n - 1) (More a)
8+ to n a = to (n - 1.0) (More a)
9 from One = "Done"
9 from One = "Done"
10 from (More d) = from d
10 from (More d) = from d
examples/passing/TailCall.purs+2−2
@@ -7,9 +7,9 @@ test n [] = n
7test n (x:xs) = test (n + x) xs
7test n (x:xs) = test (n + x) xs
8
8
9loop :: forall a. Number -> a
9loop :: forall a. Number -> a
10−loop x = loop (x + 1)
10+loop x = loop (x + 1.0)
11
11
12notATailCall = \x ->
12notATailCall = \x ->
13 (\notATailCall -> notATailCall x) (\x -> x)
13 (\notATailCall -> notATailCall x) (\x -> x)
14
14
15−main = Debug.Trace.print (test 0 [1, 2, 3])
15+main = Debug.Trace.print (test 0.0 [1.0, 2.0, 3.0])
examples/passing/TopLevelCase.purs+4−4
@@ -13,16 +13,16 @@ infixl 7 %
13(%) = jsMod
13(%) = jsMod
14
14
15gcd :: Number -> Number -> Number
15gcd :: Number -> Number -> Number
16−gcd 0 x = x
16+gcd 0.0 x = x
17−gcd x 0 = x
17+gcd x 0.0 = x
18gcd x y | x > y = gcd (x % y) y
18gcd x y | x > y = gcd (x % y) y
19gcd x y = gcd (y % x) x
19gcd x y = gcd (y % x) x
20
20
21−guardsTest (x:xs) | x > 0 = guardsTest xs
21+guardsTest (x:xs) | x > 0.0 = guardsTest xs
22guardsTest xs = xs
22guardsTest xs = xs
23
23
24data A = A
24data A = A
25
25
26−parseTest A 0 = 0
26+parseTest A 0.0 = 0.0
27
27
28main = Debug.Trace.trace "Done"
28main = Debug.Trace.trace "Done"
examples/passing/TypeClasses.purs+4−4
@@ -53,17 +53,17 @@ instance bindMaybe :: Bind Maybe where
53instance monadMaybe :: Monad Maybe
53instance monadMaybe :: Monad Maybe
54
54
55test4 :: forall a m. (Monad m) => a -> m Number
55test4 :: forall a m. (Monad m) => a -> m Number
56−test4 = \_ -> return 1
56+test4 = \_ -> return 1.0
57
57
58−test5 = \_ -> Just 1 >>= \n -> return (n + 1)
58+test5 = \_ -> Just 1.0 >>= \n -> return (n + 1.0)
59
59
60ask r = r
60ask r = r
61
61
62runReader r f = f r
62runReader r f = f r
63
63
64−test9 _ = runReader 0 $ do
64+test9 _ = runReader 0.0 $ do
65 n <- ask
65 n <- ask
66− return $ n + 1
66+ return $ n + 1.0
67
67
68main = Debug.Trace.trace (test7 "Done")
68main = Debug.Trace.trace (test7 "Done")
69
69
examples/passing/TypeDecl.purs+2−2
@@ -6,7 +6,7 @@ module Main where
6 k x y = x
6 k x y = x
7
7
8 iterate :: forall a. Number -> (a -> a) -> a -> a
8 iterate :: forall a. Number -> (a -> a) -> a -> a
9− iterate 0 f a = a
9+ iterate 0.0 f a = a
10− iterate n f a = iterate (n - 1) f (f a)
10+ iterate n f a = iterate (n - 1.0) f (f a)
11
11
12 main = Debug.Trace.trace "Done"
12 main = Debug.Trace.trace "Done"
examples/passing/TypeWildcards.purs+1−1
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3testTopLevel :: _ -> _
3testTopLevel :: _ -> _
4−testTopLevel n = n + 1
4+testTopLevel n = n + 1.0
5
5
6test :: forall a. (Eq a) => (a -> a) -> a -> a
6test :: forall a. (Eq a) => (a -> a) -> a -> a
7test f a = go (f a) a
7test f a = go (f a) a
examples/passing/UnknownInTypeClassLookup.purs+1−1
@@ -9,4 +9,4 @@ test _ _ = "Done"
9
9
10runTest a = test a a
10runTest a = test a a
11
11
12−main = Debug.Trace.trace $ runTest 0
12+main = Debug.Trace.trace $ runTest 0.0
examples/passing/Where.purs+14−14
@@ -7,29 +7,29 @@ import Control.Monad.ST
7test1 x = y
7test1 x = y
8 where
8 where
9 y :: Number
9 y :: Number
10− y = x + 1
10+ y = x + 1.0
11
11
12test2 x y = x' + y'
12test2 x y = x' + y'
13 where
13 where
14− x' = x + 1
14+ x' = x + 1.0
15− y' = y + 1
15+ y' = y + 1.0
16
16
17
17
18−test3 = f 1 2 3
18+test3 = f 1.0 2.0 3.0
19 where f x y z = x + y + z
19 where f x y z = x + y + z
20
20
21
21
22−test4 = f (+) [1, 2]
22+test4 = f (+) [1.0, 2.0]
23 where f x [y, z] = x y z
23 where f x [y, z] = x y z
24
24
25
25
26−test5 = g 10
26+test5 = g 10.0
27 where
27 where
28− f x | x > 0 = g (x / 2) + 1
28+ f x | x > 0.0 = g (x / 2.0) + 1.0
29− f x = 0
29+ f x = 0.0
30− g x = f (x - 1) + 1
30+ g x = f (x - 1.0) + 1.0
31
31
32−test6 = if f true then f 1 else f 2
32+test6 = if f true then f 1.0 else f 2.0
33 where f :: forall a. a -> a
33 where f :: forall a. a -> a
34 f x = x
34 f x = x
35
35
@@ -37,13 +37,13 @@ test7 :: Number -> Number
37test7 x = go x
37test7 x = go x
38 where
38 where
39 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
39 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
40− go y = go $ (y + x / y) / 2
40+ go y = go $ (y + x / y) / 2.0
41
41
42main = do
42main = do
43− Debug.Trace.print (test1 1)
43+ Debug.Trace.print (test1 1.0)
44− Debug.Trace.print (test2 1 2)
44+ Debug.Trace.print (test2 1.0 2.0)
45 Debug.Trace.print test3
45 Debug.Trace.print test3
46 Debug.Trace.print test4
46 Debug.Trace.print test4
47 Debug.Trace.print test5
47 Debug.Trace.print test5
48 Debug.Trace.print test6
48 Debug.Trace.print test6
49− Debug.Trace.print (test7 100)
49+ Debug.Trace.print (test7 100.0)