git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #221 from garyb/master
4d8ab7aPhil Freeman
examples/failing/Arrays.purs+1−1
@@ -1,4 +1,4 @@
1−module Arrays where
1+module Data.Array where
2
2
3 import Prelude
3 import Prelude
4
4
examples/failing/LocalVars.pursdeleted−8
@@ -1,8 +0,0 @@
1−module LocalVars where
2−
3− import Prelude
4−
5− bad = \x -> {
6− x = x + 1;
7− return x;
8− }
examples/failing/PatternScope.pursdeleted−12
@@ -1,12 +0,0 @@
1−module PatternScope where
2−
3− import Prelude
4−
5− -- Pattern scope doesn't leak
6− foobar = \x -> {
7− var y = case x of
8− z | z % 2 == 0 -> 1
9− _ -> 2;
10− return z;
11− }
12−
examples/failing/Shadowed.pursdeleted−14
@@ -1,14 +0,0 @@
1−module Shadowed where
2−
3−import Prelude
4−
5−a = [1, 2]
6−
7−foo = {
8− var x = a !! 0;
9− var a = 0;
10−
11− a = a + 1;
12−
13− return x + a;
14− }
examples/failing/SkolemEscape2.purs+2−2
@@ -1,8 +1,8 @@
1module SkolemEscape where
1module SkolemEscape where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5−import ST
5+import Control.Monad.ST
6
6
7test _ = do
7test _ = do
8 r <- runST (newSTRef 0)
8 r <- runST (newSTRef 0)
examples/passing/Applicative.purs+1−1
@@ -13,4 +13,4 @@ instance Applicative Maybe where
13
13
14module Main where
14module Main where
15
15
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/ArrayType.purs+1−1
@@ -14,4 +14,4 @@ instance Functor [] where
14
14
15module Main where
15module Main where
16
16
17−main = Trace.trace "Done"
17+main = Debug.Trace.trace "Done"
examples/passing/Arrays.purs+4−4
@@ -1,4 +1,4 @@
1−module ArraysTests where
1+module Data.ArrayTests where
2
2
3import Prelude
3import Prelude
4
4
@@ -23,12 +23,12 @@ test4 = \arr -> case arr of
23
23
24module Main where
24module Main where
25
25
26−import Arrays
26+import Data.Array
27import Prelude
27import Prelude
28
28
29main = do
29main = do
30 let x = [3,2,1]
30 let x = [3,2,1]
31 let y = sort x
31 let y = sort x
32 if x == [3,2,1]
32 if x == [3,2,1]
33− then Trace.trace "Done"
33+ then Debug.Trace.trace "Done"
34− else Errors.throwError "Not done"
34+ else Control.Monad.Error.throwError "Not done"
examples/passing/Auto.purs+1−1
@@ -12,4 +12,4 @@ module Auto where
12
12
13module Main where
13module Main where
14
14
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/BindersInFunctions.purs+3−3
@@ -1,12 +1,12 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Arrays
4+import Data.Array
5
5
6tails = map (\(_:xs) -> xs)
6tails = map (\(_:xs) -> xs)
7
7
8main =
8main =
9 let ts = tails [[1, 2, 3], [4, 5], [6]] in
9 let ts = tails [[1, 2, 3], [4, 5], [6]] in
10 if ts == [[2, 3], [5], []]
10 if ts == [[2, 3], [5], []]
11− then Trace.trace "Done"
11+ then Debug.Trace.trace "Done"
12− else Errors.throwError "Incorrect result from 'tails'."
12+ else Control.Monad.Error.throwError "Incorrect result from 'tails'."
examples/passing/Church.purs+1−1
@@ -15,4 +15,4 @@ module Church where
15
15
16module Main where
16module Main where
17
17
18−main = Trace.trace "Done"
18+main = Debug.Trace.trace "Done"
examples/passing/Collatz.purs+3−3
@@ -1,8 +1,8 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5−import ST
5+import Control.Monad.ST
6
6
7collatz :: Number -> Number
7collatz :: Number -> Number
8collatz n = runPure (runST (do
8collatz n = runPure (runST (do
@@ -15,4 +15,4 @@ collatz n = runPure (runST (do
15 return $ m == 1
15 return $ m == 1
16 readSTRef count))
16 readSTRef count))
17
17
18−main = Trace.print $ collatz 1
18+main = Debug.Trace.print $ collatz 1
examples/passing/Conditional.purs+1−1
@@ -6,4 +6,4 @@ module Conditional where
6
6
7module Main where
7module Main where
8
8
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Cons.purs+2−2
@@ -1,7 +1,7 @@
1module Cons where
1module Cons where
2
2
3 import Prelude
3 import Prelude
4− import Arrays
4+ import Data.Array
5
5
6 test1 = \xs -> 1 : xs
6 test1 = \xs -> 1 : xs
7
7
@@ -9,4 +9,4 @@ module Cons where
9
9
10module Main where
10module Main where
11
11
12−main = Trace.trace "Done"
12+main = Debug.Trace.trace "Done"
examples/passing/Console.purs+2−2
@@ -1,8 +1,8 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5−import Trace
5+import Debug.Trace
6
6
7replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
7replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
8replicateM_ 0 _ = return {}
8replicateM_ 0 _ = return {}
examples/passing/DataAndType.purs+1−1
@@ -6,4 +6,4 @@ type B = A
6
6
7module Main where
7module Main where
8
8
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/DataImport.purs+1−1
@@ -10,4 +10,4 @@ unTest (Test s) = s
10
10
11main = do
11main = do
12 let x = unTest (Test "Done")
12 let x = unTest (Test "Done")
13− Trace.trace x
13+ Debug.Trace.trace x
examples/passing/Do.purs+1−1
@@ -46,4 +46,4 @@ test9 = \_ -> (+) <$> Just 1 <*> Just 2
46
46
47module Main where
47module Main where
48
48
49−main = Trace.trace "Done"
49+main = Debug.Trace.trace "Done"
examples/passing/Dollar.purs+1−1
@@ -13,4 +13,4 @@ test2 x = id id $ id x
13
13
14module Main where
14module Main where
15
15
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/DottedModules.purs+1−1
@@ -17,4 +17,4 @@ module Main where
17
17
18 unwrap (Text x) = x
18 unwrap (Text x) = x
19
19
20− main = Trace.print $ foo $ unwrap x
20+ main = Debug.Trace.print $ foo $ unwrap x
examples/passing/Eff.purs+7−7
@@ -1,10 +1,10 @@
1module TestEff where
1module TestEff where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5−import ST
5+import Control.Monad.ST
6−import Errors
6+import Control.Monad.Error
7−import Trace
7+import Debug.Trace
8
8
9test1 = catchError (\s -> return 0) $ do
9test1 = catchError (\s -> return 0) $ do
10 trace "Testing"
10 trace "Testing"
@@ -18,10 +18,10 @@ test2 = runPure (runST (do
18module Main where
18module Main where
19
19
20import Prelude
20import Prelude
21−import Eff
21+import Control.Monad.Eff
22import TestEff
22import TestEff
23
23
24main = do
24main = do
25 n <- test1
25 n <- test1
26− Trace.print n
26+ Debug.Trace.print n
27− Trace.print test2
27+ Debug.Trace.print test2
examples/passing/ExternData.purs+1−1
@@ -16,4 +16,4 @@ module ExternData where
16
16
17module Main where
17module Main where
18
18
19−main = Trace.trace "Done"
19+main = Debug.Trace.trace "Done"
examples/passing/ExternRaw.purs+1−1
@@ -12,4 +12,4 @@ foreign import concat "function concat(xs) { \
12
12
13module Main where
13module Main where
14
14
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/FFI.purs+1−1
@@ -13,4 +13,4 @@ baz _ = foo "test"
13
13
14module Main where
14module Main where
15
15
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/FunctionScope.purs+2−2
@@ -13,5 +13,5 @@ module Main where
13 main = do
13 main = do
14 let value = mkValue 1
14 let value = mkValue 1
15 if value == 1
15 if value == 1
16− then Trace.trace "Done"
16+ then Debug.Trace.trace "Done"
17− else Errors.throwError "Not done"
17+ else Control.Monad.Error.throwError "Not done"
examples/passing/Functions.purs+1−1
@@ -14,4 +14,4 @@ module Functions where
14
14
15module Main where
15module Main where
16
16
17−main = Trace.trace "Done"
17+main = Debug.Trace.trace "Done"
examples/passing/Functions2.purs+2−2
@@ -13,5 +13,5 @@ module Main where
13 main = do
13 main = do
14 let value = test "Done" {}
14 let value = test "Done" {}
15 if value == "Done"
15 if value == "Done"
16− then Trace.trace "Done"
16+ then Debug.Trace.trace "Done"
17− else Errors.throwError "Not done"
17+ else Control.Monad.Error.throwError "Not done"
examples/passing/Guards.purs+1−1
@@ -13,4 +13,4 @@ module Guards where
13
13
14module Main where
14module Main where
15
15
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/Import.purs+1−1
@@ -13,4 +13,4 @@ module M2 where
13
13
14module Main where
14module Main where
15
15
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/InferRecFunWithConstrainedArgument.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
5test 100 = 100
5test 100 = 100
6test n = test(1 + n)
6test n = test(1 + n)
7
7
8−main = Trace.print $ test 0
8+main = Debug.Trace.print $ test 0
examples/passing/JSReserved.purs+2−2
@@ -12,10 +12,10 @@ module JSReserved where
12module Main where
12module Main where
13
13
14 import Prelude
14 import Prelude
15− import Arrays
15+ import Data.Array
16 import JSReserved
16 import JSReserved
17
17
18− main = Trace.print [ yield
18+ main = Debug.Trace.print [ yield
19 , member
19 , member
20 , this 1
20 , this 1
21 , public 1 ]
21 , public 1 ]
examples/passing/Let.purs+4−4
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5
5
6test1 x = let y = x + 1 in y
6test1 x = let y = x + 1 in y
7
7
@@ -13,6 +13,6 @@ test2 x y =
13test3 x = let 1 = x in 2
13test3 x = let 1 = x in 2
14
14
15main = do
15main = do
16− Trace.print (test1 1)
16+ Debug.Trace.print (test1 1)
17− Trace.print (test2 1 2)
17+ Debug.Trace.print (test2 1 2)
18− Trace.print (test3 1)
18+ Debug.Trace.print (test3 1)
examples/passing/List.purs+3−3
@@ -1,10 +1,10 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5−import Arrays
5+import Data.Array
6import Global
6import Global
7
7
8main = do
8main = do
9 let test1 = concat [1, 2, 3] [4, 5, 6]
9 let test1 = concat [1, 2, 3] [4, 5, 6]
10− Trace.print test1
10+ Debug.Trace.print test1
examples/passing/Match.purs+1−1
@@ -6,4 +6,4 @@ module Match where
6
6
7module Main where
7module Main where
8
8
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Math.purs+2−2
@@ -1,8 +1,8 @@
1module Main where
1module Main where
2
2
3 import Prelude
3 import Prelude
4− import Trace
4+ import Debug.Trace
5− import Eff
5+ import Control.Monad.Eff
6
6
7 main = do
7 main = do
8 print $ Math.sin 0
8 print $ Math.sin 0
examples/passing/Maybe.purs+2−2
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Maybe
4+import Data.Maybe
5import Global
5import Global
6
6
7main = do
7main = do
@@ -9,4 +9,4 @@ main = do
9 a <- Just 1
9 a <- Just 1
10 b <- Just 2
10 b <- Just 2
11 return (a + b)
11 return (a + b)
12− Trace.print test1
12+ Debug.Trace.print test1
examples/passing/Module.purs+1−1
@@ -25,4 +25,4 @@ module M2 where
25
25
26module Main where
26module Main where
27
27
28−main = Trace.trace "Done"
28+main = Debug.Trace.trace "Done"
examples/passing/ModuleDeps.purs+1−1
@@ -14,4 +14,4 @@ baz = 1
14
14
15module Main where
15module Main where
16
16
17−main = Trace.trace "Done"
17+main = Debug.Trace.trace "Done"
examples/passing/Monad.purs+1−1
@@ -29,4 +29,4 @@ module MonadTest where
29
29
30module Main where
30module Main where
31
31
32−main = Trace.trace "Done"
32+main = Debug.Trace.trace "Done"
examples/passing/MultipleConstructorArgs.purs+5−5
@@ -1,6 +1,6 @@
1module MultipleConstructorArgs where
1module MultipleConstructorArgs where
2
2
3−import Arrays
3+import Data.Array
4
4
5data P a b = P a b
5data P a b = P a b
6
6
@@ -20,9 +20,9 @@ module Main where
20import Prelude
20import Prelude
21import MultipleConstructorArgs
21import MultipleConstructorArgs
22import Global
22import Global
23−import Eff
23+import Control.Monad.Eff
24−import Arrays
24+import Data.Array
25
25
26main = do
26main = do
27− Trace.trace (runP (\s n -> s ++ show n) (P "Test" 1))
27+ Debug.Trace.trace (runP (\s n -> s ++ show n) (P "Test" 1))
28− Trace.print test1
28+ Debug.Trace.print test1
examples/passing/MutRec.purs+1−1
@@ -18,4 +18,4 @@ module MutRec where
18
18
19module Main where
19module Main where
20
20
21−main = Trace.trace "Done"
21+main = Debug.Trace.trace "Done"
examples/passing/NamedPatterns.purs+1−1
@@ -6,4 +6,4 @@ module NamedPatterns where
6
6
7module Main where
7module Main where
8
8
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Nested.purs+1−1
@@ -6,4 +6,4 @@ module Nested where
6
6
7module Main where
7module Main where
8
8
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/NestedTypeSynonyms.purs+1−1
@@ -10,4 +10,4 @@ module Main where
10
10
11 import Prelude
11 import Prelude
12
12
13− main = Trace.print (NestedTypeSynonyms.fn "Done")
13+ main = Debug.Trace.print (NestedTypeSynonyms.fn "Done")
examples/passing/ObjectSynonym.purs+1−1
@@ -12,4 +12,4 @@ outer = { inner: inner }
12
12
13module Main where
13module Main where
14
14
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/ObjectUpdate.purs+1−1
@@ -17,4 +17,4 @@ module ObjectUpdate where
17
17
18module Main where
18module Main where
19
19
20−main = Trace.trace "Done"
20+main = Debug.Trace.trace "Done"
examples/passing/Objects.purs+1−1
@@ -17,4 +17,4 @@ module Objects where
17
17
18module Main where
18module Main where
19
19
20−main = Trace.trace "Done"
20+main = Debug.Trace.trace "Done"
examples/passing/OneConstructor.purs+1−1
@@ -6,4 +6,4 @@ one (One a) = a
6
6
7module Main where
7module Main where
8
8
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Operators.purs+3−3
@@ -60,10 +60,10 @@ import Operators1
60import Operators2
60import Operators2
61
61
62import Prelude
62import Prelude
63−import Eff
63+import Control.Monad.Eff
64−import Trace
64+import Debug.Trace
65import Global
65import Global
66−import Arrays
66+import Data.Array
67
67
68main =
68main =
69 print [ show $ test1 1 2 $ \x y -> x + y
69 print [ show $ test1 1 2 $ \x y -> x + y
examples/passing/OptimizerBug.purs+1−1
@@ -8,4 +8,4 @@ y a = x a
8
8
9module Main where
9module Main where
10
10
11−main = Trace.trace "Done"
11+main = Debug.Trace.trace "Done"
examples/passing/Patterns.purs+1−1
@@ -27,4 +27,4 @@ module Patterns where
27
27
28module Main where
28module Main where
29
29
30−main = Trace.trace "Done"
30+main = Debug.Trace.trace "Done"
examples/passing/Person.purs+1−1
@@ -12,4 +12,4 @@ module Person where
12
12
13module Main where
13module Main where
14
14
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/Rank2Data.purs+1−1
@@ -28,4 +28,4 @@ module Rank2Data where
28
28
29module Main where
29module Main where
30
30
31−main = Trace.trace "Done"
31+main = Debug.Trace.trace "Done"
examples/passing/Rank2Types.purs+1−1
@@ -22,4 +22,4 @@ module Rank2Types where
22
22
23module Main where
23module Main where
24
24
25−main = Trace.trace "Done"
25+main = Debug.Trace.trace "Done"
examples/passing/Recursion.purs+1−1
@@ -9,4 +9,4 @@ module Recursion where
9
9
10module Main where
10module Main where
11
11
12−main = Trace.trace "Done"
12+main = Debug.Trace.trace "Done"
examples/passing/RedefinedFixity.purs+1−1
@@ -15,4 +15,4 @@ import M2
15
15
16module Main where
16module Main where
17
17
18−main = Trace.trace "Done"
18+main = Debug.Trace.trace "Done"
examples/passing/RuntimeScopeIssue.purs+1−1
@@ -22,4 +22,4 @@ import RuntimeScopeIssue
22
22
23import Prelude
23import Prelude
24
24
25−main = Trace.print $ a 10
25+main = Debug.Trace.print $ a 10
examples/passing/STArray.purs+4−4
@@ -1,9 +1,9 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import Eff
4+import Control.Monad.Eff
5−import ST
5+import Control.Monad.ST
6−import Arrays
6+import Data.Array
7
7
8test = runSTArray (do
8test = runSTArray (do
9 a <- newSTArray 2 0
9 a <- newSTArray 2 0
@@ -20,4 +20,4 @@ fromTo lo hi = runSTArray (do
20 arr <- newSTArray (hi - lo + 1) 0
20 arr <- newSTArray (hi - lo + 1) 0
21 fromTo' lo hi 0 arr)
21 fromTo' lo hi 0 arr)
22
22
23−main = Trace.print $ runPure (fromTo 10 20)
23+main = Debug.Trace.print $ runPure (fromTo 10 20)
examples/passing/TailCall.purs+1−1
@@ -17,4 +17,4 @@ module Main where
17import Prelude
17import Prelude
18import TailCall
18import TailCall
19
19
20−main = Trace.print (test 0 [1, 2, 3])
20+main = Debug.Trace.print (test 0 [1, 2, 3])
examples/passing/Tick.purs+1−1
@@ -4,4 +4,4 @@ test' x = x
4
4
5module Main where
5module Main where
6
6
7−main = Trace.trace "Done"
7+main = Debug.Trace.trace "Done"
examples/passing/TopLevelCase.purs+1−1
@@ -17,4 +17,4 @@ module TopLevelCase where
17
17
18module Main where
18module Main where
19
19
20−main = Trace.trace "Done"
20+main = Debug.Trace.trace "Done"
examples/passing/TypeClasses.purs+1−1
@@ -65,5 +65,5 @@ module Main where
65import Prelude
65import Prelude
66import TypeClasses
66import TypeClasses
67
67
68−main = Trace.trace (test7 "Done")
68+main = Debug.Trace.trace (test7 "Done")
69
69
examples/passing/TypeClassesInOrder.purs+1−1
@@ -8,4 +8,4 @@ class Foo a where
8instance Foo String where
8instance Foo String where
9 foo s = s
9 foo s = s
10
10
11−main = Trace.trace $ foo "Done"
11+main = Debug.Trace.trace $ foo "Done"
examples/passing/TypeClassesWithOverlappingTypeVariables.purs+2−2
@@ -1,10 +1,10 @@
1module Main where
1module Main where
2
2
3 import Prelude
3 import Prelude
4− import Either
4+ import Data.Either
5
5
6 instance Prelude.Functor (Either a) where
6 instance Prelude.Functor (Either a) where
7 (<$>) _ (Left x) = Left x
7 (<$>) _ (Left x) = Left x
8 (<$>) f (Right y) = Right (f y)
8 (<$>) f (Right y) = Right (f y)
9
9
10− main = Trace.trace "Done"
10+ main = Debug.Trace.trace "Done"
examples/passing/TypeDecl.purs+1−1
@@ -11,4 +11,4 @@ module TypeDecl where
11
11
12module Main where
12module Main where
13
13
14−main = Trace.trace "Done"
14+main = Debug.Trace.trace "Done"
examples/passing/TypeSynonyms.purs+3−2
@@ -22,7 +22,8 @@ module TypeSynonyms where
22 test1 :: forall a b c. Lens (Pair (Pair a b) c) a
22 test1 :: forall a b c. Lens (Pair (Pair a b) c) a
23 test1 = composeLenses fst fst
23 test1 = composeLenses fst fst
24
24
25− import Arrays
25+ import Data.Array ((:))
26+ import Data.Array.Unsafe
26
27
27 headLens :: forall a. Lens [a] a
28 headLens :: forall a. Lens [a] a
28 headLens =
29 headLens =
@@ -36,4 +37,4 @@ module TypeSynonyms where
36
37
37module Main where
38module Main where
38
39
39−main = Trace.trace "Done"
40+main = Debug.Trace.trace "Done"
examples/passing/iota.purs+1−1
@@ -8,4 +8,4 @@ module Iota where
8
8
9module Main where
9module Main where
10
10
11−main = Trace.trace "Done"
11+main = Debug.Trace.trace "Done"
examples/passing/s.purs+1−1
@@ -4,4 +4,4 @@ module S where
4
4
5module Main where
5module Main where
6
6
7−main = Trace.trace "Done"
7+main = Debug.Trace.trace "Done"
prelude/prelude.purs+62−63
@@ -162,17 +162,14 @@ module Prelude where
162 -- Referential equality
162 -- Referential equality
163 data Ref a = Ref a
163 data Ref a = Ref a
164
164
165− foreign import refEq "function refEq(r1) {\
165+ liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
166− \ return function(r2) {\
166+ liftRef f (Ref x) (Ref y) = f x y
167− \ return r1.values[0] === r2.values[0];\
167+
168− \ };\
169− \}" :: forall a. Ref a -> Ref a -> Boolean
168+ refEq :: forall a. Ref a -> Ref a -> Boolean
170−
169+ refEq = liftRef unsafeRefEq
171− foreign import refIneq "function refIneq(r1) {\
170+
172− \ return function(r2) {\
173− \ return r1.values[0] !== r2.values[0];\
174− \ };\
175− \}" :: forall a. Ref a -> Ref a -> Boolean
171+ refIneq :: forall a. Ref a -> Ref a -> Boolean
172+ refIneq = liftRef unsafeRefIneq
176
173
177 foreign import unsafeRefEq "function unsafeRefEq(r1) {\
174 foreign import unsafeRefEq "function unsafeRefEq(r1) {\
178 \ return function(r2) {\
175 \ return function(r2) {\
@@ -356,7 +353,7 @@ module Prelude where
356 \ };\
353 \ };\
357 \}" :: String -> String -> String
354 \}" :: String -> String -> String
358
355
359−module Monoid where
356+module Data.Monoid where
360
357
361 import Prelude
358 import Prelude
362
359
@@ -372,16 +369,16 @@ module Monoid where
372
369
373 instance Monoid [a] where
370 instance Monoid [a] where
374 mempty = []
371 mempty = []
375− (<>) = Arrays.concat
372+ (<>) = Data.Array.concat
376
373
377 mconcat :: forall m. (Monoid m) => [m] -> m
374 mconcat :: forall m. (Monoid m) => [m] -> m
378 mconcat [] = mempty
375 mconcat [] = mempty
379 mconcat (m:ms) = m <> mconcat ms
376 mconcat (m:ms) = m <> mconcat ms
380
377
381−module Monad where
378+module Control.Monad where
382
379
383 import Prelude
380 import Prelude
384− import Arrays
381+ import Data.Array
385
382
386 replicateM :: forall m a. (Monad m) => Number -> m a -> m [a]
383 replicateM :: forall m a. (Monad m) => Number -> m a -> m [a]
387 replicateM 0 _ = return []
384 replicateM 0 _ = return []
@@ -428,7 +425,7 @@ module Monad where
428 when true m = m
425 when true m = m
429 when false _ = return {}
426 when false _ = return {}
430
427
431−module Maybe where
428+module Data.Maybe where
432
429
433 import Prelude
430 import Prelude
434
431
@@ -458,7 +455,7 @@ module Maybe where
458 show (Just x) = "Just " ++ (show x)
455 show (Just x) = "Just " ++ (show x)
459 show Nothing = "Nothing"
456 show Nothing = "Nothing"
460
457
461−module Either where
458+module Data.Either where
462
459
463 import Prelude
460 import Prelude
464
461
@@ -485,24 +482,18 @@ module Either where
485 show (Left x) = "Left " ++ (show x)
482 show (Left x) = "Left " ++ (show x)
486 show (Right y) = "Right " ++ (show y)
483 show (Right y) = "Right " ++ (show y)
487
484
488−module Arrays where
485+module Data.Array where
489
486
490 import Prelude
487 import Prelude
491− import Maybe
488+ import Data.Maybe
492
489
493− head :: forall a. [a] -> a
490+ head :: forall a. [a] -> Maybe a
494− head (x : _) = x
495−
496− headSafe :: forall a. [a] -> Maybe a
497− headSafe (x : _) = Just x
491+ head (x : _) = Just x
498− headSafe _ = Nothing
492+ head _ = Nothing
499
493
500− tail :: forall a. [a] -> [a]
494+ tail :: forall a. [a] -> Maybe [a]
501− tail (_ : xs) = xs
502−
503− tailSafe :: forall a. [a] -> Maybe [a]
504− tailSafe (_ : xs) = Just xs
495+ tail (_ : xs) = Just xs
505− tailSafe _ = Nothing
496+ tail _ = Nothing
506
497
507 map :: forall a b. (a -> b) -> [a] -> [b]
498 map :: forall a b. (a -> b) -> [a] -> [b]
508 map _ [] = []
499 map _ [] = []
@@ -647,11 +638,19 @@ module Arrays where
647 instance Prelude.Alternative [] where
638 instance Prelude.Alternative [] where
648 empty = []
639 empty = []
649 (<|>) = concat
640 (<|>) = concat
641+
642+module Data.Array.Unsafe where
650
643
644+ head :: forall a. [a] -> a
645+ head (x : _) = x
646+
647+ tail :: forall a. [a] -> [a]
648+ tail (_ : xs) = xs
649+
651−module Tuples where
650+module Data.Tuple where
652
651
653 import Prelude
652 import Prelude
654− import Arrays
653+ import Data.Array
655
654
656 data Tuple a b = Tuple a b
655 data Tuple a b = Tuple a b
657
656
@@ -672,7 +671,7 @@ module Tuples where
672 Tuple as bs -> Tuple (a : as) (b : bs)
671 Tuple as bs -> Tuple (a : as) (b : bs)
673 unzip [] = Tuple [] []
672 unzip [] = Tuple [] []
674
673
675−module String where
674+module Data.String where
676
675
677 foreign import lengthS "function lengthS(s) {\
676 foreign import lengthS "function lengthS(s) {\
678 \ return s.length;\
677 \ return s.length;\
@@ -752,7 +751,7 @@ module String where
752 \ return s.trim();\
751 \ return s.trim();\
753 \}" :: String -> String
752 \}" :: String -> String
754
753
755−module Regex where
754+module Data.String.Regex where
756
755
757 foreign import data Regex :: *
756 foreign import data Regex :: *
758
757
@@ -907,7 +906,7 @@ module Math where
907 foreign import sqrt1_2 "var sqrt1_2 = Math.SQRT1_2;" :: Number
906 foreign import sqrt1_2 "var sqrt1_2 = Math.SQRT1_2;" :: Number
908 foreign import sqrt2 "var sqrt2 = Math.SQRT2;" :: Number
907 foreign import sqrt2 "var sqrt2 = Math.SQRT2;" :: Number
909
908
910−module Eff where
909+module Control.Monad.Eff where
911
910
912 foreign import data Eff :: # ! -> * -> *
911 foreign import data Eff :: # ! -> * -> *
913
912
@@ -936,29 +935,29 @@ module Eff where
936 (>>=) = bindEff
935 (>>=) = bindEff
937
936
938 foreign import untilE "function untilE(f) {\
937 foreign import untilE "function untilE(f) {\
939− \ return function() {\
938+ \ return function() {\
940− \ while (!f()) { }\
939+ \ while (!f()) { }\
941− \ return {};\
940+ \ return {};\
942− \ };\
941+ \ };\
943 \}" :: forall e. Eff e Boolean -> Eff e {}
942 \}" :: forall e. Eff e Boolean -> Eff e {}
944
943
945 foreign import whileE "function whileE(f) {\
944 foreign import whileE "function whileE(f) {\
946− \ return function(a) {\
945+ \ return function(a) {\
947− \ return function() {\
946+ \ return function() {\
948− \ while (f()) {\
947+ \ while (f()) {\
949 \ a();\
948 \ a();\
950 \ }\
949 \ }\
951− \ return {};\
950+ \ return {};\
952 \ };\
951 \ };\
953 \ };\
952 \ };\
954 \}" :: forall e a. Eff e Boolean -> Eff e a -> Eff e {}
953 \}" :: forall e a. Eff e Boolean -> Eff e a -> Eff e {}
955
954
956 foreign import forE "function forE(lo) {\
955 foreign import forE "function forE(lo) {\
957− \ return function(hi) {\
956+ \ return function(hi) {\
958− \ return function(f) {\
957+ \ return function(f) {\
959− \ return function() {\
958+ \ return function() {\
960− \ for (var i = lo; i < hi; i++) {\
959+ \ for (var i = lo; i < hi; i++) {\
961− \ f(i)();\
960+ \ f(i)();\
962 \ }\
961 \ }\
963 \ };\
962 \ };\
964 \ };\
963 \ };\
@@ -967,9 +966,9 @@ module Eff where
967
966
968
967
969 foreign import foreachE "function foreachE(as) {\
968 foreign import foreachE "function foreachE(as) {\
970− \ return function(f) {\
969+ \ return function(f) {\
971− \ for (var i = 0; i < as.length; i++) {\
970+ \ for (var i = 0; i < as.length; i++) {\
972− \ f(as[i])();\
971+ \ f(as[i])();\
973 \ }\
972 \ }\
974 \ };\
973 \ };\
975 \}" :: forall e a. [a] -> (a -> Eff e {}) -> Eff e {}
974 \}" :: forall e a. [a] -> (a -> Eff e {}) -> Eff e {}
@@ -977,7 +976,7 @@ module Eff where
977
976
978module Random where
977module Random where
979
978
980− import Eff
979+ import Control.Monad.Eff
981
980
982 foreign import data Random :: !
981 foreign import data Random :: !
983
982
@@ -985,9 +984,9 @@ module Random where
985 \ return Math.random();\
984 \ return Math.random();\
986 \}" :: forall e. Eff (random :: Random | e) Number
985 \}" :: forall e. Eff (random :: Random | e) Number
987
986
988−module Errors where
987+module Control.Monad.Error where
989
988
990− import Eff
989+ import Control.Monad.Eff
991
990
992 foreign import data Error :: * -> !
991 foreign import data Error :: * -> !
993
992
@@ -1009,9 +1008,9 @@ module Errors where
1009 \ };\
1008 \ };\
1010 \}" :: forall e r a. (e -> Eff r a) -> Eff (err :: Error e | r) a -> Eff r a
1009 \}" :: forall e r a. (e -> Eff r a) -> Eff (err :: Error e | r) a -> Eff r a
1011
1010
1012−module IORef where
1011+module Data.IORef where
1013
1012
1014− import Eff
1013+ import Control.Monad.Eff
1015
1014
1016 foreign import data Ref :: !
1015 foreign import data Ref :: !
1017
1016
@@ -1052,10 +1051,10 @@ module IORef where
1052 \ return f;\
1051 \ return f;\
1053 \}" :: forall eff a. Eff (ref :: Ref | eff) a -> Eff eff a
1052 \}" :: forall eff a. Eff (ref :: Ref | eff) a -> Eff eff a
1054
1053
1055−module Trace where
1054+module Debug.Trace where
1056
1055
1057 import Prelude
1056 import Prelude
1058− import Eff
1057+ import Control.Monad.Eff
1059
1058
1060 foreign import data Trace :: !
1059 foreign import data Trace :: !
1061
1060
@@ -1069,9 +1068,9 @@ module Trace where
1069 print :: forall a r. (Prelude.Show a) => a -> Eff (trace :: Trace | r) {}
1068 print :: forall a r. (Prelude.Show a) => a -> Eff (trace :: Trace | r) {}
1070 print o = trace (show o)
1069 print o = trace (show o)
1071
1070
1072−module ST where
1071+module Control.Monad.ST where
1073
1072
1074− import Eff
1073+ import Control.Monad.Eff
1075
1074
1076 foreign import data ST :: * -> !
1075 foreign import data ST :: * -> !
1077
1076
@@ -1145,9 +1144,9 @@ module ST where
1145 \ return f;\
1144 \ return f;\
1146 \}" :: forall a r. (forall h. Eff (st :: ST h | r) (STArray h a)) -> Eff r [a]
1145 \}" :: forall a r. (forall h. Eff (st :: ST h | r) (STArray h a)) -> Eff r [a]
1147
1146
1148−module Enum where
1147+module Data.Enum where
1149
1148
1150− import Maybe
1149+ import Data.Maybe
1151
1150
1152 class Enum a where
1151 class Enum a where
1153 toEnum :: Number -> Maybe a
1152 toEnum :: Number -> Maybe a
src/Language/PureScript/CodeGen/Optimize.hs+1−1
@@ -316,7 +316,7 @@ magicDo' = everywhere (mkT undo) . everywhere' (mkT convert)
316 isEffFunc _ _ = False
316 isEffFunc _ _ = False
317 -- Module names
317 -- Module names
318 prelude = ModuleName [ProperName "Prelude"]
318 prelude = ModuleName [ProperName "Prelude"]
319− effModule = ModuleName [ProperName "Eff"]
319+ effModule = ModuleName [ProperName "Control", ProperName "Monad", ProperName "Eff"]
320 -- The name of the type class dictionary for the Monad Eff instance
320 -- The name of the type class dictionary for the Monad Eff instance
321 Right (Ident effDictName) = mkDictionaryValueName
321 Right (Ident effDictName) = mkDictionaryValueName
322 effModule
322 effModule
src/Language/PureScript/TypeChecker/Types.hs+1−1
@@ -208,7 +208,7 @@ typesOf mainModuleName moduleName vals = do
208 -- If --main is enabled, need to check that `main` has type Eff eff a for some eff, a
208 -- If --main is enabled, need to check that `main` has type Eff eff a for some eff, a
209 when (Just moduleName == mainModuleName && fst e == Ident "main") $ do
209 when (Just moduleName == mainModuleName && fst e == Ident "main") $ do
210 [eff, a] <- replicateM 2 fresh
210 [eff, a] <- replicateM 2 fresh
211− ty =?= TypeApp (TypeApp (TypeConstructor (Qualified (Just (ModuleName [ProperName "Eff"])) (ProperName "Eff"))) eff) a
211+ ty =?= TypeApp (TypeApp (TypeConstructor (Qualified (Just (ModuleName [ProperName "Control", ProperName "Monad", ProperName "Eff"])) (ProperName "Eff"))) eff) a
212 -- Make sure unification variables do not escape
212 -- Make sure unification variables do not escape
213 escapeCheck val ty
213 escapeCheck val ty
214 return triple
214 return triple