git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix failing tests
942c3a5Gary Burgess
examples/passing/Arrays.purs+2−2
@@ -1,8 +1,8 @@
1module Main where
1module Main where
2
2
3−import Prelude
3+import Prelude.Unsafe (unsafeIndex)
4
4
5−test1 arr = arr !! 0 + arr !! 1 + 1
5+test1 arr = arr `unsafeIndex` 0 + arr `unsafeIndex` 1 + 1
6
6
7test2 = \arr -> case arr of
7test2 = \arr -> case arr of
8 [x, y] -> x + y
8 [x, y] -> x + y
examples/passing/EmptyDataDecls.purs+3−3
@@ -17,14 +17,14 @@ foreign import concat
17 \ };\
17 \ };\
18 \}" :: forall a. [a] -> [a] -> [a]
18 \}" :: forall a. [a] -> [a] -> [a]
19
19
20−cons :: forall a n. a -> Array n a -> Array (S n) a
20+cons' :: forall a n. a -> Array n a -> Array (S n) a
21−cons x (Array xs) = Array $ concat [x] xs
21+cons' x (Array xs) = Array $ concat [x] xs
22
22
23foreign import error
23foreign import error
24 "function error(msg) {\
24 "function error(msg) {\
25 \ throw msg;\
25 \ throw msg;\
26 \}" :: forall a. String -> a
26 \}" :: forall a. String -> a
27
27
28−main = case cons 1 $ cons 2 $ cons 3 nil of
28+main = case cons' 1 $ cons' 2 $ cons' 3 nil of
29 Array [1, 2, 3] -> Debug.Trace.trace "Done"
29 Array [1, 2, 3] -> Debug.Trace.trace "Done"
30 _ -> error "Failed"
30 _ -> error "Failed"
examples/passing/Superclasses2.purs+3−1
@@ -1,5 +1,7 @@
1module Main where
1module Main where
2
2
3+import Prelude.Unsafe (unsafeIndex)
4+
3class Su a where
5class Su a where
4 su :: a -> a
6 su :: a -> a
5
7
@@ -18,4 +20,4 @@ instance clNumber :: Cl Number where
18test :: forall a. (Cl a) => a -> [a]
20test :: forall a. (Cl a) => a -> [a]
19test x = su [cl x x]
21test x = su [cl x x]
20
22
21−main = Debug.Trace.print $ test 10 !! 0
23+main = Debug.Trace.print $ test 10 `unsafeIndex` 0
examples/passing/TypeClasses.purs−6
@@ -57,12 +57,6 @@ test4 = \_ -> return 1
57
57
58test5 = \_ -> Just 1 >>= \n -> return (n + 1)
58test5 = \_ -> Just 1 >>= \n -> return (n + 1)
59
59
60−instance showArray :: (Prelude.Show a) => Prelude.Show [a] where
61− show [] = "[]"
62− show (x:xs) = show x ++ ", " ++ show xs
63−
64−test6 = \_ -> show ["testing"]
65−
66instance functorFunction :: Functor ((->) r) where
60instance functorFunction :: Functor ((->) r) where
67 (<$>) = liftM1
61 (<$>) = liftM1
68
62