git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'master' of github.com:purescript/purescript into psci-fixes

Conflicts: psci/Main.hs

commit6d74b8c900907a13881430f2bdab725f8d0e5dc1 authorjoneshf <jones3.hardy@gmail.com> dateFri 21 Feb 2014, 15:37 (13 years ago) parent4e87a31e1931d6
79 files changed+403−296
RELEASE-0.5.md+12−2 docs/source/prelude.rst+116−48 examples/failing/Arrays.purs+1−1 examples/failing/LocalVars.purs−8 examples/failing/PatternScope.purs−12 examples/failing/Shadowed.purs−14 examples/failing/SkolemEscape2.purs+2−2 examples/passing/Applicative.purs+1−1 examples/passing/ArrayType.purs+1−1 examples/passing/Arrays.purs+4−4 examples/passing/Auto.purs+1−1 examples/passing/BindersInFunctions.purs+3−3 examples/passing/Church.purs+1−1 examples/passing/Collatz.purs+3−3 examples/passing/Conditional.purs+1−1 examples/passing/Cons.purs+2−2 examples/passing/Console.purs+2−2 examples/passing/DataAndType.purs+1−1 examples/passing/DataImport.purs+1−1 examples/passing/Do.purs+1−1 examples/passing/Dollar.purs+1−1 examples/passing/DottedModules.purs+1−1 examples/passing/Eff.purs+7−7 examples/passing/ExternData.purs+1−1 examples/passing/ExternRaw.purs+1−1 examples/passing/FFI.purs+1−1 examples/passing/FunctionScope.purs+2−2 examples/passing/Functions.purs+1−1 examples/passing/Functions2.purs+2−2 examples/passing/Guards.purs+1−1 examples/passing/Import.purs+1−1 examples/passing/InferRecFunWithConstrainedArgument.purs+1−1 examples/passing/JSReserved.purs+2−2 examples/passing/Let.purs+4−4 examples/passing/List.purs+3−3 examples/passing/Match.purs+1−1 examples/passing/Math.purs+2−2 examples/passing/Maybe.purs+2−2 examples/passing/Module.purs+1−1 examples/passing/ModuleDeps.purs+1−1 examples/passing/Monad.purs+1−1 examples/passing/MultipleConstructorArgs.purs+5−5 examples/passing/MutRec.purs+1−1 examples/passing/NamedPatterns.purs+1−1 examples/passing/Nested.purs+1−1 examples/passing/NestedTypeSynonyms.purs+1−1 examples/passing/ObjectSynonym.purs+1−1 examples/passing/ObjectUpdate.purs+1−1 examples/passing/Objects.purs+1−1 examples/passing/OneConstructor.purs+1−1 examples/passing/Operators.purs+3−3 examples/passing/OptimizerBug.purs+1−1 examples/passing/Patterns.purs+1−1 examples/passing/Person.purs+1−1 examples/passing/Rank2Data.purs+1−1 examples/passing/Rank2Types.purs+1−1 examples/passing/Recursion.purs+1−1 examples/passing/RedefinedFixity.purs+1−1 examples/passing/RuntimeScopeIssue.purs+1−1 examples/passing/STArray.purs+4−4 examples/passing/TailCall.purs+1−1 examples/passing/Tick.purs+1−1 examples/passing/TopLevelCase.purs+1−1 examples/passing/TypeClasses.purs+1−1 examples/passing/TypeClassesInOrder.purs+1−1 examples/passing/TypeClassesWithOverlappingTypeVariables.purs+2−2 examples/passing/TypeDecl.purs+1−1 examples/passing/TypeSynonyms.purs+3−2 examples/passing/iota.purs+1−1 examples/passing/s.purs+1−1 prelude/README.md+97−35 prelude/prelude.purs+62−63 psci/Commands.hs+1−1 psci/Main.hs+7−7 psci/Parser.hs+1−1 src/Language/PureScript/CodeGen/Common.hs+2 src/Language/PureScript/CodeGen/Optimize.hs+1−1 src/Language/PureScript/Parser/Common.hs−1 src/Language/PureScript/TypeChecker/Types.hs+1−1
RELEASE-0.5.md+12−2
@@ -6,21 +6,31 @@
66
77### New Features
88
9−-
9+- `let ... in` syntax for bindings (paf31)
1010
1111### Enhancements
1212
1313- Pretty printing for row types was improved (garyb)
1414- Module names can now contain `.` (garyb)
15+- Prelude modules now follow a naming scheme similar to haskell (e.g. `Data.Maybe`, `Control.Monad`) (garyb)
1516- New optimizer rules have been added for code in the ST monad, to reproduce the functionality of the blocks feature, which has been removed (paf31)
17+- Pattern binders are now usable in lambda expression arguments (paf31)
18+- PSCI now has a `:t` command for checking the type of a value (paf31)
19+- Array pretty printing via `show` has been improved (joneshf)
20+- PSCI completions are sorted (joneshf)
21+- PSCI now has help commands (joneshf)
22+- PSCI history is in XDG config (joneshf)
23+- PSCI allows loading of modules from ~ paths (joneshf)
1624
1725### Bug Fixes
1826
1927- The subsumes relation has been fixed for object types (paf31)
28+- `sort` no longer mutates arrays (joneshf)
29+- PSCI evaluates expressions (joneshf)
2030
2131### Libraries
2232
23−-
33+- The [purescript-date](https://github.com/purescript/purescript-date) library provides basic date/time functions
2434
2535### Documentation
2636
docs/source/prelude.rst+116−48
@@ -139,6 +139,8 @@ Values
139139
140140 flip :: forall c. forall b. forall a. (a -> b -> c) -> b -> a -> c
141141
142+ liftRef :: forall b. forall a. (a -> a -> b) -> Ref a -> Ref a -> b
143+
142144 numAdd :: Prim.Number -> Prim.Number -> Prim.Number
143145
144146 numAnd :: Prim.Number -> Prim.Number -> Prim.Number
@@ -185,8 +187,8 @@ Values
185187
186188 unsafeRefIneq :: forall a. a -> a -> Prim.Boolean
187189
188−Module Monoid
189−-------------
190+Module Data.Monoid
191+------------------
190192
191193Types
192194~~~~~
@@ -216,8 +218,8 @@ Values
216218
217219 mconcat :: forall m. (Monoid (m)) => [m] -> m
218220
219−Module Monad
220−------------
221+Module Control.Monad
222+--------------------
221223
222224Types
223225~~~~~
@@ -249,8 +251,8 @@ Values
249251
250252 when :: forall m. (Monad (m)) => Prim.Boolean -> m { } -> m { }
251253
252−Module Maybe
253−------------
254+Module Data.Maybe
255+-----------------
254256
255257Types
256258~~~~~
@@ -286,8 +288,8 @@ Values
286288
287289 maybe :: forall b. forall a. b -> (a -> b) -> Maybe a -> b
288290
289−Module Either
290−-------------
291+Module Data.Either
292+------------------
291293
292294Types
293295~~~~~
@@ -321,8 +323,8 @@ Values
321323
322324 either :: forall c. forall b. forall a. (a -> c) -> (b -> c) -> Either a b -> c
323325
324−Module Arrays
325−-------------
326+Module Data.Array
327+-----------------
326328
327329Types
328330~~~~~
@@ -360,13 +362,13 @@ Values
360362
361363 filter :: forall a. (a -> Prim.Boolean) -> [a] -> [a]
362364
365+ find :: forall a. (a -> Prim.Boolean) -> [a] -> Maybe a
366+
363367 foldl :: forall b. forall a. (a -> b -> b) -> b -> [a] -> b
364368
365369 foldr :: forall b. forall a. (a -> b -> a) -> a -> [b] -> a
366370
367− head :: forall a. [a] -> a
368−
369− headSafe :: forall a. [a] -> Maybe a
371+ head :: forall a. [a] -> Maybe a
370372
371373 indexOf :: forall a. [a] -> a -> Prim.Number
372374
@@ -398,14 +400,33 @@ Values
398400
399401 splice :: forall a. Prim.Number -> Prim.Number -> [a] -> [a] -> [a]
400402
401− tail :: forall a. [a] -> [a]
402−
403− tailSafe :: forall a. [a] -> Maybe [a]
403+ tail :: forall a. [a] -> Maybe [a]
404404
405405 zipWith :: forall c. forall b. forall a. (a -> b -> c) -> [a] -> [b] -> [c]
406406
407−Module Tuples
408−-------------
407+Module Data.Array.Unsafe
408+------------------------
409+
410+Types
411+~~~~~
412+
413+Type Classes
414+~~~~~~~~~~~~
415+
416+Type Class Instances
417+~~~~~~~~~~~~~~~~~~~~
418+
419+Values
420+~~~~~~
421+
422+::
423+
424+ head :: forall a. [a] -> a
425+
426+ tail :: forall a. [a] -> [a]
427+
428+Module Data.Tuple
429+-----------------
409430
410431Types
411432~~~~~
@@ -438,8 +459,8 @@ Values
438459
439460 zip :: forall b. forall a. [a] -> [b] -> [Tuple a b]
440461
441−Module String
442−-------------
462+Module Data.String
463+------------------
443464
444465Types
445466~~~~~
@@ -481,8 +502,8 @@ Values
481502
482503 trim :: Prim.String -> Prim.String
483504
484−Module Regex
485−------------
505+Module Data.String.Regex
506+------------------------
486507
487508Types
488509~~~~~
@@ -586,16 +607,28 @@ Values
586607
587608 cos :: Prim.Number -> Prim.Number
588609
610+ e :: Prim.Number
611+
589612 exp :: Prim.Number -> Prim.Number
590613
591614 floor :: Prim.Number -> Prim.Number
592615
616+ ln10 :: Prim.Number
617+
618+ ln2 :: Prim.Number
619+
593620 log :: Prim.Number -> Prim.Number
594621
622+ log10e :: Prim.Number
623+
624+ log2e :: Prim.Number
625+
595626 max :: Prim.Number -> Prim.Number
596627
597628 min :: Prim.Number -> Prim.Number
598629
630+ pi :: Prim.Number
631+
599632 pow :: Prim.Number -> Prim.Number
600633
601634 round :: Prim.Number -> Prim.Number
@@ -604,10 +637,14 @@ Values
604637
605638 sqrt :: Prim.Number -> Prim.Number
606639
640+ sqrt1_2 :: Prim.Number
641+
642+ sqrt2 :: Prim.Number
643+
607644 tan :: Prim.Number -> Prim.Number
608645
609−Module Eff
610−----------
646+Module Control.Monad.Eff
647+------------------------
611648
612649Types
613650~~~~~
@@ -645,7 +682,7 @@ Values
645682
646683 untilE :: forall e. Eff e Prim.Boolean -> Eff e { }
647684
648− whileE :: forall e. Eff e Prim.Boolean -> Eff e { } -> Eff e { }
685+ whileE :: forall a. forall e. Eff e Prim.Boolean -> Eff e a -> Eff e { }
649686
650687Module Random
651688-------------
@@ -668,10 +705,10 @@ Values
668705
669706::
670707
671− random :: forall e. Eff random :: Random | e Prim.Number
708+ random :: forall e. Eff (random :: Random | e) Prim.Number
672709
673−Module Errors
674−-------------
710+Module Control.Monad.Error
711+--------------------------
675712
676713Types
677714~~~~~
@@ -691,12 +728,12 @@ Values
691728
692729::
693730
694− catchError :: forall a. forall r. forall e. (e -> Eff r a) -> Eff err :: Error e | r a -> Eff r a
731+ catchError :: forall a. forall r. forall e. (e -> Eff r a) -> Eff (err :: Error e | r) a -> Eff r a
695732
696− throwError :: forall r. forall e. forall a. e -> Eff err :: Error e | r a
733+ throwError :: forall r. forall e. forall a. e -> Eff (err :: Error e | r) a
697734
698−Module IORef
699−------------
735+Module Data.IORef
736+-----------------
700737
701738Types
702739~~~~~
@@ -718,18 +755,18 @@ Values
718755
719756::
720757
721− modifyIORef :: forall r. forall s. IORef s -> (s -> s) -> Eff ref :: Ref | r { }
758+ modifyIORef :: forall r. forall s. IORef s -> (s -> s) -> Eff (ref :: Ref | r) { }
722759
723− newIORef :: forall r. forall s. s -> Eff ref :: Ref | r (IORef s)
760+ newIORef :: forall r. forall s. s -> Eff (ref :: Ref | r) (IORef s)
724761
725− readIORef :: forall r. forall s. IORef s -> Eff ref :: Ref | r s
762+ readIORef :: forall r. forall s. IORef s -> Eff (ref :: Ref | r) s
726763
727− unsafeRunIORef :: forall a. forall eff. Eff ref :: Ref | eff a -> Eff eff a
764+ unsafeRunIORef :: forall a. forall eff. Eff (ref :: Ref | eff) a -> Eff eff a
728765
729− writeIORef :: forall r. forall s. IORef s -> s -> Eff ref :: Ref | r { }
766+ writeIORef :: forall r. forall s. IORef s -> s -> Eff (ref :: Ref | r) { }
730767
731−Module Trace
732−------------
768+Module Debug.Trace
769+------------------
733770
734771Types
735772~~~~~
@@ -749,12 +786,12 @@ Values
749786
750787::
751788
752− print :: forall r. forall a. (Prelude.Show (a)) => a -> Eff trace :: Trace | r { }
789+ print :: forall r. forall a. (Prelude.Show (a)) => a -> Eff (trace :: Trace | r) { }
753790
754− trace :: forall r. Prim.String -> Eff trace :: Trace | r { }
791+ trace :: forall r. Prim.String -> Eff (trace :: Trace | r) { }
755792
756−Module ST
757−---------
793+Module Control.Monad.ST
794+-----------------------
758795
759796Types
760797~~~~~
@@ -763,6 +800,8 @@ Types
763800
764801 data ST :: * -> !
765802
803+ data STArray :: * -> * -> *
804+
766805 data STRef :: * -> * -> *
767806
768807Type Classes
@@ -776,13 +815,42 @@ Values
776815
777816::
778817
779− modifySTRef :: forall r. forall h. forall a. STRef h a -> (a -> a) -> Eff st :: ST h | r { }
818+ modifySTRef :: forall r. forall h. forall a. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a
819+
820+ newSTArray :: forall r. forall h. forall a. Prim.Number -> a -> Eff (st :: ST h | r) (STArray h a)
821+
822+ newSTRef :: forall r. forall h. forall a. a -> Eff (st :: ST h | r) (STRef h a)
823+
824+ peekSTArray :: forall r. forall h. forall a. STArray h a -> Eff (st :: ST h | r) a
825+
826+ pokeSTArray :: forall r. forall h. forall a. STArray h a -> Prim.Number -> a -> Eff (st :: ST h | r) a
827+
828+ readSTRef :: forall r. forall h. forall a. STRef h a -> Eff (st :: ST h | r) a
780829
781− newSTRef :: forall r. forall h. forall a. a -> Eff st :: ST h | r (STRef h a)
830+ runST :: forall r. forall a. forall h. Eff (st :: ST h | r) a -> Eff r a
782831
783− readSTRef :: forall r. forall h. forall a. STRef h a -> Eff st :: ST h | r a
832+ runSTArray :: forall r. forall a. forall h. Eff (st :: ST h | r) (STArray h a) -> Eff r [a]
784833
785− runST :: forall r. forall a. forall h. Eff st :: ST h | r a -> Eff r a
834+ writeSTRef :: forall r. forall h. forall a. STRef h a -> a -> Eff (st :: ST h | r) a
786835
787− writeSTRef :: forall r. forall h. forall a. STRef h a -> a -> Eff st :: ST h | r { }
836+Module Data.Enum
837+----------------
838+
839+Types
840+~~~~~
841+
842+Type Classes
843+~~~~~~~~~~~~
844+
845+::
846+
847+ class Enum a where
848+ toEnum :: Prim.Number -> Maybe a
849+ fromEnum :: a -> Prim.Number
850+
851+Type Class Instances
852+~~~~~~~~~~~~~~~~~~~~
853+
854+Values
855+~~~~~~
788856
examples/failing/Arrays.purs+1−1
@@ -1,4 +1,4 @@
1−module Arrays where
1+module Data.Array where
22
33 import Prelude
44
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 @@
11module SkolemEscape where
22
33import Prelude
4−import Eff
5−import ST
4+import Control.Monad.Eff
5+import Control.Monad.ST
66
77test _ = do
88 r <- runST (newSTRef 0)
examples/passing/Applicative.purs+1−1
@@ -13,4 +13,4 @@ instance Applicative Maybe where
1313
1414module Main where
1515
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/ArrayType.purs+1−1
@@ -14,4 +14,4 @@ instance Functor [] where
1414
1515module Main where
1616
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
22
33import Prelude
44
@@ -23,12 +23,12 @@ test4 = \arr -> case arr of
2323
2424module Main where
2525
26−import Arrays
26+import Data.Array
2727import Prelude
2828
2929main = do
3030 let x = [3,2,1]
3131 let y = sort x
3232 if x == [3,2,1]
33− then Trace.trace "Done"
34− else Errors.throwError "Not done"
33+ then Debug.Trace.trace "Done"
34+ else Control.Monad.Error.throwError "Not done"
examples/passing/Auto.purs+1−1
@@ -12,4 +12,4 @@ module Auto where
1212
1313module Main where
1414
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/BindersInFunctions.purs+3−3
@@ -1,12 +1,12 @@
11module Main where
22
33import Prelude
4−import Arrays
4+import Data.Array
55
66tails = map (\(_:xs) -> xs)
77
88main =
99 let ts = tails [[1, 2, 3], [4, 5], [6]] in
1010 if ts == [[2, 3], [5], []]
11− then Trace.trace "Done"
12− else Errors.throwError "Incorrect result from 'tails'."
11+ then Debug.Trace.trace "Done"
12+ else Control.Monad.Error.throwError "Incorrect result from 'tails'."
examples/passing/Church.purs+1−1
@@ -15,4 +15,4 @@ module Church where
1515
1616module Main where
1717
18−main = Trace.trace "Done"
18+main = Debug.Trace.trace "Done"
examples/passing/Collatz.purs+3−3
@@ -1,8 +1,8 @@
11module Main where
22
33import Prelude
4−import Eff
5−import ST
4+import Control.Monad.Eff
5+import Control.Monad.ST
66
77collatz :: Number -> Number
88collatz n = runPure (runST (do
@@ -15,4 +15,4 @@ collatz n = runPure (runST (do
1515 return $ m == 1
1616 readSTRef count))
1717
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
66
77module Main where
88
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Cons.purs+2−2
@@ -1,7 +1,7 @@
11module Cons where
22
33 import Prelude
4− import Arrays
4+ import Data.Array
55
66 test1 = \xs -> 1 : xs
77
@@ -9,4 +9,4 @@ module Cons where
99
1010module Main where
1111
12−main = Trace.trace "Done"
12+main = Debug.Trace.trace "Done"
examples/passing/Console.purs+2−2
@@ -1,8 +1,8 @@
11module Main where
22
33import Prelude
4−import Eff
5−import Trace
4+import Control.Monad.Eff
5+import Debug.Trace
66
77replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
88replicateM_ 0 _ = return {}
examples/passing/DataAndType.purs+1−1
@@ -6,4 +6,4 @@ type B = A
66
77module Main where
88
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
1010
1111main = do
1212 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
4646
4747module Main where
4848
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
1313
1414module Main where
1515
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/DottedModules.purs+1−1
@@ -17,4 +17,4 @@ module Main where
1717
1818 unwrap (Text x) = x
1919
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 @@
11module TestEff where
22
33import Prelude
4−import Eff
5−import ST
6−import Errors
7−import Trace
4+import Control.Monad.Eff
5+import Control.Monad.ST
6+import Control.Monad.Error
7+import Debug.Trace
88
99test1 = catchError (\s -> return 0) $ do
1010 trace "Testing"
@@ -18,10 +18,10 @@ test2 = runPure (runST (do
1818module Main where
1919
2020import Prelude
21−import Eff
21+import Control.Monad.Eff
2222import TestEff
2323
2424main = do
2525 n <- test1
26− Trace.print n
27− Trace.print test2
26+ Debug.Trace.print n
27+ Debug.Trace.print test2
examples/passing/ExternData.purs+1−1
@@ -16,4 +16,4 @@ module ExternData where
1616
1717module Main where
1818
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) { \
1212
1313module Main where
1414
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/FFI.purs+1−1
@@ -13,4 +13,4 @@ baz _ = foo "test"
1313
1414module Main where
1515
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/FunctionScope.purs+2−2
@@ -13,5 +13,5 @@ module Main where
1313 main = do
1414 let value = mkValue 1
1515 if value == 1
16− then Trace.trace "Done"
17− else Errors.throwError "Not done"
16+ then Debug.Trace.trace "Done"
17+ else Control.Monad.Error.throwError "Not done"
examples/passing/Functions.purs+1−1
@@ -14,4 +14,4 @@ module Functions where
1414
1515module Main where
1616
17−main = Trace.trace "Done"
17+main = Debug.Trace.trace "Done"
examples/passing/Functions2.purs+2−2
@@ -13,5 +13,5 @@ module Main where
1313 main = do
1414 let value = test "Done" {}
1515 if value == "Done"
16− then Trace.trace "Done"
17− else Errors.throwError "Not done"
16+ then Debug.Trace.trace "Done"
17+ else Control.Monad.Error.throwError "Not done"
examples/passing/Guards.purs+1−1
@@ -13,4 +13,4 @@ module Guards where
1313
1414module Main where
1515
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/Import.purs+1−1
@@ -13,4 +13,4 @@ module M2 where
1313
1414module Main where
1515
16−main = Trace.trace "Done"
16+main = Debug.Trace.trace "Done"
examples/passing/InferRecFunWithConstrainedArgument.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55test 100 = 100
66test n = test(1 + n)
77
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
1212module Main where
1313
1414 import Prelude
15− import Arrays
15+ import Data.Array
1616 import JSReserved
1717
18− main = Trace.print [ yield
18+ main = Debug.Trace.print [ yield
1919 , member
2020 , this 1
2121 , public 1 ]
examples/passing/Let.purs+4−4
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Eff
4+import Control.Monad.Eff
55
66test1 x = let y = x + 1 in y
77
@@ -13,6 +13,6 @@ test2 x y =
1313test3 x = let 1 = x in 2
1414
1515main = do
16− Trace.print (test1 1)
17− Trace.print (test2 1 2)
18− Trace.print (test3 1)
16+ Debug.Trace.print (test1 1)
17+ Debug.Trace.print (test2 1 2)
18+ Debug.Trace.print (test3 1)
examples/passing/List.purs+3−3
@@ -1,10 +1,10 @@
11module Main where
22
33import Prelude
4−import Eff
5−import Arrays
4+import Control.Monad.Eff
5+import Data.Array
66import Global
77
88main = do
99 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
66
77module Main where
88
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Math.purs+2−2
@@ -1,8 +1,8 @@
11module Main where
22
33 import Prelude
4− import Trace
5− import Eff
4+ import Debug.Trace
5+ import Control.Monad.Eff
66
77 main = do
88 print $ Math.sin 0
examples/passing/Maybe.purs+2−2
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Maybe
4+import Data.Maybe
55import Global
66
77main = do
@@ -9,4 +9,4 @@ main = do
99 a <- Just 1
1010 b <- Just 2
1111 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
2525
2626module Main where
2727
28−main = Trace.trace "Done"
28+main = Debug.Trace.trace "Done"
examples/passing/ModuleDeps.purs+1−1
@@ -14,4 +14,4 @@ baz = 1
1414
1515module Main where
1616
17−main = Trace.trace "Done"
17+main = Debug.Trace.trace "Done"
examples/passing/Monad.purs+1−1
@@ -29,4 +29,4 @@ module MonadTest where
2929
3030module Main where
3131
32−main = Trace.trace "Done"
32+main = Debug.Trace.trace "Done"
examples/passing/MultipleConstructorArgs.purs+5−5
@@ -1,6 +1,6 @@
11module MultipleConstructorArgs where
22
3−import Arrays
3+import Data.Array
44
55data P a b = P a b
66
@@ -20,9 +20,9 @@ module Main where
2020import Prelude
2121import MultipleConstructorArgs
2222import Global
23−import Eff
24−import Arrays
23+import Control.Monad.Eff
24+import Data.Array
2525
2626main = do
27− Trace.trace (runP (\s n -> s ++ show n) (P "Test" 1))
28− Trace.print test1
27+ Debug.Trace.trace (runP (\s n -> s ++ show n) (P "Test" 1))
28+ Debug.Trace.print test1
examples/passing/MutRec.purs+1−1
@@ -18,4 +18,4 @@ module MutRec where
1818
1919module Main where
2020
21−main = Trace.trace "Done"
21+main = Debug.Trace.trace "Done"
examples/passing/NamedPatterns.purs+1−1
@@ -6,4 +6,4 @@ module NamedPatterns where
66
77module Main where
88
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Nested.purs+1−1
@@ -6,4 +6,4 @@ module Nested where
66
77module Main where
88
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/NestedTypeSynonyms.purs+1−1
@@ -10,4 +10,4 @@ module Main where
1010
1111 import Prelude
1212
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 }
1212
1313module Main where
1414
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/ObjectUpdate.purs+1−1
@@ -17,4 +17,4 @@ module ObjectUpdate where
1717
1818module Main where
1919
20−main = Trace.trace "Done"
20+main = Debug.Trace.trace "Done"
examples/passing/Objects.purs+1−1
@@ -17,4 +17,4 @@ module Objects where
1717
1818module Main where
1919
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
66
77module Main where
88
9−main = Trace.trace "Done"
9+main = Debug.Trace.trace "Done"
examples/passing/Operators.purs+3−3
@@ -60,10 +60,10 @@ import Operators1
6060import Operators2
6161
6262import Prelude
63−import Eff
64−import Trace
63+import Control.Monad.Eff
64+import Debug.Trace
6565import Global
66−import Arrays
66+import Data.Array
6767
6868main =
6969 print [ show $ test1 1 2 $ \x y -> x + y
examples/passing/OptimizerBug.purs+1−1
@@ -8,4 +8,4 @@ y a = x a
88
99module Main where
1010
11−main = Trace.trace "Done"
11+main = Debug.Trace.trace "Done"
examples/passing/Patterns.purs+1−1
@@ -27,4 +27,4 @@ module Patterns where
2727
2828module Main where
2929
30−main = Trace.trace "Done"
30+main = Debug.Trace.trace "Done"
examples/passing/Person.purs+1−1
@@ -12,4 +12,4 @@ module Person where
1212
1313module Main where
1414
15−main = Trace.trace "Done"
15+main = Debug.Trace.trace "Done"
examples/passing/Rank2Data.purs+1−1
@@ -28,4 +28,4 @@ module Rank2Data where
2828
2929module Main where
3030
31−main = Trace.trace "Done"
31+main = Debug.Trace.trace "Done"
examples/passing/Rank2Types.purs+1−1
@@ -22,4 +22,4 @@ module Rank2Types where
2222
2323module Main where
2424
25−main = Trace.trace "Done"
25+main = Debug.Trace.trace "Done"
examples/passing/Recursion.purs+1−1
@@ -9,4 +9,4 @@ module Recursion where
99
1010module Main where
1111
12−main = Trace.trace "Done"
12+main = Debug.Trace.trace "Done"
examples/passing/RedefinedFixity.purs+1−1
@@ -15,4 +15,4 @@ import M2
1515
1616module Main where
1717
18−main = Trace.trace "Done"
18+main = Debug.Trace.trace "Done"
examples/passing/RuntimeScopeIssue.purs+1−1
@@ -22,4 +22,4 @@ import RuntimeScopeIssue
2222
2323import Prelude
2424
25−main = Trace.print $ a 10
25+main = Debug.Trace.print $ a 10
examples/passing/STArray.purs+4−4
@@ -1,9 +1,9 @@
11module Main where
22
33import Prelude
4−import Eff
5−import ST
6−import Arrays
4+import Control.Monad.Eff
5+import Control.Monad.ST
6+import Data.Array
77
88test = runSTArray (do
99 a <- newSTArray 2 0
@@ -20,4 +20,4 @@ fromTo lo hi = runSTArray (do
2020 arr <- newSTArray (hi - lo + 1) 0
2121 fromTo' lo hi 0 arr)
2222
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
1717import Prelude
1818import TailCall
1919
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
44
55module Main where
66
7−main = Trace.trace "Done"
7+main = Debug.Trace.trace "Done"
examples/passing/TopLevelCase.purs+1−1
@@ -17,4 +17,4 @@ module TopLevelCase where
1717
1818module Main where
1919
20−main = Trace.trace "Done"
20+main = Debug.Trace.trace "Done"
examples/passing/TypeClasses.purs+1−1
@@ -65,5 +65,5 @@ module Main where
6565import Prelude
6666import TypeClasses
6767
68−main = Trace.trace (test7 "Done")
68+main = Debug.Trace.trace (test7 "Done")
6969
examples/passing/TypeClassesInOrder.purs+1−1
@@ -8,4 +8,4 @@ class Foo a where
88instance Foo String where
99 foo s = s
1010
11−main = Trace.trace $ foo "Done"
11+main = Debug.Trace.trace $ foo "Done"
examples/passing/TypeClassesWithOverlappingTypeVariables.purs+2−2
@@ -1,10 +1,10 @@
11module Main where
22
33 import Prelude
4− import Either
4+ import Data.Either
55
66 instance Prelude.Functor (Either a) where
77 (<$>) _ (Left x) = Left x
88 (<$>) f (Right y) = Right (f y)
99
10− main = Trace.trace "Done"
10+ main = Debug.Trace.trace "Done"
examples/passing/TypeDecl.purs+1−1
@@ -11,4 +11,4 @@ module TypeDecl where
1111
1212module Main where
1313
14−main = Trace.trace "Done"
14+main = Debug.Trace.trace "Done"
examples/passing/TypeSynonyms.purs+3−2
@@ -22,7 +22,8 @@ module TypeSynonyms where
2222 test1 :: forall a b c. Lens (Pair (Pair a b) c) a
2323 test1 = composeLenses fst fst
2424
25− import Arrays
25+ import Data.Array ((:))
26+ import Data.Array.Unsafe
2627
2728 headLens :: forall a. Lens [a] a
2829 headLens =
@@ -36,4 +37,4 @@ module TypeSynonyms where
3637
3738module Main where
3839
39−main = Trace.trace "Done"
40+main = Debug.Trace.trace "Done"
examples/passing/iota.purs+1−1
@@ -8,4 +8,4 @@ module Iota where
88
99module Main where
1010
11−main = Trace.trace "Done"
11+main = Debug.Trace.trace "Done"
examples/passing/s.purs+1−1
@@ -4,4 +4,4 @@ module S where
44
55module Main where
66
7−main = Trace.trace "Done"
7+main = Debug.Trace.trace "Done"
prelude/README.md+97−35
@@ -127,6 +127,8 @@
127127
128128 flip :: forall c. forall b. forall a. (a -> b -> c) -> b -> a -> c
129129
130+ liftRef :: forall b. forall a. (a -> a -> b) -> Ref a -> Ref a -> b
131+
130132 numAdd :: Prim.Number -> Prim.Number -> Prim.Number
131133
132134 numAnd :: Prim.Number -> Prim.Number -> Prim.Number
@@ -174,7 +176,7 @@
174176 unsafeRefIneq :: forall a. a -> a -> Prim.Boolean
175177
176178
177−## Module Monoid
179+## Module Data.Monoid
178180
179181### Types
180182
@@ -198,7 +200,7 @@
198200 mconcat :: forall m. (Monoid (m)) => [m] -> m
199201
200202
201−## Module Monad
203+## Module Control.Monad
202204
203205### Types
204206
@@ -228,7 +230,7 @@
228230 when :: forall m. (Monad (m)) => Prim.Boolean -> m { } -> m { }
229231
230232
231−## Module Maybe
233+## Module Data.Maybe
232234
233235### Types
234236
@@ -258,7 +260,7 @@
258260 maybe :: forall b. forall a. b -> (a -> b) -> Maybe a -> b
259261
260262
261−## Module Either
263+## Module Data.Either
262264
263265### Types
264266
@@ -286,7 +288,7 @@
286288 either :: forall c. forall b. forall a. (a -> c) -> (b -> c) -> Either a b -> c
287289
288290
289−## Module Arrays
291+## Module Data.Array
290292
291293### Types
292294
@@ -319,13 +321,13 @@
319321
320322 filter :: forall a. (a -> Prim.Boolean) -> [a] -> [a]
321323
324+ find :: forall a. (a -> Prim.Boolean) -> [a] -> Maybe a
325+
322326 foldl :: forall b. forall a. (a -> b -> b) -> b -> [a] -> b
323327
324328 foldr :: forall b. forall a. (a -> b -> a) -> a -> [b] -> a
325329
326− head :: forall a. [a] -> a
327−
328− headSafe :: forall a. [a] -> Maybe a
330+ head :: forall a. [a] -> Maybe a
329331
330332 indexOf :: forall a. [a] -> a -> Prim.Number
331333
@@ -357,14 +359,30 @@
357359
358360 splice :: forall a. Prim.Number -> Prim.Number -> [a] -> [a] -> [a]
359361
360− tail :: forall a. [a] -> [a]
361−
362− tailSafe :: forall a. [a] -> Maybe [a]
362+ tail :: forall a. [a] -> Maybe [a]
363363
364364 zipWith :: forall c. forall b. forall a. (a -> b -> c) -> [a] -> [b] -> [c]
365365
366366
367−## Module Tuples
367+## Module Data.Array.Unsafe
368+
369+### Types
370+
371+
372+### Type Classes
373+
374+
375+### Type Class Instances
376+
377+
378+### Values
379+
380+ head :: forall a. [a] -> a
381+
382+ tail :: forall a. [a] -> [a]
383+
384+
385+## Module Data.Tuple
368386
369387### Types
370388
@@ -391,7 +409,7 @@
391409 zip :: forall b. forall a. [a] -> [b] -> [Tuple a b]
392410
393411
394−## Module String
412+## Module Data.String
395413
396414### Types
397415
@@ -431,7 +449,7 @@
431449 trim :: Prim.String -> Prim.String
432450
433451
434−## Module Regex
452+## Module Data.String.Regex
435453
436454### Types
437455
@@ -524,16 +542,28 @@
524542
525543 cos :: Prim.Number -> Prim.Number
526544
545+ e :: Prim.Number
546+
527547 exp :: Prim.Number -> Prim.Number
528548
529549 floor :: Prim.Number -> Prim.Number
530550
551+ ln10 :: Prim.Number
552+
553+ ln2 :: Prim.Number
554+
531555 log :: Prim.Number -> Prim.Number
532556
557+ log10e :: Prim.Number
558+
559+ log2e :: Prim.Number
560+
533561 max :: Prim.Number -> Prim.Number
534562
535563 min :: Prim.Number -> Prim.Number
536564
565+ pi :: Prim.Number
566+
537567 pow :: Prim.Number -> Prim.Number
538568
539569 round :: Prim.Number -> Prim.Number
@@ -542,10 +572,14 @@
542572
543573 sqrt :: Prim.Number -> Prim.Number
544574
575+ sqrt1_2 :: Prim.Number
576+
577+ sqrt2 :: Prim.Number
578+
545579 tan :: Prim.Number -> Prim.Number
546580
547581
548−## Module Eff
582+## Module Control.Monad.Eff
549583
550584### Types
551585
@@ -576,7 +610,7 @@
576610
577611 untilE :: forall e. Eff e Prim.Boolean -> Eff e { }
578612
579− whileE :: forall e. Eff e Prim.Boolean -> Eff e { } -> Eff e { }
613+ whileE :: forall a. forall e. Eff e Prim.Boolean -> Eff e a -> Eff e { }
580614
581615
582616## Module Random
@@ -594,10 +628,10 @@
594628
595629### Values
596630
597− random :: forall e. Eff random :: Random | e Prim.Number
631+ random :: forall e. Eff (random :: Random | e) Prim.Number
598632
599633
600−## Module Errors
634+## Module Control.Monad.Error
601635
602636### Types
603637
@@ -612,12 +646,12 @@
612646
613647### Values
614648
615− catchError :: forall a. forall r. forall e. (e -> Eff r a) -> Eff err :: Error e | r a -> Eff r a
649+ catchError :: forall a. forall r. forall e. (e -> Eff r a) -> Eff (err :: Error e | r) a -> Eff r a
616650
617− throwError :: forall r. forall e. forall a. e -> Eff err :: Error e | r a
651+ throwError :: forall r. forall e. forall a. e -> Eff (err :: Error e | r) a
618652
619653
620−## Module IORef
654+## Module Data.IORef
621655
622656### Types
623657
@@ -634,18 +668,18 @@
634668
635669### Values
636670
637− modifyIORef :: forall r. forall s. IORef s -> (s -> s) -> Eff ref :: Ref | r { }
671+ modifyIORef :: forall r. forall s. IORef s -> (s -> s) -> Eff (ref :: Ref | r) { }
638672
639− newIORef :: forall r. forall s. s -> Eff ref :: Ref | r (IORef s)
673+ newIORef :: forall r. forall s. s -> Eff (ref :: Ref | r) (IORef s)
640674
641− readIORef :: forall r. forall s. IORef s -> Eff ref :: Ref | r s
675+ readIORef :: forall r. forall s. IORef s -> Eff (ref :: Ref | r) s
642676
643− unsafeRunIORef :: forall a. forall eff. Eff ref :: Ref | eff a -> Eff eff a
677+ unsafeRunIORef :: forall a. forall eff. Eff (ref :: Ref | eff) a -> Eff eff a
644678
645− writeIORef :: forall r. forall s. IORef s -> s -> Eff ref :: Ref | r { }
679+ writeIORef :: forall r. forall s. IORef s -> s -> Eff (ref :: Ref | r) { }
646680
647681
648−## Module Trace
682+## Module Debug.Trace
649683
650684### Types
651685
@@ -660,17 +694,19 @@
660694
661695### Values
662696
663− print :: forall r. forall a. (Prelude.Show (a)) => a -> Eff trace :: Trace | r { }
697+ print :: forall r. forall a. (Prelude.Show (a)) => a -> Eff (trace :: Trace | r) { }
664698
665− trace :: forall r. Prim.String -> Eff trace :: Trace | r { }
699+ trace :: forall r. Prim.String -> Eff (trace :: Trace | r) { }
666700
667701
668−## Module ST
702+## Module Control.Monad.ST
669703
670704### Types
671705
672706 data ST :: * -> !
673707
708+ data STArray :: * -> * -> *
709+
674710 data STRef :: * -> * -> *
675711
676712
@@ -682,15 +718,41 @@
682718
683719### Values
684720
685− modifySTRef :: forall r. forall h. forall a. STRef h a -> (a -> a) -> Eff st :: ST h | r { }
721+ modifySTRef :: forall r. forall h. forall a. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a
722+
723+ newSTArray :: forall r. forall h. forall a. Prim.Number -> a -> Eff (st :: ST h | r) (STArray h a)
724+
725+ newSTRef :: forall r. forall h. forall a. a -> Eff (st :: ST h | r) (STRef h a)
726+
727+ peekSTArray :: forall r. forall h. forall a. STArray h a -> Eff (st :: ST h | r) a
728+
729+ pokeSTArray :: forall r. forall h. forall a. STArray h a -> Prim.Number -> a -> Eff (st :: ST h | r) a
730+
731+ readSTRef :: forall r. forall h. forall a. STRef h a -> Eff (st :: ST h | r) a
732+
733+ runST :: forall r. forall a. forall h. Eff (st :: ST h | r) a -> Eff r a
686734
687− newSTRef :: forall r. forall h. forall a. a -> Eff st :: ST h | r (STRef h a)
735+ runSTArray :: forall r. forall a. forall h. Eff (st :: ST h | r) (STArray h a) -> Eff r [a]
688736
689− readSTRef :: forall r. forall h. forall a. STRef h a -> Eff st :: ST h | r a
737+ writeSTRef :: forall r. forall h. forall a. STRef h a -> a -> Eff (st :: ST h | r) a
690738
691− runST :: forall r. forall a. forall h. Eff st :: ST h | r a -> Eff r a
692739
693− writeSTRef :: forall r. forall h. forall a. STRef h a -> a -> Eff st :: ST h | r { }
740+## Module Data.Enum
741+
742+### Types
743+
744+
745+### Type Classes
746+
747+ class Enum a where
748+ toEnum :: Prim.Number -> Maybe a
749+ fromEnum :: a -> Prim.Number
750+
751+
752+### Type Class Instances
753+
754+
755+### Values
694756
695757
696758
prelude/prelude.purs+62−63
@@ -162,17 +162,14 @@ module Prelude where
162162 -- Referential equality
163163 data Ref a = Ref a
164164
165− foreign import refEq "function refEq(r1) {\
166− \ return function(r2) {\
167− \ return r1.values[0] === r2.values[0];\
168− \ };\
169− \}" :: forall a. Ref a -> Ref a -> Boolean
170−
171− foreign import refIneq "function refIneq(r1) {\
172− \ return function(r2) {\
173− \ return r1.values[0] !== r2.values[0];\
174− \ };\
175− \}" :: forall a. Ref a -> Ref a -> Boolean
165+ liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
166+ liftRef f (Ref x) (Ref y) = f x y
167+
168+ refEq :: forall a. Ref a -> Ref a -> Boolean
169+ refEq = liftRef unsafeRefEq
170+
171+ refIneq :: forall a. Ref a -> Ref a -> Boolean
172+ refIneq = liftRef unsafeRefIneq
176173
177174 foreign import unsafeRefEq "function unsafeRefEq(r1) {\
178175 \ return function(r2) {\
@@ -356,7 +353,7 @@ module Prelude where
356353 \ };\
357354 \}" :: String -> String -> String
358355
359−module Monoid where
356+module Data.Monoid where
360357
361358 import Prelude
362359
@@ -372,16 +369,16 @@ module Monoid where
372369
373370 instance Monoid [a] where
374371 mempty = []
375− (<>) = Arrays.concat
372+ (<>) = Data.Array.concat
376373
377374 mconcat :: forall m. (Monoid m) => [m] -> m
378375 mconcat [] = mempty
379376 mconcat (m:ms) = m <> mconcat ms
380377
381−module Monad where
378+module Control.Monad where
382379
383380 import Prelude
384− import Arrays
381+ import Data.Array
385382
386383 replicateM :: forall m a. (Monad m) => Number -> m a -> m [a]
387384 replicateM 0 _ = return []
@@ -428,7 +425,7 @@ module Monad where
428425 when true m = m
429426 when false _ = return {}
430427
431−module Maybe where
428+module Data.Maybe where
432429
433430 import Prelude
434431
@@ -458,7 +455,7 @@ module Maybe where
458455 show (Just x) = "Just " ++ (show x)
459456 show Nothing = "Nothing"
460457
461−module Either where
458+module Data.Either where
462459
463460 import Prelude
464461
@@ -485,24 +482,18 @@ module Either where
485482 show (Left x) = "Left " ++ (show x)
486483 show (Right y) = "Right " ++ (show y)
487484
488−module Arrays where
485+module Data.Array where
489486
490487 import Prelude
491− import Maybe
488+ import Data.Maybe
492489
493− head :: forall a. [a] -> a
494− head (x : _) = x
495−
496− headSafe :: forall a. [a] -> Maybe a
497− headSafe (x : _) = Just x
498− headSafe _ = Nothing
490+ head :: forall a. [a] -> Maybe a
491+ head (x : _) = Just x
492+ head _ = Nothing
499493
500− tail :: forall a. [a] -> [a]
501− tail (_ : xs) = xs
502−
503− tailSafe :: forall a. [a] -> Maybe [a]
504− tailSafe (_ : xs) = Just xs
505− tailSafe _ = Nothing
494+ tail :: forall a. [a] -> Maybe [a]
495+ tail (_ : xs) = Just xs
496+ tail _ = Nothing
506497
507498 map :: forall a b. (a -> b) -> [a] -> [b]
508499 map _ [] = []
@@ -647,11 +638,19 @@ module Arrays where
647638 instance Prelude.Alternative [] where
648639 empty = []
649640 (<|>) = concat
641+
642+module Data.Array.Unsafe where
650643
651−module Tuples where
644+ head :: forall a. [a] -> a
645+ head (x : _) = x
646+
647+ tail :: forall a. [a] -> [a]
648+ tail (_ : xs) = xs
649+
650+module Data.Tuple where
652651
653652 import Prelude
654− import Arrays
653+ import Data.Array
655654
656655 data Tuple a b = Tuple a b
657656
@@ -672,7 +671,7 @@ module Tuples where
672671 Tuple as bs -> Tuple (a : as) (b : bs)
673672 unzip [] = Tuple [] []
674673
675−module String where
674+module Data.String where
676675
677676 foreign import lengthS "function lengthS(s) {\
678677 \ return s.length;\
@@ -752,7 +751,7 @@ module String where
752751 \ return s.trim();\
753752 \}" :: String -> String
754753
755−module Regex where
754+module Data.String.Regex where
756755
757756 foreign import data Regex :: *
758757
@@ -907,7 +906,7 @@ module Math where
907906 foreign import sqrt1_2 "var sqrt1_2 = Math.SQRT1_2;" :: Number
908907 foreign import sqrt2 "var sqrt2 = Math.SQRT2;" :: Number
909908
910−module Eff where
909+module Control.Monad.Eff where
911910
912911 foreign import data Eff :: # ! -> * -> *
913912
@@ -936,29 +935,29 @@ module Eff where
936935 (>>=) = bindEff
937936
938937 foreign import untilE "function untilE(f) {\
939− \ return function() {\
940− \ while (!f()) { }\
941− \ return {};\
942− \ };\
938+ \ return function() {\
939+ \ while (!f()) { }\
940+ \ return {};\
941+ \ };\
943942 \}" :: forall e. Eff e Boolean -> Eff e {}
944943
945944 foreign import whileE "function whileE(f) {\
946− \ return function(a) {\
947− \ return function() {\
948− \ while (f()) {\
945+ \ return function(a) {\
946+ \ return function() {\
947+ \ while (f()) {\
949948 \ a();\
950949 \ }\
951− \ return {};\
950+ \ return {};\
952951 \ };\
953952 \ };\
954953 \}" :: forall e a. Eff e Boolean -> Eff e a -> Eff e {}
955954
956955 foreign import forE "function forE(lo) {\
957− \ return function(hi) {\
958− \ return function(f) {\
959− \ return function() {\
960− \ for (var i = lo; i < hi; i++) {\
961− \ f(i)();\
956+ \ return function(hi) {\
957+ \ return function(f) {\
958+ \ return function() {\
959+ \ for (var i = lo; i < hi; i++) {\
960+ \ f(i)();\
962961 \ }\
963962 \ };\
964963 \ };\
@@ -967,9 +966,9 @@ module Eff where
967966
968967
969968 foreign import foreachE "function foreachE(as) {\
970− \ return function(f) {\
971− \ for (var i = 0; i < as.length; i++) {\
972− \ f(as[i])();\
969+ \ return function(f) {\
970+ \ for (var i = 0; i < as.length; i++) {\
971+ \ f(as[i])();\
973972 \ }\
974973 \ };\
975974 \}" :: forall e a. [a] -> (a -> Eff e {}) -> Eff e {}
@@ -977,7 +976,7 @@ module Eff where
977976
978977module Random where
979978
980− import Eff
979+ import Control.Monad.Eff
981980
982981 foreign import data Random :: !
983982
@@ -985,9 +984,9 @@ module Random where
985984 \ return Math.random();\
986985 \}" :: forall e. Eff (random :: Random | e) Number
987986
988−module Errors where
987+module Control.Monad.Error where
989988
990− import Eff
989+ import Control.Monad.Eff
991990
992991 foreign import data Error :: * -> !
993992
@@ -1009,9 +1008,9 @@ module Errors where
10091008 \ };\
10101009 \}" :: forall e r a. (e -> Eff r a) -> Eff (err :: Error e | r) a -> Eff r a
10111010
1012−module IORef where
1011+module Data.IORef where
10131012
1014− import Eff
1013+ import Control.Monad.Eff
10151014
10161015 foreign import data Ref :: !
10171016
@@ -1052,10 +1051,10 @@ module IORef where
10521051 \ return f;\
10531052 \}" :: forall eff a. Eff (ref :: Ref | eff) a -> Eff eff a
10541053
1055−module Trace where
1054+module Debug.Trace where
10561055
10571056 import Prelude
1058− import Eff
1057+ import Control.Monad.Eff
10591058
10601059 foreign import data Trace :: !
10611060
@@ -1069,9 +1068,9 @@ module Trace where
10691068 print :: forall a r. (Prelude.Show a) => a -> Eff (trace :: Trace | r) {}
10701069 print o = trace (show o)
10711070
1072−module ST where
1071+module Control.Monad.ST where
10731072
1074− import Eff
1073+ import Control.Monad.Eff
10751074
10761075 foreign import data ST :: * -> !
10771076
@@ -1145,9 +1144,9 @@ module ST where
11451144 \ return f;\
11461145 \}" :: forall a r. (forall h. Eff (st :: ST h | r) (STArray h a)) -> Eff r [a]
11471146
1148−module Enum where
1147+module Data.Enum where
11491148
1150− import Maybe
1149+ import Data.Maybe
11511150
11521151 class Enum a where
11531152 toEnum :: Number -> Maybe a
psci/Commands.hs+1−1
@@ -38,7 +38,7 @@ data Command
3838 -- |
3939 -- Import a module from a loaded file
4040 --
41− | Import ProperName
41+ | Import ModuleName
4242 -- |
4343 -- Load a file for use with importing
4444 --
psci/Main.hs+7−7
@@ -51,7 +51,7 @@ import qualified System.IO.UTF8 as U (readFile)
5151-- The let bindings are partial,
5252-- because it makes more sense to apply the binding to the final evaluated expression.
5353--
54−data PSCI = PSCI [P.ProperName] [P.Module] [P.Value -> P.Value]
54+data PSCI = PSCI [P.ModuleName] [P.Module] [P.Value -> P.Value]
5555
5656-- State helpers
5757
@@ -72,8 +72,8 @@ ioToState = lift . lift
7272-- |
7373-- Updates the state to have more imported modules.
7474--
75−updateImports :: P.ProperName -> PSCI -> PSCI
76−updateImports name (PSCI i m b) = PSCI (i ++ [name]) m b
75+updateImports :: P.ModuleName -> PSCI -> PSCI
76+updateImports name (PSCI i m b) = PSCI (name : i) m b
7777
7878-- |
7979-- Updates the state to have more loaded files.
@@ -91,8 +91,8 @@ updateLets name (PSCI i m b) = PSCI i m (b ++ [name])
9191-- |
9292-- Load the necessary modules.
9393--
94−defaultImports :: [P.ProperName]
95−defaultImports = [P.ProperName "Prelude"]
94+defaultImports :: [P.ModuleName]
95+defaultImports = [P.ModuleName [P.ProperName "Prelude"]]
9696
9797-- |
9898-- Locates the node executable.
@@ -194,7 +194,7 @@ options = P.Options True False True (Just "Main") True "PS" []
194194-- |
195195-- Makes a volatile module to execute the current expression.
196196--
197−createTemporaryModule :: Bool -> [P.ProperName] -> [P.Value -> P.Value] -> P.Value -> P.Module
197+createTemporaryModule :: Bool -> [P.ModuleName] -> [P.Value -> P.Value] -> P.Value -> P.Module
198198createTemporaryModule exec imports lets value =
199199 let
200200 moduleName = P.ModuleName [P.ProperName "Main"]
@@ -205,7 +205,7 @@ createTemporaryModule exec imports lets value =
205205 itDecl = P.ValueDeclaration (P.Ident "it") [] Nothing value'
206206 mainDecl = P.ValueDeclaration (P.Ident "main") [] Nothing (P.App trace (P.Var (P.Qualified Nothing (P.Ident "it"))))
207207 in
208− P.Module moduleName $ map (importDecl . P.ModuleName . return) imports ++ if exec then [itDecl, mainDecl] else [itDecl]
208+ P.Module moduleName $ map importDecl imports ++ if exec then [itDecl, mainDecl] else [itDecl]
209209
210210-- |
211211-- Takes a value declaration and evaluates it with the current state.
psci/Parser.hs+1−1
@@ -92,7 +92,7 @@ psciHelp = Help <$ (spaces *> string ":?" *> spaces)
9292-- Parses 'Commands.Import' command.
9393--
9494psciImport :: Parsec String P.ParseState Command
95−psciImport = Import <$> (spaces *> string ":i" *> spaces *> P.properName)
95+psciImport = Import <$> (spaces *> string ":i" *> spaces *> P.moduleName)
9696
9797-- |
9898-- Parses 'Commands.LoadFile' command.
src/Language/PureScript/CodeGen/Common.hs+2
@@ -70,6 +70,7 @@ identCharToString c = '$' : show (ord c)
7070nameIsJsReserved :: String -> Bool
7171nameIsJsReserved name =
7272 elem name [ "abstract"
73+ , "arguments"
7374 , "boolean"
7475 , "break"
7576 , "byte"
@@ -86,6 +87,7 @@ nameIsJsReserved name =
8687 , "double"
8788 , "else"
8889 , "enum"
90+ , "eval"
8991 , "export"
9092 , "extends"
9193 , "final"
src/Language/PureScript/CodeGen/Optimize.hs+1−1
@@ -316,7 +316,7 @@ magicDo' = everywhere (mkT undo) . everywhere' (mkT convert)
316316 isEffFunc _ _ = False
317317 -- Module names
318318 prelude = ModuleName [ProperName "Prelude"]
319− effModule = ModuleName [ProperName "Eff"]
319+ effModule = ModuleName [ProperName "Control", ProperName "Monad", ProperName "Eff"]
320320 -- The name of the type class dictionary for the Monad Eff instance
321321 Right (Ident effDictName) = mkDictionaryValueName
322322 effModule
src/Language/PureScript/Parser/Common.hs−1
@@ -48,7 +48,6 @@ reservedPsNames = [ "data"
4848 , "let"
4949 , "true"
5050 , "false"
51− , "until"
5251 , "in"
5352 ]
5453
src/Language/PureScript/TypeChecker/Types.hs+1−1
@@ -208,7 +208,7 @@ typesOf mainModuleName moduleName vals = do
208208 -- If --main is enabled, need to check that `main` has type Eff eff a for some eff, a
209209 when (Just moduleName == mainModuleName && fst e == Ident "main") $ do
210210 [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
212212 -- Make sure unification variables do not escape
213213 escapeCheck val ty
214214 return triple