git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1316 from hdgarrood/update-test-support

Update test suite to use real supporting libraries

commitba3f76fdbab4dbb80312e66aba16316cd5c0fb8e authorPhil Freeman <paf31@cantab.net> dateSat 1 Aug 2015, 18:53 (11 years ago) parentbeb86e9529f598
170 files changed+436−1481
.gitignore+1 CONTRIBUTING.md+2−2 examples/failing/ArrayType.purs+1−1 examples/failing/Eff.purs+2−2 examples/failing/ExtraRecordField.purs+9 examples/failing/MissingRecordField.purs+10 examples/failing/OverlappingInstances.purs+1−1 examples/failing/OverlappingInstances2.purs+1−1 examples/failing/RowConstructors1.purs+1−1 examples/failing/RowConstructors2.purs+1−1 examples/failing/RowConstructors3.purs+1−1 examples/failing/UnderscoreModuleName.purs+1−1 examples/manual/QualifiedNames.purs+1−1 examples/manual/failing/ExportExplicit1.purs+1−1 examples/manual/failing/ExportExplicit3.purs+1−1 examples/manual/passing/ExportExplicit.purs+1−1 examples/manual/passing/ExportExplicit2.purs+1−1 examples/manual/passing/Import.purs+1−1 examples/manual/passing/ImportExplicit.purs+1−1 examples/manual/passing/ImportQualified.purs+3−3 examples/manual/passing/Module.purs+1−1 examples/manual/passing/ModuleDeps.purs+1−1 examples/manual/passing/RedefinedFixity.purs+1−1 examples/manual/passing/ShadowedName.purs+2−2 examples/manual/passing/TransitiveImport.purs+1−1 examples/manual/passing/WildcardType.purs+2−2 examples/passing/652.purs+1−1 examples/passing/810.purs+1−1 examples/passing/Applicative.purs+4−4 examples/passing/ArrayType.purs+1−1 examples/passing/Auto.purs+1−1 examples/passing/AutoPrelude.purs+2−2 examples/passing/AutoPrelude2.purs+2−2 examples/passing/BindersInFunctions.purs+5−6 examples/passing/BindingGroups.purs+1−1 examples/passing/BlockString.purs+1−1 examples/passing/CaseInDo.purs+3−3 examples/passing/CaseStatement.purs+1−1 examples/passing/CheckFunction.purs+1−1 examples/passing/CheckSynonymBug.purs+4−1 examples/passing/CheckTypeClass.purs+1−1 examples/passing/Church.purs+1−1 examples/passing/Collatz.purs+6−6 examples/passing/Comparisons.purs+3−3 examples/passing/Conditional.purs+1−1 examples/passing/Console.purs+2−2 examples/passing/DataAndType.purs+1−1 examples/passing/DeepArrayBinder.purs+5−4 examples/passing/DeepCase.purs+1−1 examples/passing/Do.purs+5−5 examples/passing/Dollar.purs+1−1 examples/passing/Eff.purs+5−5 examples/passing/EmptyDataDecls.purs+4−4 examples/passing/EmptyRow.purs+1−1 examples/passing/EmptyTypeClass.purs+1−1 examples/passing/EqOrd.purs+2−3 examples/passing/ExtendedInfixOperators.purs+1−1 examples/passing/Fib.purs+1−1 examples/passing/FinalTagless.purs+2−2 examples/passing/FunctionScope.purs+3−4 examples/passing/Functions.purs+1−1 examples/passing/Functions2.purs+3−4 examples/passing/Guards.purs+2−2 examples/passing/HoistError.purs+3−3 examples/passing/IfThenElseMaybe.purs+1−1 examples/passing/ImplicitEmptyImport.purs+3−3 examples/passing/ImportHiding.purs+1−1 examples/passing/InferRecFunWithConstrainedArgument.purs+1−1 examples/passing/InstanceBeforeClass.purs+1−1 examples/passing/IntAndChar.purs+2−2 examples/passing/JSReserved.purs+1−1 examples/passing/KindedType.purs+1−1 examples/passing/Let.purs+7−7 examples/passing/Let2.purs+1−1 examples/passing/LetInInstance.purs+1−1 examples/passing/LiberalTypeSynonyms.purs+1−1 examples/passing/MPTCs.purs+1−1 examples/passing/Match.purs+1−1 examples/passing/ModuleExport.purs+1−1 examples/passing/ModuleExportDupes.purs+1−1 examples/passing/ModuleExportExcluded.purs+1−1 examples/passing/ModuleExportHiding.purs+1−1 examples/passing/ModuleExportQualified.purs+1−1 examples/passing/ModuleExportSelf.purs+1−1 examples/passing/Monad.purs+1−1 examples/passing/MonadState.purs+3−3 examples/passing/MultiArgFunctions.purs+13−13 examples/passing/MutRec.purs+1−1 examples/passing/MutRec2.purs+1−1 examples/passing/MutRec3.purs+1−1 examples/passing/NamedPatterns.purs+1−1 examples/passing/NegativeBinder.purs+1−1 examples/passing/Nested.purs+1−1 examples/passing/NestedTypeSynonyms.purs+1−1 examples/passing/NestedWhere.purs+1−1 examples/passing/Newtype.purs+3−3 examples/passing/NewtypeEff.purs+8−8 examples/passing/NewtypeWithRecordUpdate.purs+2−2 examples/passing/ObjectGetter.purs+4−4 examples/passing/ObjectSynonym.purs+1−1 examples/passing/ObjectUpdate.purs+1−1 examples/passing/ObjectUpdate2.purs+1−1 examples/passing/ObjectUpdater.purs+2−2 examples/passing/ObjectWildcards.purs+3−3 examples/passing/Objects.purs+2−2 examples/passing/OneConstructor.purs+1−1 examples/passing/OperatorAssociativity.purs+3−3 examples/passing/OperatorInlining.purs+1−1 examples/passing/OperatorSections.purs+2−2 examples/passing/Operators.purs+2−2 examples/passing/OptimizerBug.purs+1−1 examples/passing/PartialFunction.purs+2−2 examples/passing/Patterns.purs+1−1 examples/passing/Person.purs+1−1 examples/passing/Rank2Data.purs+2−2 examples/passing/Rank2Object.purs+2−2 examples/passing/Rank2TypeSynonym.purs+1−1 examples/passing/Rank2Types.purs+1−1 examples/passing/RebindableSyntax.purs+4−4 examples/passing/Recursion.purs+1−1 examples/passing/ReservedWords.purs+1−1 examples/passing/RowConstructors.purs+1−1 examples/passing/RowPolyInstanceContext.purs+1−1 examples/passing/RuntimeScopeIssue.purs+1−1 examples/passing/ScopedTypeVariables.purs+1−1 examples/passing/Sequence.purs+1−1 examples/passing/SequenceDesugared.purs+4−4 examples/passing/ShadowedRename.purs+3−3 examples/passing/ShadowedTCO.purs+2−2 examples/passing/ShadowedTCOLet.purs+1−1 examples/passing/SignedNumericLiterals.purs+1−1 examples/passing/Superclasses1.purs+1−1 examples/passing/Superclasses2.purs+1−2 examples/passing/Superclasses3.purs+6−6 examples/passing/TCOCase.purs+1−1 examples/passing/TailCall.purs+1−1 examples/passing/Tick.purs+1−1 examples/passing/TopLevelCase.purs+3−3 examples/passing/TypeClassMemberOrderChange.purs+1−1 examples/passing/TypeClasses.purs+5−5 examples/passing/TypeClassesInOrder.purs+1−1 examples/passing/TypeClassesWithOverlappingTypeVariables.purs+3−3 examples/passing/TypeDecl.purs+1−1 examples/passing/TypeSynonymInData.purs+1−1 examples/passing/TypeSynonyms.purs+1−1 examples/passing/TypeWildcards.purs+1−1 examples/passing/TypeWildcardsRecordExtension.purs+1−1 examples/passing/TypedWhere.purs+1−1 examples/passing/UnderscoreIdent.purs+1−1 examples/passing/Unit.purs+1−1 examples/passing/UnknownInTypeClassLookup.purs+1−1 examples/passing/Where.purs+7−7 examples/passing/iota.purs+1−1 examples/passing/s.purs+1−1 psci/Completion.hs+9−6 psci/tests/Main.hs+35−29 purescript.cabal+4−3 tests/Main.hs+48−32 tests/prelude/Prelude.purs−631 tests/prelude/js/Assert.js−19 tests/prelude/js/Control.Monad.Eff.js−40 tests/prelude/js/Control.Monad.ST.js−38 tests/prelude/js/Data.Function.js−233 tests/prelude/js/Debug.Trace.js−11 tests/prelude/js/Prelude.Unsafe.js−10 tests/prelude/js/Prelude.js−150 tests/support/.gitignore+2 tests/support/bower.json+11 tests/support/package.json+7 tests/support/setup.js+22
.gitignore+1
@@ -13,3 +13,4 @@ cabal.sandbox.config
1313bower_components/
1414tmp/
1515.stack-work/
16+tests/support/flattened/
CONTRIBUTING.md+2−2
@@ -9,8 +9,8 @@ Please follow the following guidelines:
99- Add at least a test to `examples/passing/` and possibly to `examples/failing`.
1010- Build the binaries and libs with `cabal build`
1111- Install the binaries and libs with `cabal install`.
12−- Run `cabal configure --enable-tests && cabal build && cabal test` to build the test suite.
13−- Build the core libraries by running the script in `core-tests`
12+- Run `cabal configure --enable-tests && cabal build && cabal test` to build the test suite. You will need `npm`, `node`, and `bower` on your PATH to run the tests.
13+- Build the core libraries by running the script in `core-tests`.
1414
1515If you would like to contribute, please consider the issues in the current milestone first. If you are a new contributor, you may want to have a go at the ["easy" issues](https://github.com/purescript/purescript/labels/easy) to get started.
1616
examples/failing/ArrayType.purs+1−1
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66bar :: Number -> Number -> Number
77bar n m = n + m
examples/failing/Eff.purs+2−2
@@ -3,10 +3,10 @@ module Main where
33import Prelude
44import Control.Monad.Eff
55import Control.Monad.ST
6−import Debug.Trace
6+import Control.Monad.Eff.Console
77
88test = pureST (do
99 ref <- newSTRef 0
10− trace "ST"
10+ log "ST"
1111 modifySTRef ref $ \n -> n + 1
1212 readSTRef ref)
examples/failing/ExtraRecordField.pursnew file+9
@@ -0,0 +1,9 @@
1+
2+module ExtraRecordField where
3+
4+import Prelude ((<>))
5+
6+full :: { first :: String, last :: String } -> String
7+full p = p.first <> " " <> p.last
8+
9+oops = full { first: "Jane", last: "Smith", age: 29 }
examples/failing/MissingRecordField.pursnew file+10
@@ -0,0 +1,10 @@
1+
2+module MissingRecordField where
3+
4+import Prelude ((>))
5+
6+john = { first: "John", last: "Smith" }
7+
8+isOver50 p = p.age > 50.0
9+
10+result = isOver50 john
examples/failing/OverlappingInstances.purs+1−1
@@ -10,4 +10,4 @@ instance showA1 :: Show A where
1010instance showA2 :: Show A where
1111 show A = "Instance 2"
1212
13−main = Debug.Trace.trace $ show A
13+main = Control.Monad.Eff.Console.log $ show A
examples/failing/OverlappingInstances2.purs+1−1
@@ -22,4 +22,4 @@ instance ordA :: Ord A where
2222test :: forall a. (Ord a) => a -> a -> String
2323test x y = show $ x == y
2424
25−main = Debug.Trace.trace $ test A B
25+main = Control.Monad.Eff.Console.log $ test A B
examples/failing/RowConstructors1.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55data Foo = Bar
66type Baz = { | Foo }
77
8−main = Debug.Trace.trace "Done"
8+main = Control.Monad.Eff.Console.log "Done"
examples/failing/RowConstructors2.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55type Foo r = (x :: Number | r)
66type Bar = { | Foo }
77
8−main = Debug.Trace.trace "Done"
8+main = Control.Monad.Eff.Console.log "Done"
examples/failing/RowConstructors3.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55type Foo = { x :: Number }
66type Bar = { | Foo }
77
8−main = Debug.Trace.trace "Done"
8+main = Control.Monad.Eff.Console.log "Done"
examples/failing/UnderscoreModuleName.purs+1−1
@@ -2,4 +2,4 @@ module Bad_Module where
22
33import Prelude
44
5−main = Debug.Trace.trace "Done"
5+main = Control.Monad.Eff.Console.log "Done"
examples/manual/QualifiedNames.purs+1−1
@@ -10,4 +10,4 @@ either :: forall a b c. (a -> c) -> (b -> c) -> Data.Either.Either a b -> c
1010either f _ (Data.Either.Left x) = f x
1111either _ g (Data.Either.Right y) = g y
1212
13−main = Debug.Trace.trace (either id id (Data.Either.Left "Done"))
13+main = Control.Monad.Eff.Console.log (either id id (Data.Either.Left "Done"))
examples/manual/failing/ExportExplicit1.purs+1−1
@@ -11,4 +11,4 @@ module Main where
1111 -- should fail as Y constructor is not exported from M1
1212 testY = Y
1313
14− main = Debug.Trace.trace "Done"
14+ main = Control.Monad.Eff.Console.log "Done"
examples/manual/failing/ExportExplicit3.purs+1−1
@@ -10,4 +10,4 @@ module Main where
1010 -- should fail as Z is not exported from M1
1111 testZ = M1.Z
1212
13− main = Debug.Trace.trace "Done"
13+ main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/ExportExplicit.purs+1−1
@@ -17,4 +17,4 @@ module Main where
1717 testZ = Z
1818 testFoo = foo
1919
20− main = Debug.Trace.trace "Done"
20+ main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/ExportExplicit2.purs+1−1
@@ -12,4 +12,4 @@ module Main where
1212
1313 testBar = bar
1414
15− main = Debug.Trace.trace "Done"
15+ main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/Import.purs+1−1
@@ -16,4 +16,4 @@ module M2 where
1616
1717module Main where
1818
19−main = Debug.Trace.trace "Done"
19+main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/ImportExplicit.purs+1−1
@@ -11,4 +11,4 @@ module Main where
1111 testX = X
1212 testY = Y
1313
14− main = Debug.Trace.trace "Done"
14+ main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/ImportQualified.purs+3−3
@@ -1,12 +1,12 @@
11module M1 where
22
3− trace x = x
3+ log x = x
44
55module Main where
66
77 import Prelude
88 import Control.Monad.Eff
99 import M1
10− import qualified Debug.Trace as T
10+ import qualified Control.Monad.Eff.Console as C
1111
12− main = T.trace (trace "Done")
12+ main = C.log (log "Done")
examples/manual/passing/Module.purs+1−1
@@ -25,4 +25,4 @@ module M2 where
2525
2626module Main where
2727
28−main = Debug.Trace.trace "Done"
28+main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/ModuleDeps.purs+1−1
@@ -14,4 +14,4 @@ baz = 1
1414
1515module Main where
1616
17−main = Debug.Trace.trace "Done"
17+main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/RedefinedFixity.purs+1−1
@@ -21,4 +21,4 @@ import M2
2121
2222module Main where
2323
24−main = Debug.Trace.trace "Done"
24+main = Control.Monad.Eff.Console.log "Done"
examples/manual/passing/ShadowedName.purs+2−2
@@ -1,10 +1,10 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66done :: String
77done = let str = "Not yet done" in
88 let str = "Done" in str
99
10−main = Debug.Trace.trace done
10+main = Control.Monad.Eff.Console.log done
examples/manual/passing/TransitiveImport.purs+1−1
@@ -16,7 +16,7 @@ module Main where
1616
1717 import Prelude
1818 import Middle
19− import Debug.Trace
19+ import Control.Monad.Eff.Console
2020
2121 main = do
2222 print (middle unit)
examples/manual/passing/WildcardType.purs+2−2
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66f1 :: (_ -> _) -> _
77f1 g = g 1
@@ -9,5 +9,5 @@ f1 g = g 1
99f2 :: _ -> _
1010f2 _ = "Done"
1111
12−main = Debug.Trace.trace $ f1 f2
12+main = Control.Monad.Eff.Console.log $ f1 f2
1313
examples/passing/652.purs+1−1
@@ -14,4 +14,4 @@ instance bar :: Bar (a -> b) b
1414
1515instance baz :: (Eq a) => Baz (a -> b) a b
1616
17−main = Debug.Trace.trace "Done"
17+main = Control.Monad.Eff.Console.log "Done"
examples/passing/810.purs+1−1
@@ -10,4 +10,4 @@ test m = o.x
1010 o = case m of Nothing -> { x : Nothing }
1111 Just a -> { x : Just a }
1212
13−main = Debug.Trace.trace "Done"
13+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Applicative.purs+4−4
@@ -4,13 +4,13 @@ import Prelude ()
44
55class Applicative f where
66 pure :: forall a. a -> f a
7− (<*>) :: forall a b. f (a -> b) -> f a -> f b
7+ apply :: forall a b. f (a -> b) -> f a -> f b
88
99data Maybe a = Nothing | Just a
1010
1111instance applicativeMaybe :: Applicative Maybe where
1212 pure = Just
13− (<*>) (Just f) (Just a) = Just (f a)
14− (<*>) _ _ = Nothing
13+ apply (Just f) (Just a) = Just (f a)
14+ apply _ _ = Nothing
1515
16−main = Debug.Trace.trace "Done"
16+main = Control.Monad.Eff.Console.log "Done"
examples/passing/ArrayType.purs+1−1
@@ -8,4 +8,4 @@ class Pointed p where
88instance pointedArray :: Pointed Array where
99 point a = [a]
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Auto.purs+1−1
@@ -12,4 +12,4 @@ exists = \state step f -> f (Auto { state: state, step: step })
1212run :: forall i o. SomeAuto i o -> i -> o
1313run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
1414
15−main = Debug.Trace.trace "Done"
15+main = Control.Monad.Eff.Console.log "Done"
examples/passing/AutoPrelude.purs+2−2
@@ -1,9 +1,9 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66f x = x * 10.0
77g y = y - 10.0
88
9−main = trace $ show $ (f <<< g) 100.0
9+main = log $ show $ (f <<< g) 100.0
examples/passing/AutoPrelude2.purs+2−2
@@ -2,9 +2,9 @@ module Main where
22
33import Prelude
44import qualified Prelude as P
5−import Debug.Trace
5+import Control.Monad.Eff.Console
66
77f :: forall a. a -> a
88f = P.id
99
10−main = P.($) trace ((f P.<<< f) "Done")
10+main = P.($) log ((f P.<<< f) "Done")
examples/passing/BindersInFunctions.purs+5−6
@@ -1,12 +1,11 @@
11module Main where
22
33import Prelude
4−import Assert
4+import Test.Assert
55
66snd = \[_, y] -> y
77
8−main =
9− let ts = snd [1.0, 2.0] in
10− if ts == 2.0
11− then Debug.Trace.trace "Done"
12− else error "Incorrect result from 'snd'."
8+main = do
9+ let ts = snd [1.0, 2.0]
10+ assert' "Incorrect result from 'snd'." (ts == 2.0)
11+ Control.Monad.Eff.Console.log "Done"
examples/passing/BindingGroups.purs+1−1
@@ -7,4 +7,4 @@ foo = bar
77
88r = foo 2.0
99
10−main = Debug.Trace.trace "Done"
10+main = Control.Monad.Eff.Console.log "Done"
examples/passing/BlockString.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55foo :: String
66foo = """foo"""
77
8−main = Debug.Trace.trace "Done"
8+main = Control.Monad.Eff.Console.log "Done"
examples/passing/CaseInDo.purs+3−3
@@ -1,14 +1,14 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55import Control.Monad.Eff
66
77doIt :: forall eff. Eff eff Boolean
88doIt = return true
99
1010set = do
11− trace "Testing..."
11+ log "Testing..."
1212 case 0 of
1313 0 -> doIt
1414 _ -> return false
@@ -16,4 +16,4 @@ set = do
1616main = do
1717 b <- set
1818 case b of
19− true -> trace "Done"
19+ true -> log "Done"
examples/passing/CaseStatement.purs+1−1
@@ -18,4 +18,4 @@ h f N a = a
1818h f a N = a
1919h f (J a) (J b) = J (f a b)
2020
21−main = Debug.Trace.trace $ f "Done" "Failed" A
21+main = Control.Monad.Eff.Console.log $ f "Done" "Failed" A
examples/passing/CheckFunction.purs+1−1
@@ -4,4 +4,4 @@ import Prelude
44
55test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
66
7−main = Debug.Trace.trace "Done"
7+main = Control.Monad.Eff.Console.log "Done"
examples/passing/CheckSynonymBug.purs+4−1
@@ -2,8 +2,11 @@ module Main where
22
33import Prelude
44
5+length :: forall a. Array a -> Int
6+length _ = 0
7+
58type Foo a = Array a
69
710foo _ = length ([] :: Foo Number)
811
9−main = Debug.Trace.trace "Done"
12+main = Control.Monad.Eff.Console.log "Done"
examples/passing/CheckTypeClass.purs+1−1
@@ -14,5 +14,5 @@ foo_ x = foo ((mkBar :: forall a. (Foo a) => a -> Bar a) x)
1414mkBar :: forall a. a -> Bar a
1515mkBar _ = Bar
1616
17−main = Debug.Trace.trace "Done"
17+main = Control.Monad.Eff.Console.log "Done"
1818
examples/passing/Church.purs+1−1
@@ -15,4 +15,4 @@ append = \l1 l2 r f -> l2 (l1 r f) f
1515
1616test = append (cons 1 empty) (cons 2 empty)
1717
18−main = Debug.Trace.trace "Done"
18+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Collatz.purs+6−6
@@ -4,15 +4,15 @@ import Prelude
44import Control.Monad.Eff
55import Control.Monad.ST
66
7−collatz :: Number -> Number
7+collatz :: Int -> Int
88collatz n = runPure (runST (do
99 r <- newSTRef n
10− count <- newSTRef 0.0
10+ count <- newSTRef 0
1111 untilE $ do
12− modifySTRef count $ (+) 1.0
12+ modifySTRef count $ (+) 1
1313 m <- readSTRef r
14− writeSTRef r $ if m % 2.0 == 0.0 then m / 2.0 else 3.0 * m + 1.0
15− return $ m == 1.0
14+ writeSTRef r $ if m `mod` 2 == 0 then m / 2 else 3 * m + 1
15+ return $ m == 1
1616 readSTRef count))
1717
18−main = Debug.Trace.print $ collatz 1000.0
18+main = Control.Monad.Eff.Console.print $ collatz 1000
examples/passing/Comparisons.purs+3−3
@@ -2,8 +2,8 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
6−import Assert
5+import Control.Monad.Eff.Console
6+import Test.Assert
77
88main = do
99 assert (1.0 < 2.0)
@@ -12,4 +12,4 @@ main = do
1212 assert ("a" < "b")
1313 assert ("a" == "a")
1414 assert ("z" > "a")
15− trace "Done!"
15+ log "Done!"
examples/passing/Conditional.purs+1−1
@@ -6,4 +6,4 @@ fns = \f -> if f true then f else \x -> x
66
77not = \x -> if x then false else true
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Console.purs+2−2
@@ -2,7 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
5+import Control.Monad.Eff.Console
66
77replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
88replicateM_ 0.0 _ = return {}
@@ -10,4 +10,4 @@ replicateM_ n act = do
1010 act
1111 replicateM_ (n - 1.0) act
1212
13−main = replicateM_ 10.0 (trace "Hello World!")
13+main = replicateM_ 10.0 (log "Hello World!")
examples/passing/DataAndType.purs+1−1
@@ -6,4 +6,4 @@ data A = A B
66
77type B = A
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/DeepArrayBinder.purs+5−4
@@ -2,7 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Assert
5+import Test.Assert
66
77data List a = Cons a (List a) | Nil
88
@@ -10,6 +10,7 @@ match2 :: List Number -> Number
1010match2 (Cons x (Cons y xs)) = x * y + match2 xs
1111match2 _ = 0.0
1212
13−main = case match2 (Cons 1.0 (Cons 2.0 (Cons 3.0 (Cons 4.0 (Cons 5.0 (Cons 6.0 (Cons 7.0 (Cons 8.0 (Cons 9.0 Nil))))))))) of
14− 100.0 -> Debug.Trace.trace "Done"
15− _ -> error "Incorrect result!"
13+main = do
14+ let result = match2 (Cons 1.0 (Cons 2.0 (Cons 3.0 (Cons 4.0 (Cons 5.0 (Cons 6.0 (Cons 7.0 (Cons 8.0 (Cons 9.0 Nil)))))))))
15+ assert' "Incorrect result!" (result == 100.0)
16+ Control.Monad.Eff.Console.log "Done"
examples/passing/DeepCase.purs+1−1
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55import Control.Monad.Eff
66import Control.Monad.ST
77
examples/passing/Do.purs+5−5
@@ -5,12 +5,12 @@ import Prelude
55data Maybe a = Nothing | Just a
66
77instance functorMaybe :: Functor Maybe where
8− (<$>) f Nothing = Nothing
9− (<$>) f (Just x) = Just (f x)
8+ map f Nothing = Nothing
9+ map f (Just x) = Just (f x)
1010
1111instance applyMaybe :: Apply Maybe where
12− (<*>) (Just f) (Just x) = Just (f x)
13− (<*>) _ _ = Nothing
12+ apply (Just f) (Just x) = Just (f x)
13+ apply _ _ = Nothing
1414
1515instance applicativeMaybe :: Applicative Maybe where
1616 pure = Just
@@ -64,4 +64,4 @@ test10 _ = do
6464 g x = f x / 2.0
6565 Just (f 10.0)
6666
67−main = Debug.Trace.trace "Done"
67+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Dollar.purs+1−1
@@ -13,4 +13,4 @@ test1 x = id $ id $ id $ id $ x
1313
1414test2 x = id id $ id x
1515
16−main = Debug.Trace.trace "Done"
16+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Eff.purs+5−5
@@ -3,11 +3,11 @@ module Main where
33import Prelude
44import Control.Monad.Eff
55import Control.Monad.ST
6−import Debug.Trace
6+import Control.Monad.Eff.Console
77
88test1 = do
9− trace "Line 1"
10− trace "Line 2"
9+ log "Line 1"
10+ log "Line 2"
1111
1212test2 = runPure (runST (do
1313 ref <- newSTRef 0.0
@@ -21,5 +21,5 @@ test3 = pureST (do
2121
2222main = do
2323 test1
24− Debug.Trace.print test2
25− Debug.Trace.print test3
24+ Control.Monad.Eff.Console.print test2
25+ Control.Monad.Eff.Console.print test3
examples/passing/EmptyDataDecls.purs+4−4
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Assert
4+import Test.Assert
55
66data Z
77data S n
@@ -12,8 +12,8 @@ nil :: forall a. ArrayBox Z a
1212nil = ArrayBox []
1313
1414cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a
15−cons' x (ArrayBox xs) = ArrayBox $ concat [x] xs
15+cons' x (ArrayBox xs) = ArrayBox $ append [x] xs
1616
1717main = case cons' 1 $ cons' 2 $ cons' 3 nil of
18− ArrayBox [1, 2, 3] -> Debug.Trace.trace "Done"
19− _ -> error "Failed"
18+ ArrayBox [1, 2, 3] -> Control.Monad.Eff.Console.log "Done"
19+ _ -> assert' "Failed" false
examples/passing/EmptyRow.purs+1−1
@@ -7,4 +7,4 @@ data Foo r = Foo { | r }
77test :: Foo ()
88test = Foo {}
99
10−main = Debug.Trace.trace "Done"
10+main = Control.Monad.Eff.Console.log "Done"
examples/passing/EmptyTypeClass.purs+1−1
@@ -9,4 +9,4 @@ head [x] = x
99
1010instance allowPartials :: Partial
1111
12−main = Debug.Trace.trace $ head ["Done"]
12+main = Control.Monad.Eff.Console.log $ head ["Done"]
examples/passing/EqOrd.purs+2−3
@@ -10,7 +10,6 @@ instance ordPair :: (Ord a, Ord b) => Ord (Pair a b) where
1010 r -> r
1111
1212instance eqPair :: (Eq a, Eq b) => Eq (Pair a b) where
13− (==) (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2
14− (/=) (Pair a1 b1) (Pair a2 b2) = a1 /= a2 || b1 /= b2
13+ eq (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2
1514
16−main = Debug.Trace.print $ Pair 1.0 2.0 == Pair 1.0 2.0
15+main = Control.Monad.Eff.Console.print $ Pair 1.0 2.0 == Pair 1.0 2.0
examples/passing/ExtendedInfixOperators.purs+1−1
@@ -11,4 +11,4 @@ null _ = false
1111test = [1.0, 2.0, 3.0] `comparing null` [4.0, 5.0, 6.0]
1212
1313main = do
14− Debug.Trace.print test
14+ Control.Monad.Eff.Console.print test
examples/passing/Fib.purs+1−1
@@ -12,4 +12,4 @@ main = runST (do
1212 n2' <- readSTRef n2
1313 writeSTRef n2 $ n1' + n2'
1414 writeSTRef n1 n2'
15− Debug.Trace.print n2')
15+ Control.Monad.Eff.Console.print n2')
examples/passing/FinalTagless.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude
3+import Prelude hiding (add)
44
55class E e where
66 num :: Number -> e Number
@@ -19,4 +19,4 @@ runId (Id a) = a
1919three :: Expr Number
2020three = add (num 1.0) (num 2.0)
2121
22−main = Debug.Trace.print $ runId three
22+main = Control.Monad.Eff.Console.print $ runId three
examples/passing/FunctionScope.purs+3−4
@@ -1,13 +1,12 @@
11module Main where
22
33import Prelude
4−import Assert
4+import Test.Assert
55
66mkValue :: Number -> Number
77mkValue id = id
88
99main = do
1010 let value = mkValue 1.0
11− if value == 1.0
12− then Debug.Trace.trace "Done"
13− else error "Not done"
11+ assert $ value == 1.0
12+ Control.Monad.Eff.Console.log "Done"
examples/passing/Functions.purs+1−1
@@ -12,4 +12,4 @@ test4 = \(%%) -> 1.0 %% 2.0
1212
1313test5 = \(+++) (***) -> 1.0 +++ 2.0 *** 3.0
1414
15−main = Debug.Trace.trace "Done"
15+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Functions2.purs+3−4
@@ -1,13 +1,12 @@
11module Main where
22
33import Prelude
4−import Assert
4+import Test.Assert
55
66test :: forall a b. a -> b -> a
77test = \const _ -> const
88
99main = do
1010 let value = test "Done" {}
11− if value == "Done"
12− then Debug.Trace.trace "Done"
13− else error "Not done"
11+ assert' "Not done" $ value == "Done"
12+ Control.Monad.Eff.Console.log "Done"
examples/passing/Guards.purs+2−2
@@ -3,7 +3,7 @@ module Main where
33import Prelude
44
55collatz = \x -> case x of
6− y | y % 2.0 == 0.0 -> y / 2.0
6+ y | y `mod` 2.0 == 0.0 -> y / 2.0
77 y -> y * 3.0 + 1.0
88
99-- Guards have access to current scope
@@ -26,4 +26,4 @@ testIndentation x y | x > 0.0
2626 | otherwise
2727 = y - x
2828
29−main = Debug.Trace.trace $ min "Done" "ZZZZ"
29+main = Control.Monad.Eff.Console.log $ min "Done" "ZZZZ"
examples/passing/HoistError.purs+3−3
@@ -2,11 +2,11 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
6−import Assert
5+import Control.Monad.Eff.Console
6+import Test.Assert
77
88main = do
99 let x = 0.0
1010 assert $ x == 0.0
1111 let x = 1.0 + 1.0
12− trace "Done"
12+ log "Done"
examples/passing/IfThenElseMaybe.purs+1−1
@@ -8,4 +8,4 @@ test1 = if true then Just 10 else Nothing
88
99test2 = if true then Nothing else Just 10
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/ImplicitEmptyImport.purs+3−3
@@ -3,6 +3,6 @@ module Main where
33import Prelude
44
55main = do
6− Debug.Trace.trace "Hello"
7− Debug.Trace.trace "Goodbye"
8− Debug.Trace.trace "Done"
6+ Control.Monad.Eff.Console.log "Hello"
7+ Control.Monad.Eff.Console.log "Goodbye"
8+ Control.Monad.Eff.Console.log "Done"
examples/passing/ImportHiding.purs+1−1
@@ -1,6 +1,6 @@
11module Main where
22
3−import Debug.Trace
3+import Control.Monad.Eff.Console
44import Prelude hiding (
55 show, -- a value
66 Show, -- a type class
examples/passing/InferRecFunWithConstrainedArgument.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55test 100.0 = 100.0
66test n = test(1.0 + n)
77
8−main = Debug.Trace.print $ test 0.0
8+main = Control.Monad.Eff.Console.print $ test 0.0
examples/passing/InstanceBeforeClass.purs+1−1
@@ -8,4 +8,4 @@ instance fooNumber :: Foo Number where
88class Foo a where
99 foo :: a
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/IntAndChar.purs+2−2
@@ -2,7 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Assert
5+import Test.Assert
66
77f 1 = 1
88f _ = 0
@@ -15,4 +15,4 @@ main = do
1515 assert $ f 0 == 0
1616 assert $ g 'a' == 'a'
1717 assert $ g 'b' == 'b'
18− Debug.Trace.trace "Done"
18+ Control.Monad.Eff.Console.log "Done"
examples/passing/JSReserved.purs+1−1
@@ -9,4 +9,4 @@ public = \return -> return
99
1010this catch = catch
1111
12−main = Debug.Trace.trace "Done"
12+main = Control.Monad.Eff.Console.log "Done"
examples/passing/KindedType.purs+1−1
@@ -30,4 +30,4 @@ class Clazz (a :: *) where
3030instance clazzString :: Clazz String where
3131 def = "test"
3232
33−main = Debug.Trace.trace "Done"
33+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Let.purs+7−7
@@ -44,10 +44,10 @@ test10 _ =
4444 in f 10.0
4545
4646main = do
47− Debug.Trace.print (test1 1.0)
48− Debug.Trace.print (test2 1.0 2.0)
49− Debug.Trace.print test3
50− Debug.Trace.print test4
51− Debug.Trace.print test5
52− Debug.Trace.print test7
53− Debug.Trace.print (test8 100.0)
47+ Control.Monad.Eff.Console.print (test1 1.0)
48+ Control.Monad.Eff.Console.print (test2 1.0 2.0)
49+ Control.Monad.Eff.Console.print test3
50+ Control.Monad.Eff.Console.print test4
51+ Control.Monad.Eff.Console.print test5
52+ Control.Monad.Eff.Console.print test7
53+ Control.Monad.Eff.Console.print (test8 100.0)
examples/passing/Let2.purs+1−1
@@ -14,4 +14,4 @@ test =
1414 x = f 1.0
1515 in not x
1616
17−main = Debug.Trace.print test
17+main = Control.Monad.Eff.Console.print test
examples/passing/LetInInstance.purs+1−1
@@ -11,4 +11,4 @@ instance fooString :: Foo String where
1111 go :: String -> String
1212 go s = s
1313
14−main = Debug.Trace.trace "Done"
14+main = Control.Monad.Eff.Console.log "Done"
examples/passing/LiberalTypeSynonyms.purs+1−1
@@ -18,4 +18,4 @@ f :: (forall r. F r) -> String
1818f g = case g { x: "Hello" } of
1919 { x = x } -> x
2020
21−main = Debug.Trace.trace "Done"
21+main = Control.Monad.Eff.Console.log "Done"
examples/passing/MPTCs.purs+1−1
@@ -17,4 +17,4 @@ instance coerceRefl :: Coerce a a where
1717instance coerceShow :: (Prelude.Show a) => Coerce a String where
1818 coerce = show
1919
20−main = Debug.Trace.trace "Done"
20+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Match.purs+1−1
@@ -6,4 +6,4 @@ data Foo a = Foo
66
77foo = \f -> case f of Foo -> "foo"
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/ModuleExport.purs+1−1
@@ -2,7 +2,7 @@ module A (module Prelude) where
22 import Prelude
33
44module Main where
5− import Debug.Trace
5+ import Control.Monad.Eff.Console
66 import A
77
88 main = do
examples/passing/ModuleExportDupes.purs+1−1
@@ -9,7 +9,7 @@ module C (module Prelude, module A) where
99 import A
1010
1111module Main where
12− import Debug.Trace
12+ import Control.Monad.Eff.Console
1313 import A
1414 import B
1515 import C
examples/passing/ModuleExportExcluded.purs+1−1
@@ -5,7 +5,7 @@ module A (module Prelude, foo) where
55 foo _ = 0.0
66
77module Main where
8− import Debug.Trace
8+ import Control.Monad.Eff.Console
99 import A (foo)
1010
1111 otherwise = false
examples/passing/ModuleExportHiding.purs+1−1
@@ -2,7 +2,7 @@ module A (module Prelude) where
22 import Prelude
33
44module Main where
5− import Debug.Trace
5+ import Control.Monad.Eff.Console
66 import A hiding (module Prelude)
77
88 otherwise = false
examples/passing/ModuleExportQualified.purs+1−1
@@ -2,7 +2,7 @@ module A (module Prelude) where
22 import Prelude
33
44module Main where
5− import Debug.Trace
5+ import Control.Monad.Eff.Console
66 import qualified A as B
77
88 main = do
examples/passing/ModuleExportSelf.purs+1−1
@@ -4,7 +4,7 @@ module A (module A, module Prelude) where
44 type Foo = Boolean
55
66module Main where
7− import Debug.Trace
7+ import Control.Monad.Eff.Console
88 import A
99
1010 bar :: Foo
examples/passing/Monad.purs+1−1
@@ -29,4 +29,4 @@ test1 = test id
2929
3030test2 = test maybe
3131
32−main = Debug.Trace.trace "Done"
32+main = Control.Monad.Eff.Console.log "Done"
examples/passing/MonadState.purs+3−3
@@ -13,10 +13,10 @@ data State s a = State (s -> Tuple s a)
1313runState s (State f) = f s
1414
1515instance functorState :: Functor (State s) where
16− (<$>) = liftM1
16+ map = liftM1
1717
1818instance applyState :: Apply (State s) where
19− (<*>) = ap
19+ apply = ap
2020
2121instance applicativeState :: Applicative (State s) where
2222 pure a = State $ \s -> Tuple s a
@@ -44,5 +44,5 @@ test = runState "" $ do
4444
4545main = do
4646 let t1 = test
47− Debug.Trace.trace "Done"
47+ Control.Monad.Eff.Console.log "Done"
4848
examples/passing/MultiArgFunctions.purs+13−13
@@ -3,7 +3,7 @@ module Main where
33import Prelude
44import Data.Function
55import Control.Monad.Eff
6−import Debug.Trace
6+import Control.Monad.Eff.Console
77
88f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a
99
@@ -12,16 +12,16 @@ g = mkFn2 $ \a b -> case {} of
1212 _ -> runFn2 f (a - 0.0) (b - 0.0)
1313
1414main = do
15− runFn0 (mkFn0 $ \_ -> trace $ show 0.0)
16− runFn1 (mkFn1 $ \a -> trace $ show a) 0.0
17− runFn2 (mkFn2 $ \a b -> trace $ show [a, b]) 0.0 0.0
18− runFn3 (mkFn3 $ \a b c -> trace $ show [a, b, c]) 0.0 0.0 0.0
19− runFn4 (mkFn4 $ \a b c d -> trace $ show [a, b, c, d]) 0.0 0.0 0.0 0.0
20− runFn5 (mkFn5 $ \a b c d e -> trace $ show [a, b, c, d, e]) 0.0 0.0 0.0 0.0 0.0
21− 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
22− 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
23− 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
24− 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
25− 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
15+ runFn0 (mkFn0 $ \_ -> log $ show 0.0)
16+ runFn1 (mkFn1 $ \a -> log $ show a) 0.0
17+ runFn2 (mkFn2 $ \a b -> log $ show [a, b]) 0.0 0.0
18+ runFn3 (mkFn3 $ \a b c -> log $ show [a, b, c]) 0.0 0.0 0.0
19+ runFn4 (mkFn4 $ \a b c d -> log $ show [a, b, c, d]) 0.0 0.0 0.0 0.0
20+ runFn5 (mkFn5 $ \a b c d e -> log $ show [a, b, c, d, e]) 0.0 0.0 0.0 0.0 0.0
21+ runFn6 (mkFn6 $ \a b c d e f -> log $ show [a, b, c, d, e, f]) 0.0 0.0 0.0 0.0 0.0 0.0
22+ runFn7 (mkFn7 $ \a b c d e f g -> log $ show [a, b, c, d, e, f, g]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0
23+ runFn8 (mkFn8 $ \a b c d e f g h -> log $ 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
24+ runFn9 (mkFn9 $ \a b c d e f g h i -> log $ 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
25+ runFn10 (mkFn10 $ \a b c d e f g h i j-> log $ 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
2626 print $ runFn2 g 0.0 0.0
27− trace "Done!"
27+ log "Done!"
examples/passing/MutRec.purs+1−1
@@ -16,4 +16,4 @@ evenToNumber (Even n) = oddToNumber n + 0.0
1616
1717oddToNumber (Odd n) = evenToNumber n + 0.0
1818
19−main = Debug.Trace.trace "Done"
19+main = Control.Monad.Eff.Console.log "Done"
examples/passing/MutRec2.purs+1−1
@@ -16,4 +16,4 @@ g b = case b of B a -> f a
1616showN :: A -> S
1717showN a = f a
1818
19−main = Debug.Trace.trace "Done"
19+main = Control.Monad.Eff.Console.log "Done"
examples/passing/MutRec3.purs+1−1
@@ -16,4 +16,4 @@ g b = case b of B a -> f a
1616showN :: A -> S
1717showN a = f a
1818
19−main = Debug.Trace.trace "Done"
19+main = Control.Monad.Eff.Console.log "Done"
examples/passing/NamedPatterns.purs+1−1
@@ -6,4 +6,4 @@ foo = \x -> case x of
66 y@{ foo = "Foo" } -> y
77 y -> y
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/NegativeBinder.purs+1−1
@@ -6,4 +6,4 @@ test :: Number -> Boolean
66test -1.0 = false
77test _ = true
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Nested.purs+1−1
@@ -6,4 +6,4 @@ data Extend r a = Extend { prev :: r a, next :: a }
66
77data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/NestedTypeSynonyms.purs+1−1
@@ -8,4 +8,4 @@ type Y = X -> X
88fn :: Y
99fn a = a
1010
11−main = Debug.Trace.print (fn "Done")
11+main = Control.Monad.Eff.Console.print (fn "Done")
examples/passing/NestedWhere.purs+1−1
@@ -9,4 +9,4 @@ f x = g x
99 go x = go1 (x - 1.0)
1010 go1 x = go x
1111
12−main = Debug.Trace.trace "Done"
12+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Newtype.purs+3−3
@@ -1,8 +1,8 @@
11module Main where
22
3−import Prelude
3+import Prelude hiding (apply)
44import Control.Monad.Eff
5−import Debug.Trace
5+import Control.Monad.Eff.Console
66
77newtype Thing = Thing String
88
@@ -20,4 +20,4 @@ main = do
2020 print $ Thing "hello"
2121 print $ Box 42.0
2222 print $ apply Box 9000.0
23− trace "Done"
23+ log "Done"
examples/passing/NewtypeEff.purs+8−8
@@ -1,19 +1,19 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55import Control.Monad.Eff
66
7−newtype T a = T (Eff (trace :: Trace) a)
7+newtype T a = T (Eff (console :: CONSOLE) a)
88
9−runT :: forall a. T a -> Eff (trace :: Trace) a
9+runT :: forall a. T a -> Eff (console :: CONSOLE) a
1010runT (T t) = t
1111
1212instance functorT :: Functor T where
13− (<$>) f (T t) = T (f <$> t)
13+ map f (T t) = T (f <$> t)
1414
1515instance applyT :: Apply T where
16− (<*>) (T f) (T x) = T (f <*> x)
16+ apply (T f) (T x) = T (f <*> x)
1717
1818instance applicativeT :: Applicative T where
1919 pure t = T (pure t)
@@ -24,6 +24,6 @@ instance bindT :: Bind T where
2424instance monadT :: Monad T
2525
2626main = runT do
27− T $ trace "Done"
28− T $ trace "Done"
29− T $ trace "Done"
27+ T $ log "Done"
28+ T $ log "Done"
29+ T $ log "Done"
examples/passing/NewtypeWithRecordUpdate.purs+2−2
@@ -3,7 +3,7 @@
33module Main where
44
55import Prelude
6−import Debug.Trace
6+import Control.Monad.Eff.Console
77
88newtype NewType a = NewType (Object a)
99
@@ -13,4 +13,4 @@ rec1 = { a: 0.0, b: 0.0, c: 0.0 }
1313rec2 :: NewType (a :: Number, b :: Number, c :: Number)
1414rec2 = NewType (rec1 { a = 1.0 })
1515
16−main = trace "Done"
16+main = log "Done"
examples/passing/ObjectGetter.purs+4−4
@@ -7,7 +7,7 @@ getX = _.x
77point = { x: 1.0, y: 0.0 }
88
99main = do
10− Debug.Trace.print $ getX point
11− Debug.Trace.trace $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }
12− Debug.Trace.trace $ (_.x >>> _.y) { x: { y: "Nested" } }
13− Debug.Trace.trace $ _.value { value: "Done!" }
10+ Control.Monad.Eff.Console.print $ getX point
11+ Control.Monad.Eff.Console.log $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }
12+ Control.Monad.Eff.Console.log $ (_.x >>> _.y) { x: { y: "Nested" } }
13+ Control.Monad.Eff.Console.log $ _.value { value: "Done!" }
examples/passing/ObjectSynonym.purs+1−1
@@ -12,4 +12,4 @@ type Outer = { inner :: Inner }
1212outer :: Outer
1313outer = { inner: inner }
1414
15−main = Debug.Trace.trace "Done"
15+main = Control.Monad.Eff.Console.log "Done"
examples/passing/ObjectUpdate.purs+1−1
@@ -17,4 +17,4 @@ polyUpdate = \o -> o { foo = "Foo" }
1717
1818inferPolyUpdate = \o -> o { foo = "Foo" }
1919
20−main = Debug.Trace.trace ((update1 {foo: ""}).foo)
20+main = Control.Monad.Eff.Console.log ((update1 {foo: ""}).foo)
examples/passing/ObjectUpdate2.purs+1−1
@@ -14,4 +14,4 @@ test = blah x
1414 { baz = "blah"
1515 }
1616
17−main = Debug.Trace.trace "Done"
17+main = Control.Monad.Eff.Console.log "Done"
examples/passing/ObjectUpdater.purs+2−2
@@ -2,8 +2,8 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
6−import Assert
5+import Control.Monad.Eff.Console
6+import Test.Assert
77
88getValue :: forall e. Eff (| e) Boolean
99getValue = return true
examples/passing/ObjectWildcards.purs+3−3
@@ -2,8 +2,8 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
6−import Assert
5+import Control.Monad.Eff.Console
6+import Test.Assert
77
88mkRecord = { foo: _, bar: _, baz: "baz" }
99
@@ -17,4 +17,4 @@ main = do
1717 point <- { x: _, y: x } <$> return 2.0
1818 assert $ point.x == 2.0
1919 assert $ point.y == 1.0
20− trace (mkRecord 1.0 "Done!").bar
20+ log (mkRecord 1.0 "Done!").bar
examples/passing/Objects.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude
3+import Prelude hiding (append)
44
55test = \x -> x.foo + x.bar + 1.0
66
@@ -32,4 +32,4 @@ test6 = case { "***": 1.0 } of
3232
3333test7 {a: snoog , b : blah } = blah
3434
35−main = Debug.Trace.trace "Done"
35+main = Control.Monad.Eff.Console.log "Done"
examples/passing/OneConstructor.purs+1−1
@@ -6,4 +6,4 @@ data One a = One a
66
77one' (One a) = a
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/OperatorAssociativity.purs+3−3
@@ -2,8 +2,8 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
6−import Assert
5+import Control.Monad.Eff.Console
6+import Test.Assert
77
88bug :: Number -> Number -> Number
99bug a b = 0.0 - (a - b)
@@ -22,4 +22,4 @@ main = do
2222 assert (1.0 + 10.0 - 5.0 == 6.0)
2323 assert (1.0 + 10.0 * 5.0 == 51.0)
2424 assert (10.0 * 5.0 - 1.0 == 49.0)
25− trace "Success!"
25+ log "Success!"
examples/passing/OperatorInlining.purs+1−1
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66main = do
77
examples/passing/OperatorSections.purs+2−2
@@ -1,11 +1,11 @@
11module Main where
22
33import Prelude
4−import Assert
4+import Test.Assert
55
66main = do
77 assert $ (/ 2.0) 4.0 == 2.0
88 assert $ (2.0 /) 4.0 == 0.5
99 assert $ (`const` 1.0) 2.0 == 2.0
1010 assert $ (1.0 `const`) 2.0 == 1.0
11− Debug.Trace.trace "Done!"
11+ Control.Monad.Eff.Console.log "Done!"
examples/passing/Operators.purs+2−2
@@ -2,7 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
5+import Control.Monad.Eff.Console
66
77(?!) :: forall a. a -> a -> a
88(?!) x _ = x
@@ -96,4 +96,4 @@ main = do
9696 let t18 = test18
9797 let t19 = test19
9898 let t20 = test20
99− trace "Done"
99+ log "Done"
examples/passing/OptimizerBug.purs+1−1
@@ -6,4 +6,4 @@ x a = 1.0 + y a
66
77y a = x a
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/PartialFunction.purs+2−2
@@ -1,10 +1,10 @@
11module Main where
22
33import Prelude
4−import Assert
4+import Test.Assert
55
66fn :: Number -> Number
77fn 0.0 = 0.0
88fn 1.0 = 2.0
99
10−main = assertPartial $ \_ -> fn 2.0
10+main = assertThrows $ \_ -> fn 2.0
examples/passing/Patterns.purs+1−1
@@ -19,4 +19,4 @@ isDesc :: Array Number -> Boolean
1919isDesc [x, y] | x > y = true
2020isDesc _ = false
2121
22−main = Debug.Trace.trace "Done"
22+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Person.purs+1−1
@@ -8,4 +8,4 @@ showPerson :: Person -> String
88showPerson = \p -> case p of
99 Person o -> o.name ++ ", aged " ++ show o.age
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Rank2Data.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude
3+import Prelude hiding (add)
44
55data Id = Id forall a. a -> a
66
@@ -26,4 +26,4 @@ two = succ zero'
2626four = add two two
2727fourNumber = runNat four
2828
29−main = Debug.Trace.trace "Done'"
29+main = Control.Monad.Eff.Console.log "Done'"
examples/passing/Rank2Object.purs+2−2
@@ -1,11 +1,11 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66data Foo = Foo { id :: forall a. a -> a }
77
88foo :: Foo -> Number
99foo (Foo { id = f }) = f 0.0
1010
11−main = trace "Done"
11+main = log "Done"
examples/passing/Rank2TypeSynonym.purs+1−1
@@ -13,4 +13,4 @@ bar = foo 3.0
1313
1414main = do
1515 x <- bar
16− Debug.Trace.print x
16+ Control.Monad.Eff.Console.print x
examples/passing/Rank2Types.purs+1−1
@@ -8,4 +8,4 @@ test1 = \f -> f 0.0
88forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
99forever = \bind action -> bind action $ \_ -> forever bind action
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/RebindableSyntax.purs+4−4
@@ -20,10 +20,10 @@ runConst :: forall a b. Const a b -> a
2020runConst (Const a) = a
2121
2222instance functorConst :: Functor (Const a) where
23− (<$>) _ (Const a) = Const a
23+ map _ (Const a) = Const a
2424
2525instance applyConst :: (Semigroup a) => Apply (Const a) where
26− (<*>) (Const a1) (Const a2) = Const (a1 <> a2)
26+ apply (Const a1) (Const a2) = Const (a1 <> a2)
2727
2828example2 :: Const String Unit
2929example2 = do
@@ -35,5 +35,5 @@ example2 = do
3535 bind x f = x *> f unit
3636
3737main = do
38− Debug.Trace.trace example1
39− Debug.Trace.trace $ runConst example2
38+ Control.Monad.Eff.Console.log example1
39+ Control.Monad.Eff.Console.log $ runConst example2
examples/passing/Recursion.purs+1−1
@@ -7,4 +7,4 @@ fib = \n -> case n of
77 1.0 -> 1.0
88 n -> fib (n - 1.0) + fib (n - 2.0)
99
10−main = Debug.Trace.trace "Done"
10+main = Control.Monad.Eff.Console.log "Done"
examples/passing/ReservedWords.purs+1−1
@@ -12,4 +12,4 @@ p = o { type = "p" }
1212f :: forall r. { type :: String | r } -> String
1313f { type = "p" } = "Done"
1414
15−main = Debug.Trace.trace $ f { type: p.type, foo: "bar" }
15+main = Control.Monad.Eff.Console.log $ f { type: p.type, foo: "bar" }
examples/passing/RowConstructors.purs+1−1
@@ -39,4 +39,4 @@ wildcard { w: w } = { x: w, y: w, z: w, w: w }
3939wildcard' :: { | Quux _ } -> Number
4040wildcard' { q: q } = q
4141
42−main = Debug.Trace.trace "Done"
42+main = Control.Monad.Eff.Console.log "Done"
examples/passing/RowPolyInstanceContext.purs+1−1
@@ -19,4 +19,4 @@ test2 = state $ \o -> o { foo = o.foo ++ "!" }
1919main = do
2020 let t1 = test1
2121 let t2 = test2
22− Debug.Trace.trace "Done"
22+ Control.Monad.Eff.Console.log "Done"
examples/passing/RuntimeScopeIssue.purs+1−1
@@ -16,4 +16,4 @@ instance bNumber :: B Number where
1616 b 0.0 = false
1717 b n = a (n - 1.0)
1818
19−main = Debug.Trace.print $ a 10.0
19+main = Control.Monad.Eff.Console.print $ a 10.0
examples/passing/ScopedTypeVariables.purs+1−1
@@ -33,4 +33,4 @@ test4 = h
3333 j x = x
3434
3535
36−main = Debug.Trace.trace "Done"
36+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Sequence.purs+1−1
@@ -12,4 +12,4 @@ instance sequenceList :: Sequence List where
1212 sequence Nil = pure Nil
1313 sequence (Cons x xs) = Cons <$> x <*> sequence xs
1414
15−main = sequence $ Cons (Debug.Trace.trace "Done") Nil
15+main = sequence $ Cons (Control.Monad.Eff.Console.log "Done") Nil
examples/passing/SequenceDesugared.purs+4−4
@@ -31,7 +31,7 @@ sequenceList''' = Sequence ((\val -> case val of
3131 Cons x xs -> Cons <$> x <*> sequence sequenceList''' xs) :: forall m a. (Monad m) => List (m a) -> m (List a))
3232
3333main = do
34− sequence sequenceList $ Cons (Debug.Trace.trace "Done") Nil
35− sequence sequenceList' $ Cons (Debug.Trace.trace "Done") Nil
36− sequence sequenceList'' $ Cons (Debug.Trace.trace "Done") Nil
37− sequence sequenceList''' $ Cons (Debug.Trace.trace "Done") Nil
34+ sequence sequenceList $ Cons (Control.Monad.Eff.Console.log "Done") Nil
35+ sequence sequenceList' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
36+ sequence sequenceList'' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
37+ sequence sequenceList''' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
examples/passing/ShadowedRename.purs+3−3
@@ -2,8 +2,8 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5−import Debug.Trace
6−import Assert
5+import Control.Monad.Eff.Console
6+import Test.Assert
77
88foo foo = let foo_1 = \_ -> foo
99 foo_2 = foo_1 unit + 1.0
@@ -11,4 +11,4 @@ foo foo = let foo_1 = \_ -> foo
1111
1212main = do
1313 assert $ foo 1.0 == 2.0
14− trace "Done"
14+ log "Done"
examples/passing/ShadowedTCO.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude
3+import Prelude hiding (add)
44
55runNat f = f 0.0 (\n -> n + 1.0)
66
@@ -15,4 +15,4 @@ two = succ one'
1515four = add two two
1616fourNumber = runNat four
1717
18−main = Debug.Trace.trace $ show fourNumber
18+main = Control.Monad.Eff.Console.log $ show fourNumber
examples/passing/ShadowedTCOLet.purs+1−1
@@ -6,4 +6,4 @@ f x y z =
66 let f 1.0 2.0 3.0 = 1.0
77 in f x z y
88
9−main = Debug.Trace.trace $ show $ f 1.0 3.0 2.0
9+main = Control.Monad.Eff.Console.log $ show $ f 1.0 3.0 2.0
examples/passing/SignedNumericLiterals.purs+1−1
@@ -14,4 +14,4 @@ f x = -x
1414
1515test1 = 2.0 - 1.0
1616
17−main = Debug.Trace.trace "Done"
17+main = Control.Monad.Eff.Console.log "Done"
examples/passing/Superclasses1.purs+1−1
@@ -17,4 +17,4 @@ instance clNumber :: Cl Number where
1717test :: forall a. (Cl a) => a -> a
1818test a = su (cl a a)
1919
20−main = Debug.Trace.print $ test 10.0
20+main = Control.Monad.Eff.Console.print $ test 10.0
examples/passing/Superclasses2.purs+1−2
@@ -1,7 +1,6 @@
11module Main where
22
33import Prelude
4−import Prelude.Unsafe (unsafeIndex)
54
65class Su a where
76 su :: a -> a
@@ -21,4 +20,4 @@ instance clNumber :: Cl Number where
2120test :: forall a. (Cl a) => a -> Array a
2221test x = su [cl x x]
2322
24−main = Debug.Trace.print $ test 10.0 `unsafeIndex` 0.0
23+main = Control.Monad.Eff.Console.print $ test 10.0
examples/passing/Superclasses3.purs+6−6
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55import Control.Monad.Eff
66
77class (Monad m) <= MonadWriter w m where
@@ -16,16 +16,16 @@ test w = do
1616 tell w
1717 tell w
1818
19−data MTrace a = MTrace (Eff (trace :: Trace) a)
19+data MTrace a = MTrace (Eff (console :: CONSOLE) a)
2020
21−runMTrace :: forall a. MTrace a -> Eff (trace :: Trace) a
21+runMTrace :: forall a. MTrace a -> Eff (console :: CONSOLE) a
2222runMTrace (MTrace a) = a
2323
2424instance functorMTrace :: Functor MTrace where
25− (<$>) = liftM1
25+ map = liftM1
2626
2727instance applyMTrace :: Apply MTrace where
28− (<*>) = ap
28+ apply = ap
2929
3030instance applicativeMTrace :: Applicative MTrace where
3131 pure = MTrace <<< return
@@ -36,6 +36,6 @@ instance bindMTrace :: Bind MTrace where
3636instance monadMTrace :: Monad MTrace
3737
3838instance writerMTrace :: MonadWriter String MTrace where
39− tell s = MTrace (trace s)
39+ tell s = MTrace (log s)
4040
4141main = runMTrace $ test "Done"
examples/passing/TCOCase.purs+1−1
@@ -4,7 +4,7 @@ import Prelude
44
55data Data = One | More Data
66
7−main = Debug.Trace.trace (from (to 10000.0 One))
7+main = Control.Monad.Eff.Console.log (from (to 10000.0 One))
88 where
99 to 0.0 a = a
1010 to n a = to (n - 1.0) (More a)
examples/passing/TailCall.purs+1−1
@@ -14,4 +14,4 @@ loop x = loop (x + 1.0)
1414notATailCall = \x ->
1515 (\notATailCall -> notATailCall x) (\x -> x)
1616
17−main = Debug.Trace.print (test 0.0 (1.0 `C` (2.0 `C` (3.0 `C` N))))
17+main = Control.Monad.Eff.Console.print (test 0.0 (1.0 `C` (2.0 `C` (3.0 `C` N))))
examples/passing/Tick.purs+1−1
@@ -4,4 +4,4 @@ import Prelude
44
55test' x = x
66
7−main = Debug.Trace.trace "Done"
7+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TopLevelCase.purs+3−3
@@ -5,8 +5,8 @@ import Prelude
55gcd :: Number -> Number -> Number
66gcd 0.0 x = x
77gcd x 0.0 = x
8−gcd x y | x > y = gcd (x % y) y
9−gcd x y = gcd (y % x) x
8+gcd x y | x > y = gcd (x `mod` y) y
9+gcd x y = gcd (y `mod` x) x
1010
1111guardsTest [x] | x > 0.0 = []
1212guardsTest xs = xs
@@ -15,4 +15,4 @@ data A = A
1515
1616parseTest A 0.0 = 0.0
1717
18−main = Debug.Trace.trace "Done"
18+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeClassMemberOrderChange.purs+1−1
@@ -10,4 +10,4 @@ instance testBoolean :: Test Boolean where
1010 val = true
1111 fn x y = y
1212
13−main = Debug.Trace.trace (show (fn true val))
13+main = Control.Monad.Eff.Console.log (show (fn true val))
examples/passing/TypeClasses.purs+5−5
@@ -22,10 +22,10 @@ instance showData :: (Prelude.Show a) => Prelude.Show (Data a) where
2222test3 = \_ -> show (Data "testing")
2323
2424instance functorData :: Functor Data where
25− (<$>) = liftM1
25+ map = liftM1
2626
2727instance applyData :: Apply Data where
28− (<*>) = ap
28+ apply = ap
2929
3030instance applicativeData :: Applicative Data where
3131 pure = Data
@@ -38,10 +38,10 @@ instance monadData :: Monad Data
3838data Maybe a = Nothing | Just a
3939
4040instance functorMaybe :: Functor Maybe where
41− (<$>) = liftM1
41+ map = liftM1
4242
4343instance applyMaybe :: Apply Maybe where
44− (<*>) = ap
44+ apply = ap
4545
4646instance applicativeMaybe :: Applicative Maybe where
4747 pure = Just
@@ -65,5 +65,5 @@ test9 _ = runReader 0.0 $ do
6565 n <- ask
6666 return $ n + 1.0
6767
68−main = Debug.Trace.trace (test7 "Done")
68+main = Control.Monad.Eff.Console.log (test7 "Done")
6969
examples/passing/TypeClassesInOrder.purs+1−1
@@ -8,4 +8,4 @@ class Foo a where
88instance fooString :: Foo String where
99 foo s = s
1010
11−main = Debug.Trace.trace $ foo "Done"
11+main = Control.Monad.Eff.Console.log $ foo "Done"
examples/passing/TypeClassesWithOverlappingTypeVariables.purs+3−3
@@ -5,7 +5,7 @@ import Prelude
55data Either a b = Left a | Right b
66
77instance functorEither :: Prelude.Functor (Either a) where
8− (<$>) _ (Left x) = Left x
9− (<$>) f (Right y) = Right (f y)
8+ map _ (Left x) = Left x
9+ map f (Right y) = Right (f y)
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeDecl.purs+1−1
@@ -9,4 +9,4 @@ iterate :: forall a. Number -> (a -> a) -> a -> a
99iterate 0.0 f a = a
1010iterate n f a = iterate (n - 1.0) f (f a)
1111
12−main = Debug.Trace.trace "Done"
12+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeSynonymInData.purs+1−1
@@ -8,4 +8,4 @@ data Foo a = Foo (A a) | Bar
88
99foo (Foo []) = Bar
1010
11−main = Debug.Trace.trace "Done"
11+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeSynonyms.purs+1−1
@@ -24,4 +24,4 @@ fst =
2424test1 :: forall a b c. Lens (Pair (Pair a b) c) a
2525test1 = composeLenses fst fst
2626
27−main = Debug.Trace.trace "Done"
27+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeWildcards.purs+1−1
@@ -12,4 +12,4 @@ test f a = go (f a) a
1212 go a1 a2 | a1 == a2 = a1
1313 go a1 _ = go (f a1) a1
1414
15−main = Debug.Trace.trace "Done"
15+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeWildcardsRecordExtension.purs+1−1
@@ -5,4 +5,4 @@ import Prelude
55foo :: forall a. {b :: Number | a} -> {b :: Number | _}
66foo f = f
77
8−main = Debug.Trace.trace "Done"
8+main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypedWhere.purs+1−1
@@ -14,4 +14,4 @@ lefts = go N
1414 go ls (C (L a) rest) = go (C a ls) rest
1515 go ls (C _ rest) = go ls rest
1616
17−main = Debug.Trace.trace "Done"
17+main = Control.Monad.Eff.Console.log "Done"
examples/passing/UnderscoreIdent.purs+1−1
@@ -8,4 +8,4 @@ type Type_name = Data_type
88
99done (Con_2 s) = s
1010
11−main = Debug.Trace.trace (done (Con_2 "Done"))
11+main = Control.Monad.Eff.Console.log (done (Con_2 "Done"))
examples/passing/Unit.purs+1−1
@@ -1,6 +1,6 @@
11module Main where
22
33import Prelude
4−import Debug.Trace
4+import Control.Monad.Eff.Console
55
66main = print (const unit $ "Hello world")
examples/passing/UnknownInTypeClassLookup.purs+1−1
@@ -11,4 +11,4 @@ test _ _ = "Done"
1111
1212runTest a = test a a
1313
14−main = Debug.Trace.trace $ runTest 0.0
14+main = Control.Monad.Eff.Console.log $ runTest 0.0
examples/passing/Where.purs+7−7
@@ -40,10 +40,10 @@ test7 x = go x
4040 go y = go $ (y + x / y) / 2.0
4141
4242main = do
43− Debug.Trace.print (test1 1.0)
44− Debug.Trace.print (test2 1.0 2.0)
45− Debug.Trace.print test3
46− Debug.Trace.print test4
47− Debug.Trace.print test5
48− Debug.Trace.print test6
49− Debug.Trace.print (test7 100.0)
43+ Control.Monad.Eff.Console.print (test1 1.0)
44+ Control.Monad.Eff.Console.print (test2 1.0 2.0)
45+ Control.Monad.Eff.Console.print test3
46+ Control.Monad.Eff.Console.print test4
47+ Control.Monad.Eff.Console.print test5
48+ Control.Monad.Eff.Console.print test6
49+ Control.Monad.Eff.Console.print (test7 100.0)
examples/passing/iota.purs+1−1
@@ -6,4 +6,4 @@ k = \x -> \y -> x
66
77iota = \x -> x s k
88
9−main = Debug.Trace.trace "Done"
9+main = Control.Monad.Eff.Console.log "Done"
examples/passing/s.purs+1−1
@@ -4,4 +4,4 @@ import Prelude
44
55s = \x y z -> x z (y z)
66
7−main = Debug.Trace.trace "Done"
7+main = Control.Monad.Eff.Console.log "Done"
psci/Completion.hs+9−6
@@ -6,6 +6,7 @@ import Data.Char (isUpper)
66import Data.Function (on)
77import Data.Traversable (traverse)
88
9+import Control.Arrow (second)
910import Control.Applicative ((<$>), (<*>))
1011import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT)
1112import Control.Monad.Trans.State.Strict
@@ -196,13 +197,15 @@ typeDecls = mapMaybe getTypeName . filter P.isDataDecl . P.exportedDeclarations
196197 getTypeName _ = Nothing
197198
198199identNames :: P.Module -> [(N.Ident, P.Declaration)]
199−identNames = nubOnFst . mapMaybe getDeclName . P.exportedDeclarations
200+identNames = nubOnFst . concatMap getDeclNames . P.exportedDeclarations
200201 where
201− getDeclName :: P.Declaration -> Maybe (P.Ident, P.Declaration)
202− getDeclName d@(P.ValueDeclaration ident _ _ _) = Just (ident, d)
203− getDeclName d@(P.ExternDeclaration ident _) = Just (ident, d)
204− getDeclName (P.PositionedDeclaration _ _ d) = getDeclName d
205− getDeclName _ = Nothing
202+ getDeclNames :: P.Declaration -> [(P.Ident, P.Declaration)]
203+ getDeclNames d@(P.ValueDeclaration ident _ _ _) = [(ident, d)]
204+ getDeclNames d@(P.TypeDeclaration ident _ ) = [(ident, d)]
205+ getDeclNames d@(P.ExternDeclaration ident _) = [(ident, d)]
206+ getDeclNames d@(P.TypeClassDeclaration _ _ _ ds) = map (second (const d)) $ concatMap getDeclNames ds
207+ getDeclNames (P.PositionedDeclaration _ _ d) = getDeclNames d
208+ getDeclNames _ = []
206209
207210dctorNames :: P.Module -> [(N.ProperName, P.Declaration)]
208211dctorNames = nubOnFst . concatMap go . P.exportedDeclarations
psci/tests/Main.hs+35−29
@@ -8,12 +8,13 @@ import Control.Applicative
88import Control.Monad.Writer (runWriterT)
99import Control.Monad.Trans.Except (runExceptT)
1010
11−import Data.List (isSuffixOf, sort)
11+import Data.List (sort)
1212
1313import System.Exit (exitFailure)
1414import System.Console.Haskeline
1515import System.FilePath ((</>))
16−import System.Directory (getCurrentDirectory, getDirectoryContents)
16+import System.Directory (getCurrentDirectory)
17+import qualified System.FilePath.Glob as Glob
1718
1819import Test.HUnit
1920
@@ -48,9 +49,14 @@ completionTestData =
4849 , (":mo", [":module"])
4950 , (":b", [":browse"])
5051
51− -- :browse should complete modules
52− , (":b Prel", [":b Prelude", ":b Prelude.Unsafe"])
53− , (":b Prelude.", [":b Prelude.Unsafe"])
52+ -- :browse should complete module names
53+ , (":b Control.Monad.E", map (":b Control.Monad.Eff" ++) ["", ".Unsafe", ".Class", ".Console"])
54+ , (":b Control.Monad.Eff.", map (":b Control.Monad.Eff" ++) [".Unsafe", ".Class", ".Console"])
55+
56+ -- import should complete module names
57+ , ("import Control.Monad.E", map ("import Control.Monad.Eff" ++) ["", ".Unsafe", ".Class", ".Console"])
58+ , ("import Control.Monad.Eff.", map ("import Control.Monad.Eff" ++) [".Unsafe", ".Class", ".Console"])
59+ , ("import qualified Control.Monad.Eff.", map ("import qualified Control.Monad.Eff" ++) [".Unsafe", ".Class", ".Console"])
5460
5561 -- :load, :module should complete file paths
5662 , (":l psci/tests/data/", [":l psci/tests/data/Sample.purs"])
@@ -66,8 +72,8 @@ completionTestData =
6672 , (":show a", [])
6773
6874 -- :type should complete values and data constructors in scope
69− , (":type Prelude.Unsafe.un", [":type Prelude.Unsafe.unsafeIndex"])
70− , (":type un", [":type unit"])
75+ , (":type Control.Monad.Eff.Console.lo", [":type Control.Monad.Eff.Console.log"])
76+ , (":type uni", [":type unit"])
7177 , (":type E", [":type EQ"])
7278
7379 -- :kind should complete types in scope
@@ -79,25 +85,19 @@ completionTestData =
7985 , (":type EQ ", [])
8086 , (":kind Ordering ", [])
8187
82− -- import should complete module names
83− , ("import Control.Monad.S", ["import Control.Monad.ST"])
84− , ("import qualified Control.Monad.S", ["import qualified Control.Monad.ST"])
85− , ("import Control.Monad.", map ("import Control.Monad." ++)
86− ["Eff", "ST"])
87−
8888 -- a few other import tests
8989 , ("impor", ["import"])
9090 , ("import q", ["import qualified"])
91− , ("import ", map ("import " ++) allModuleNames ++ ["import qualified"])
92− , ("import Prelude.Unsafe ", [])
91+ , ("import ", map ("import " ++) supportModules ++ ["import qualified"])
92+ , ("import Prelude ", [])
9393
9494 -- String and number literals should not be completed
9595 , ("\"hi", [])
9696 , ("34", [])
9797
9898 -- Identifiers and data constructors should be completed
99− , ("un", ["unit"])
100− , ("Debug.Trace.", map ("Debug.Trace." ++) ["print", "trace"])
99+ , ("uni", ["unit"])
100+ , ("Control.Monad.Eff.Class.", ["Control.Monad.Eff.Class.liftEff"])
101101 , ("G", ["GT"])
102102 , ("Prelude.L", ["Prelude.LT"])
103103
@@ -107,14 +107,6 @@ completionTestData =
107107 , ("Control.Monad.ST.new", ["Control.Monad.ST.newSTRef"])
108108 ]
109109 where
110− allModuleNames = [ "Assert"
111− , "Control.Monad.Eff"
112− , "Control.Monad.ST"
113− , "Data.Function"
114− , "Debug.Trace"
115− , "Prelude"
116− , "Prelude.Unsafe"
117− ]
118110
119111assertCompletedOk :: (String, [String]) -> Assertion
120112assertCompletedOk (line, expecteds) = do
@@ -131,10 +123,12 @@ runCM act = do
131123getPSCiState :: IO PSCiState
132124getPSCiState = do
133125 cwd <- getCurrentDirectory
134− let preludeDir = cwd </> "tests" </> "prelude"
135− jsDir = preludeDir </> "js"
136− modulesOrFirstError <- loadAllModules [ preludeDir </> "Prelude.purs" ]
137− jsFiles <- map (jsDir </>) . filter (".js" `isSuffixOf`) <$> getDirectoryContents jsDir
126+ let supportDir = cwd </> "tests" </> "support" </> "flattened"
127+ let supportFiles ext = Glob.globDir1 (Glob.compile ("*." ++ ext)) supportDir
128+ pursFiles <- supportFiles "purs"
129+ jsFiles <- supportFiles "js"
130+
131+ modulesOrFirstError <- loadAllModules pursFiles
138132 foreignFiles <- forM jsFiles (\f -> (f,) <$> readFile f)
139133 Right (foreigns, _) <- runExceptT $ runWriterT $ P.parseForeignModulesFromFiles foreignFiles
140134 case modulesOrFirstError of
@@ -148,3 +142,15 @@ controlMonadSTasST :: ImportedModule
148142controlMonadSTasST = (s "Control.Monad.ST", P.Implicit, Just (s "ST"))
149143 where
150144 s = P.moduleNameFromString
145+
146+supportModules :: [String]
147+supportModules =
148+ [ "Control.Monad.Eff.Class"
149+ , "Control.Monad.Eff.Console"
150+ , "Control.Monad.Eff"
151+ , "Control.Monad.Eff.Unsafe"
152+ , "Control.Monad.ST"
153+ , "Data.Function"
154+ , "Prelude"
155+ , "Test.Assert"
156+ ]
purescript.cabal+4−3
@@ -20,8 +20,8 @@ tested-with: GHC==7.8
2020
2121extra-source-files: examples/passing/*.purs
2222 , examples/failing/*.purs
23− , tests/prelude/*.purs
24− , tests/prelude/js/*.js
23+ , tests/support/flattened/*.purs
24+ , tests/support/flattened/*.js
2525
2626source-repository head
2727 type: git
@@ -236,7 +236,8 @@ executable psc-bundle
236236test-suite tests
237237 build-depends: base >=4 && <5, containers -any, directory -any,
238238 filepath -any, mtl -any, parsec -any, purescript -any,
239− transformers -any, process -any, transformers-compat -any, time -any
239+ transformers -any, process -any, transformers-compat -any, time -any,
240+ Glob -any
240241 type: exitcode-stdio-1.0
241242 main-is: Main.hs
242243 buildable: True
tests/Main.hs+48−32
@@ -13,7 +13,7 @@
1313-----------------------------------------------------------------------------
1414
1515{-# LANGUAGE DataKinds #-}
16−{-# LANGUAGE DoAndIfThenElse #-}
16+{-# LANGUAGE DoAndIfThenElse #-}
1717{-# LANGUAGE TupleSections #-}
1818{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1919{-# LANGUAGE FlexibleInstances #-}
@@ -44,6 +44,7 @@ import System.Exit
4444import System.Process
4545import System.FilePath
4646import System.Directory
47+import qualified System.FilePath.Glob as Glob
4748
4849import Text.Parsec (ParseError)
4950
@@ -60,31 +61,23 @@ makeActions :: M.Map P.ModuleName (FilePath, P.ForeignJS) -> P.MakeActions Test
6061makeActions foreigns = P.MakeActions getInputTimestamp getOutputTimestamp readExterns codegen progress
6162 where
6263 getInputTimestamp :: P.ModuleName -> Test (Either P.RebuildPolicy (Maybe UTCTime))
63− getInputTimestamp mn
64− | isPreludeModule (P.runModuleName mn) = return (Left P.RebuildNever)
64+ getInputTimestamp mn
65+ | isSupportModule (P.runModuleName mn) = return (Left P.RebuildNever)
6566 | otherwise = return (Left P.RebuildAlways)
6667 where
67− isPreludeModule = flip elem
68− [ "Prelude.Unsafe"
69− , "Prelude"
70− , "Data.Function"
71− , "Control.Monad.Eff"
72− , "Control.Monad.ST"
73− , "Debug.Trace"
74− , "Assert"
75− ]
76−
68+ isSupportModule = flip elem supportModules
69+
7770 getOutputTimestamp :: P.ModuleName -> Test (Maybe UTCTime)
7871 getOutputTimestamp mn = do
7972 let filePath = modulesDir </> P.runModuleName mn
8073 exists <- liftIO $ doesDirectoryExist filePath
8174 return (if exists then Just (error "getOutputTimestamp: read timestamp") else Nothing)
82−
75+
8376 readExterns :: P.ModuleName -> Test (FilePath, String)
8477 readExterns mn = do
8578 let filePath = modulesDir </> P.runModuleName mn </> "externs.purs"
8679 (filePath, ) <$> readTextFile filePath
87−
80+
8881 codegen :: CF.Module CF.Ann -> P.Environment -> P.SupplyVar -> P.Externs -> Test ()
8982 codegen m _ nextVar exts = do
9083 let mn = CF.moduleName m
@@ -101,15 +94,15 @@ makeActions foreigns = P.MakeActions getInputTimestamp getOutputTimestamp readEx
10194 writeTextFile jsFile pjs
10295 maybe (return ()) (writeTextFile foreignFile . snd) $ CF.moduleName m `M.lookup` foreigns
10396 writeTextFile externsFile exts
104−
97+
10598 readTextFile :: FilePath -> Test String
10699 readTextFile path = liftIO $ readFile path
107−
100+
108101 writeTextFile :: FilePath -> String -> Test ()
109102 writeTextFile path text = liftIO $ do
110103 createDirectoryIfMissing True (takeDirectory path)
111104 writeFile path text
112−
105+
113106 progress :: String -> Test ()
114107 progress = liftIO . putStrLn
115108
@@ -124,9 +117,9 @@ compile inputFiles foreigns = runTest $ do
124117 ms <- P.parseModulesFromFiles id fs
125118 P.make (makeActions foreigns) (map (\(k, v) -> (Right k, v)) ms)
126119
127−assert :: [FilePath] ->
128− M.Map P.ModuleName (FilePath, P.ForeignJS) ->
129− (Either P.MultipleErrors P.Environment -> IO (Maybe String)) ->
120+assert :: [FilePath] ->
121+ M.Map P.ModuleName (FilePath, P.ForeignJS) ->
122+ (Either P.MultipleErrors P.Environment -> IO (Maybe String)) ->
130123 IO ()
131124assert inputFiles foreigns f = do
132125 e <- compile inputFiles foreigns
@@ -139,7 +132,7 @@ assertCompiles :: [FilePath] -> M.Map P.ModuleName (FilePath, P.ForeignJS) -> IO
139132assertCompiles inputFiles foreigns = do
140133 putStrLn $ "Assert " ++ last inputFiles ++ " compiles successfully"
141134 assert inputFiles foreigns $ \e ->
142− case e of
135+ case e of
143136 Left errs -> return . Just . P.prettyPrintMultipleErrors False $ errs
144137 Right _ -> do
145138 process <- findNodeProcess
@@ -161,26 +154,49 @@ assertDoesNotCompile inputFiles foreigns = do
161154
162155findNodeProcess :: IO (Maybe String)
163156findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
164− where
157+ where
165158 names = ["nodejs", "node"]
166159
167160main :: IO ()
168161main = do
162+ fetchSupportCode
169163 cwd <- getCurrentDirectory
170−
171− let preludeDir = cwd </> "tests" </> "prelude"
172− preludePurs = preludeDir </> "Prelude.purs"
173− jsDir = preludeDir </> "js"
174− jsFiles <- map (jsDir </>) . filter (".js" `isSuffixOf`) <$> getDirectoryContents jsDir
175− foreignFiles <- forM jsFiles (\f -> (f,) <$> readFile f)
164+
165+ let supportDir = cwd </> "tests" </> "support" </> "flattened"
166+ let supportFiles ext = Glob.globDir1 (Glob.compile ("*." ++ ext)) supportDir
167+
168+ supportPurs <- supportFiles "purs"
169+ supportJS <- supportFiles "js"
170+
171+ foreignFiles <- forM supportJS (\f -> (f,) <$> readFile f)
176172 Right (foreigns, _) <- runExceptT $ runWriterT $ P.parseForeignModulesFromFiles foreignFiles
177−
173+
178174 let passing = cwd </> "examples" </> "passing"
179175 passingTestCases <- getDirectoryContents passing
180176 forM_ passingTestCases $ \inputFile -> when (".purs" `isSuffixOf` inputFile) $
181− assertCompiles [preludePurs, passing </> inputFile] foreigns
177+ assertCompiles (supportPurs ++ [passing </> inputFile]) foreigns
182178 let failing = cwd </> "examples" </> "failing"
183179 failingTestCases <- getDirectoryContents failing
184180 forM_ failingTestCases $ \inputFile -> when (".purs" `isSuffixOf` inputFile) $
185− assertDoesNotCompile [preludePurs, failing </> inputFile] foreigns
181+ assertDoesNotCompile (supportPurs ++ [failing </> inputFile]) foreigns
186182 exitSuccess
183+
184+fetchSupportCode :: IO ()
185+fetchSupportCode = do
186+ setCurrentDirectory "tests/support"
187+ callProcess "npm" ["install"]
188+ callProcess "bower" ["install"]
189+ callProcess "node" ["setup.js"]
190+ setCurrentDirectory "../.."
191+
192+supportModules :: [String]
193+supportModules =
194+ [ "Control.Monad.Eff.Class"
195+ , "Control.Monad.Eff.Console"
196+ , "Control.Monad.Eff"
197+ , "Control.Monad.Eff.Unsafe"
198+ , "Control.Monad.ST"
199+ , "Data.Function"
200+ , "Prelude"
201+ , "Test.Assert"
202+ ]
tests/prelude/Prelude.pursdeleted−631
@@ -1,631 +0,0 @@
1−-- | This snapshot is provided for the purposes of running the test suite.
2−-- | It is not necessarily kept up to date with the official PureScript Prelude,
3−-- | and should not be used in user code.
4−-- | The official Prelude can be found at https://github.com/purescript/purescript-prelude
5−
6−module Prelude
7− ( Unit(..), unit
8− , ($), (#)
9− , length
10− , flip
11− , const
12− , asTypeOf
13− , otherwise
14− , (:), cons, concat
15− , Semigroupoid, (<<<), (>>>)
16− , Category, id
17− , Functor, (<$>), (<#>), void
18− , Apply, (<*>)
19− , Applicative, pure, liftA1
20− , Bind, bind, (>>=)
21− , Monad, return, liftM1, ap
22− , Semigroup, (<>), (++)
23− , Semiring, (+), zero, (*), one
24− , ModuloSemiring, (/), mod, jsMod, (%)
25− , Ring, (-), negate
26− , Num
27− , DivisionRing
28− , Eq, (==), (/=)
29− , Ordering(..), Ord, compare, (<), (>), (<=), (>=)
30− , Bounded, top, bottom
31− , Lattice, sup, inf, (||), (&&)
32− , BoundedLattice
33− , ComplementedLattice, not
34− , DistributiveLattice
35− , BooleanAlgebra
36− , Show, show
37− ) where
38−
39− newtype Unit = Unit {}
40−
41− unit :: Unit
42− unit = Unit {}
43−
44− foreign import length :: forall a. Array a -> Number
45−
46− infixr 0 $
47− infixl 0 #
48−
49− ($) :: forall a b. (a -> b) -> a -> b
50− ($) f x = f x
51−
52− (#) :: forall a b. a -> (a -> b) -> b
53− (#) x f = f x
54−
55− flip :: forall a b c. (a -> b -> c) -> b -> a -> c
56− flip f b a = f a b
57−
58− const :: forall a b. a -> b -> a
59− const a _ = a
60−
61− asTypeOf :: forall a. a -> a -> a
62− asTypeOf x _ = x
63−
64− otherwise :: Boolean
65− otherwise = true
66−
67− foreign import cons :: forall a. a -> Array a -> Array a
68−
69− infixr 6 :
70−
71− (:) :: forall a. a -> Array a -> Array a
72− (:) = cons
73−
74− foreign import concat :: forall a. Array a -> Array a -> Array a
75−
76− infixr 9 >>>
77− infixr 9 <<<
78−
79− class Semigroupoid a where
80− (<<<) :: forall b c d. a c d -> a b c -> a b d
81−
82− instance semigroupoidArr :: Semigroupoid (->) where
83− (<<<) f g x = f (g x)
84−
85− (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
86− (>>>) f g = g <<< f
87−
88− class (Semigroupoid a) <= Category a where
89− id :: forall t. a t t
90−
91− instance categoryArr :: Category (->) where
92− id x = x
93−
94− infixl 4 <$>
95− infixl 1 <#>
96−
97− class Functor f where
98− (<$>) :: forall a b. (a -> b) -> f a -> f b
99−
100− instance functorArr :: Functor ((->) r) where
101− (<$>) = (<<<)
102−
103− (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
104− (<#>) fa f = f <$> fa
105−
106− void :: forall f a. (Functor f) => f a -> f Unit
107− void fa = const unit <$> fa
108−
109− infixl 4 <*>
110−
111− class (Functor f) <= Apply f where
112− (<*>) :: forall a b. f (a -> b) -> f a -> f b
113−
114− instance applyArr :: Apply ((->) r) where
115− (<*>) f g x = f x (g x)
116−
117− class (Apply f) <= Applicative f where
118− pure :: forall a. a -> f a
119−
120− instance applicativeArr :: Applicative ((->) r) where
121− pure = const
122−
123− return :: forall m a. (Applicative m) => a -> m a
124− return = pure
125−
126− liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
127− liftA1 f a = pure f <*> a
128−
129− infixl 1 >>=
130−
131− (>>=) :: forall m a b. (Bind m) => m a -> (a -> m b) -> m b
132− (>>=) = bind
133−
134− class (Apply m) <= Bind m where
135− bind :: forall a b. m a -> (a -> m b) -> m b
136−
137− instance bindArr :: Bind ((->) r) where
138− bind m f x = f (m x) x
139−
140− class (Applicative m, Bind m) <= Monad m
141−
142− instance monadArr :: Monad ((->) r)
143−
144− liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
145− liftM1 f a = do
146− a' <- a
147− return (f a')
148−
149− ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
150− ap f a = do
151− f' <- f
152− a' <- a
153− return (f' a')
154−
155− infixr 5 <>
156− infixr 5 ++
157−
158− class Semigroup a where
159− (<>) :: a -> a -> a
160−
161− (++) :: forall s. (Semigroup s) => s -> s -> s
162− (++) = (<>)
163−
164− instance semigroupString :: Semigroup String where
165− (<>) = concatString
166−
167− instance semigroupUnit :: Semigroup Unit where
168− (<>) _ _ = unit
169−
170− instance semigroupArr :: (Semigroup s') => Semigroup (s -> s') where
171− (<>) f g = \x -> f x <> g x
172−
173− instance semigroupOrdering :: Semigroup Ordering where
174− (<>) LT _ = LT
175− (<>) GT _ = GT
176− (<>) EQ y = y
177−
178− foreign import concatString :: String -> String -> String
179−
180− infixl 6 +
181− infixl 7 *
182−
183− class Semiring a where
184− (+) :: a -> a -> a
185− zero :: a
186− (*) :: a -> a -> a
187− one :: a
188−
189− instance semiringNumber :: Semiring Number where
190− (+) = numAdd
191− zero = 0.0
192− (*) = numMul
193− one = 1.0
194−
195− instance semiringUnit :: Semiring Unit where
196− (+) _ _ = unit
197− zero = unit
198− (*) _ _ = unit
199− one = unit
200−
201− infixl 6 -
202−
203− class (Semiring a) <= Ring a where
204− (-) :: a -> a -> a
205−
206− instance ringNumber :: Ring Number where
207− (-) = numSub
208−
209− instance ringUnit :: Ring Unit where
210− (-) _ _ = unit
211−
212− negate :: forall a. (Ring a) => a -> a
213− negate a = zero - a
214−
215− infixl 7 /
216−
217− class (Semiring a) <= ModuloSemiring a where
218− (/) :: a -> a -> a
219− mod :: a -> a -> a
220−
221− instance moduloSemiringNumber :: ModuloSemiring Number where
222− (/) = numDiv
223− mod _ _ = 0.0
224−
225− instance moduloSemiringUnit :: ModuloSemiring Unit where
226− (/) _ _ = unit
227− mod _ _ = unit
228−
229− foreign import jsMod :: Number -> Number -> Number
230−
231− infixl 7 %
232−
233− (%) = jsMod
234−
235− class (Ring a, ModuloSemiring a) <= DivisionRing a
236−
237− instance divisionRingNumber :: DivisionRing Number
238−
239− instance divisionRingUnit :: DivisionRing Unit
240−
241− class (DivisionRing a) <= Num a
242−
243− instance numNumber :: Num Number
244−
245− instance numUnit :: Num Unit
246−
247− foreign import numAdd :: Number -> Number -> Number
248−
249− foreign import numMul :: Number -> Number -> Number
250−
251− foreign import numDiv :: Number -> Number -> Number
252−
253− foreign import numSub :: Number -> Number -> Number
254−
255− infix 4 ==
256− infix 4 /=
257−
258− class Eq a where
259− (==) :: a -> a -> Boolean
260− (/=) :: a -> a -> Boolean
261−
262− instance eqBoolean :: Eq Boolean where
263− (==) = refEq
264− (/=) = refIneq
265−
266− instance eqNumber :: Eq Number where
267− (==) = refEq
268− (/=) = refIneq
269−
270− instance eqInt :: Eq Int where
271− (==) = refEq
272− (/=) = refIneq
273−
274− instance eqChar :: Eq Char where
275− (==) = refEq
276− (/=) = refIneq
277−
278− instance eqString :: Eq String where
279− (==) = refEq
280− (/=) = refIneq
281−
282− instance eqUnit :: Eq Unit where
283− (==) _ _ = true
284− (/=) _ _ = false
285−
286− instance eqArray :: (Eq a) => Eq (Array a) where
287− (==) = eqArrayImpl (==)
288− (/=) xs ys = not (xs == ys)
289−
290− instance eqOrdering :: Eq Ordering where
291− (==) LT LT = true
292− (==) GT GT = true
293− (==) EQ EQ = true
294− (==) _ _ = false
295− (/=) x y = not (x == y)
296−
297− foreign import refEq :: forall a. a -> a -> Boolean
298−
299− foreign import refIneq :: forall a. a -> a -> Boolean
300−
301− foreign import eqArrayImpl :: forall a. (a -> a -> Boolean) -> Array a -> Array a -> Boolean
302−
303− data Ordering = LT | GT | EQ
304−
305− class (Eq a) <= Ord a where
306− compare :: a -> a -> Ordering
307−
308− instance ordBoolean :: Ord Boolean where
309− compare false false = EQ
310− compare false true = LT
311− compare true true = EQ
312− compare true false = GT
313−
314− instance ordNumber :: Ord Number where
315− compare = unsafeCompare
316−
317− instance ordString :: Ord String where
318− compare = unsafeCompare
319−
320− instance ordUnit :: Ord Unit where
321− compare _ _ = EQ
322−
323− instance ordArray :: (Ord a) => Ord (Array a) where
324− compare xs ys = compare 0.0 $ ordArrayImpl (\x y -> case compare x y of
325− EQ -> 0.0
326− LT -> -1.0
327− GT -> 1.0) xs ys
328−
329− foreign import ordArrayImpl :: forall a. (a -> a -> Number) -> Array a -> Array a -> Number
330−
331− instance ordOrdering :: Ord Ordering where
332− compare LT LT = EQ
333− compare EQ EQ = EQ
334− compare GT GT = EQ
335− compare LT _ = LT
336− compare EQ LT = GT
337− compare EQ GT = LT
338− compare GT _ = GT
339−
340− infixl 4 <
341− infixl 4 >
342− infixl 4 <=
343− infixl 4 >=
344−
345− (<) :: forall a. (Ord a) => a -> a -> Boolean
346− (<) a1 a2 = case a1 `compare` a2 of
347− LT -> true
348− _ -> false
349−
350− (>) :: forall a. (Ord a) => a -> a -> Boolean
351− (>) a1 a2 = case a1 `compare` a2 of
352− GT -> true
353− _ -> false
354−
355− (<=) :: forall a. (Ord a) => a -> a -> Boolean
356− (<=) a1 a2 = case a1 `compare` a2 of
357− GT -> false
358− _ -> true
359−
360− (>=) :: forall a. (Ord a) => a -> a -> Boolean
361− (>=) a1 a2 = case a1 `compare` a2 of
362− LT -> false
363− _ -> true
364−
365− unsafeCompare :: forall a. a -> a -> Ordering
366− unsafeCompare = unsafeCompareImpl LT EQ GT
367−
368− foreign import unsafeCompareImpl :: forall a. Ordering -> Ordering -> Ordering -> a -> a -> Ordering
369−
370− class (Ord a) <= Bounded a where
371− top :: a
372− bottom :: a
373−
374− instance boundedBoolean :: Bounded Boolean where
375− top = true
376− bottom = false
377−
378− instance boundedUnit :: Bounded Unit where
379− top = unit
380− bottom = unit
381−
382− instance boundedOrdering :: Bounded Ordering where
383− top = GT
384− bottom = LT
385−
386− class (Ord a) <= Lattice a where
387− sup :: a -> a -> a
388− inf :: a -> a -> a
389−
390− instance latticeBoolean :: Lattice Boolean where
391− sup = boolOr
392− inf = boolAnd
393−
394− instance latticeUnit :: Lattice Unit where
395− sup _ _ = unit
396− inf _ _ = unit
397−
398− infixr 2 ||
399− infixr 3 &&
400−
401− (||) :: forall a. (Lattice a) => a -> a -> a
402− (||) = sup
403−
404− (&&) :: forall a. (Lattice a) => a -> a -> a
405− (&&) = inf
406−
407− class (Bounded a, Lattice a) <= BoundedLattice a
408−
409− instance boundedLatticeBoolean :: BoundedLattice Boolean
410−
411− instance boundedLatticeUnit :: BoundedLattice Unit
412−
413− class (BoundedLattice a) <= ComplementedLattice a where
414− not :: a -> a
415−
416− instance complementedLatticeBoolean :: ComplementedLattice Boolean where
417− not = boolNot
418−
419− instance complementedLatticeUnit :: ComplementedLattice Unit where
420− not _ = unit
421−
422− class (Lattice a) <= DistributiveLattice a
423−
424− instance distributiveLatticeBoolean :: DistributiveLattice Boolean
425−
426− instance distributiveLatticeUnit :: DistributiveLattice Unit
427−
428− class (ComplementedLattice a, DistributiveLattice a) <= BooleanAlgebra a
429−
430− instance booleanAlgebraBoolean :: BooleanAlgebra Boolean
431−
432− instance booleanAlgebraUnit :: BooleanAlgebra Unit
433−
434− foreign import boolOr :: Boolean -> Boolean -> Boolean
435−
436− foreign import boolAnd :: Boolean -> Boolean -> Boolean
437−
438− foreign import boolNot :: Boolean -> Boolean
439−
440− class Show a where
441− show :: a -> String
442−
443− instance showBoolean :: Show Boolean where
444− show true = "true"
445− show false = "false"
446−
447− instance showNumber :: Show Number where
448− show = showNumberImpl
449−
450− instance showString :: Show String where
451− show = showStringImpl
452−
453− instance showUnit :: Show Unit where
454− show _ = "unit"
455−
456− instance showArray :: (Show a) => Show (Array a) where
457− show = showArrayImpl show
458−
459− instance showOrdering :: Show Ordering where
460− show LT = "LT"
461− show GT = "GT"
462− show EQ = "EQ"
463−
464− foreign import showNumberImpl :: Number -> String
465−
466− foreign import showStringImpl :: String -> String
467−
468− foreign import showArrayImpl :: forall a. (a -> String) -> Array a -> String
469−
470−module Data.Function where
471−
472− import Prelude
473−
474− on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
475− on f g x y = g x `f` g y
476−
477− foreign import data Fn0 :: * -> *
478−
479− foreign import data Fn1 :: * -> * -> *
480−
481− foreign import data Fn2 :: * -> * -> * -> *
482−
483− foreign import data Fn3 :: * -> * -> * -> * -> *
484−
485− foreign import data Fn4 :: * -> * -> * -> * -> * -> *
486−
487− foreign import data Fn5 :: * -> * -> * -> * -> * -> * -> *
488−
489− foreign import data Fn6 :: * -> * -> * -> * -> * -> * -> * -> *
490−
491− foreign import data Fn7 :: * -> * -> * -> * -> * -> * -> * -> * -> *
492−
493− foreign import data Fn8 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> *
494−
495− foreign import data Fn9 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
496−
497− foreign import data Fn10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
498−
499− foreign import mkFn0 :: forall a. (Unit -> a) -> Fn0 a
500−
501− foreign import mkFn1 :: forall a b. (a -> b) -> Fn1 a b
502−
503− foreign import mkFn2 :: forall a b c. (a -> b -> c) -> Fn2 a b c
504−
505− foreign import mkFn3 :: forall a b c d. (a -> b -> c -> d) -> Fn3 a b c d
506−
507− foreign import mkFn4 :: forall a b c d e. (a -> b -> c -> d -> e) -> Fn4 a b c d e
508−
509− foreign import mkFn5 :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Fn5 a b c d e f
510−
511− foreign import mkFn6 :: forall a b c d e f g. (a -> b -> c -> d -> e -> f -> g) -> Fn6 a b c d e f g
512−
513− foreign import mkFn7 :: forall a b c d e f g h. (a -> b -> c -> d -> e -> f -> g -> h) -> Fn7 a b c d e f g h
514−
515− foreign import mkFn8 :: forall a b c d e f g h i. (a -> b -> c -> d -> e -> f -> g -> h -> i) -> Fn8 a b c d e f g h i
516−
517− foreign import mkFn9 :: forall a b c d e f g h i j. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> Fn9 a b c d e f g h i j
518−
519− foreign import mkFn10 :: forall a b c d e f g h i j k. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> Fn10 a b c d e f g h i j k
520−
521− foreign import runFn0 :: forall a. Fn0 a -> a
522−
523− foreign import runFn1 :: forall a b. Fn1 a b -> a -> b
524−
525− foreign import runFn2 :: forall a b c. Fn2 a b c -> a -> b -> c
526−
527− foreign import runFn3 :: forall a b c d. Fn3 a b c d -> a -> b -> c -> d
528−
529− foreign import runFn4 :: forall a b c d e. Fn4 a b c d e -> a -> b -> c -> d -> e
530−
531− foreign import runFn5 :: forall a b c d e f. Fn5 a b c d e f -> a -> b -> c -> d -> e -> f
532−
533− foreign import runFn6 :: forall a b c d e f g. Fn6 a b c d e f g -> a -> b -> c -> d -> e -> f -> g
534−
535− foreign import runFn7 :: forall a b c d e f g h. Fn7 a b c d e f g h -> a -> b -> c -> d -> e -> f -> g -> h
536−
537− foreign import runFn8 :: forall a b c d e f g h i. Fn8 a b c d e f g h i -> a -> b -> c -> d -> e -> f -> g -> h -> i
538−
539− foreign import runFn9 :: forall a b c d e f g h i j. Fn9 a b c d e f g h i j -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j
540−
541− foreign import runFn10 :: forall a b c d e f g h i j k. Fn10 a b c d e f g h i j k -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k
542−
543−module Assert where
544−
545− import Prelude
546− import Control.Monad.Eff
547−
548− foreign import data Assert :: !
549−
550− foreign import error :: forall a. String -> a
551−
552− foreign import assertPartial :: forall e a. (Unit -> a) -> Eff (assert :: Assert | e) Unit
553−
554− assert :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
555− assert true = return unit
556− assert false = error "Assertion failed!"
557−
558−module Prelude.Unsafe where
559−
560− foreign import unsafeIndex :: forall a. Array a -> Number -> a
561−
562−module Control.Monad.Eff
563− ( Eff()
564− , Pure()
565− , runPure
566− , untilE, whileE
567− ) where
568−
569− import Prelude
570−
571− foreign import data Eff :: # ! -> * -> *
572−
573− foreign import returnE :: forall e a. a -> Eff e a
574−
575− foreign import bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
576−
577− type Pure a = forall e. Eff e a
578−
579− foreign import runPure :: forall a. Pure a -> a
580−
581− instance functorEff :: Functor (Eff e) where
582− (<$>) = liftA1
583−
584− instance applyEff :: Apply (Eff e) where
585− (<*>) = ap
586−
587− instance applicativeEff :: Applicative (Eff e) where
588− pure = returnE
589−
590− instance bindEff :: Bind (Eff e) where
591− bind = bindE
592−
593− instance monadEff :: Monad (Eff e)
594−
595− foreign import untilE :: forall e. Eff e Boolean -> Eff e Unit
596−
597− foreign import whileE :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
598−
599−module Debug.Trace where
600−
601− import Prelude
602− import Control.Monad.Eff
603−
604− foreign import data Trace :: !
605−
606− foreign import trace :: forall r. String -> Eff (trace :: Trace | r) Unit
607−
608− print :: forall a r. (Show a) => a -> Eff (trace :: Trace | r) Unit
609− print o = trace (show o)
610−
611−module Control.Monad.ST where
612−
613− import Prelude
614− import Control.Monad.Eff
615−
616− foreign import data ST :: * -> !
617−
618− foreign import data STRef :: * -> * -> *
619−
620− foreign import newSTRef :: forall a h r. a -> Eff (st :: ST h | r) (STRef h a)
621−
622− foreign import readSTRef :: forall a h r. STRef h a -> Eff (st :: ST h | r) a
623−
624− foreign import modifySTRef :: forall a h r. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a
625−
626− foreign import writeSTRef :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a
627−
628− foreign import runST :: forall a r. (forall h. Eff (st :: ST h | r) a) -> Eff r a
629−
630− pureST :: forall a. (forall h r. Eff (st :: ST h | r) a) -> a
631− pureST st = runPure (runST st)
tests/prelude/js/Assert.jsdeleted−19
@@ -1,19 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Assert
5−
6−exports.error = function(msg) {
7− throw msg;
8−};
9−
10−exports.assertPartial = function(f) {
11− return function() {
12− try {
13− return f();
14− } catch (e) {
15− if (e instanceof Error) return;
16− throw new Error('Pattern match failure is not Error');
17− }
18− };
19−};
tests/prelude/js/Control.Monad.Eff.jsdeleted−40
@@ -1,40 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Control.Monad.Eff
5−
6−exports.returnE = function (a) {
7− return function () {
8− return a;
9− };
10−};
11−
12−exports.bindE = function (a) {
13− return function (f) {
14− return function () {
15− return f(a())();
16− };
17− };
18−};
19−
20−exports.runPure = function (f) {
21− return f();
22−};
23−
24−exports.untilE = function (f) {
25− return function () {
26− while (!f());
27− return {};
28− };
29−};
30−
31−exports.whileE = function (f) {
32− return function (a) {
33− return function () {
34− while (f()) {
35− a();
36− }
37− return {};
38− };
39− };
40−};
tests/prelude/js/Control.Monad.ST.jsdeleted−38
@@ -1,38 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Control.Monad.ST
5−
6−exports.newSTRef = function (val) {
7− return function () {
8− return { value: val };
9− };
10−};
11−
12−exports.readSTRef = function (ref) {
13− return function () {
14− return ref.value;
15− };
16−};
17−
18−exports.modifySTRef = function (ref) {
19− return function (f) {
20− return function () {
21− /* jshint boss: true */
22− return ref.value = f(ref.value);
23− };
24− };
25−};
26−
27−exports.writeSTRef = function (ref) {
28− return function (a) {
29− return function () {
30− /* jshint boss: true */
31− return ref.value = a;
32− };
33− };
34−};
35−
36−exports.runST = function (f) {
37− return f;
38−};
tests/prelude/js/Data.Function.jsdeleted−233
@@ -1,233 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Data.Function
5−
6−exports.mkFn0 = function (fn) {
7− return function () {
8− return fn({});
9− };
10−};
11−
12−exports.mkFn1 = function (fn) {
13− return function (a) {
14− return fn(a);
15− };
16−};
17−
18−exports.mkFn2 = function (fn) {
19− /* jshint maxparams: 2 */
20− return function (a, b) {
21− return fn(a)(b);
22− };
23−};
24−
25−exports.mkFn3 = function (fn) {
26− /* jshint maxparams: 3 */
27− return function (a, b, c) {
28− return fn(a)(b)(c);
29− };
30−};
31−
32−exports.mkFn4 = function (fn) {
33− /* jshint maxparams: 4 */
34− return function (a, b, c, d) {
35− return fn(a)(b)(c)(d);
36− };
37−};
38−
39−exports.mkFn5 = function (fn) {
40− /* jshint maxparams: 5 */
41− return function (a, b, c, d, e) {
42− return fn(a)(b)(c)(d)(e);
43− };
44−};
45−
46−exports.mkFn6 = function (fn) {
47− /* jshint maxparams: 6 */
48− return function (a, b, c, d, e, f) {
49− return fn(a)(b)(c)(d)(e)(f);
50− };
51−};
52−
53−exports.mkFn7 = function (fn) {
54− /* jshint maxparams: 7 */
55− return function (a, b, c, d, e, f, g) {
56− return fn(a)(b)(c)(d)(e)(f)(g);
57− };
58−};
59−
60−exports.mkFn8 = function (fn) {
61− /* jshint maxparams: 8 */
62− return function (a, b, c, d, e, f, g, h) {
63− return fn(a)(b)(c)(d)(e)(f)(g)(h);
64− };
65−};
66−
67−exports.mkFn9 = function (fn) {
68− /* jshint maxparams: 9 */
69− return function (a, b, c, d, e, f, g, h, i) {
70− return fn(a)(b)(c)(d)(e)(f)(g)(h)(i);
71− };
72−};
73−
74−exports.mkFn10 = function (fn) {
75− /* jshint maxparams: 10 */
76− return function (a, b, c, d, e, f, g, h, i, j) {
77− return fn(a)(b)(c)(d)(e)(f)(g)(h)(i)(j);
78− };
79−};
80−
81−exports.runFn0 = function (fn) {
82− return fn();
83−};
84−
85−exports.runFn1 = function (fn) {
86− return function (a) {
87− return fn(a);
88− };
89−};
90−
91−exports.runFn2 = function (fn) {
92− return function (a) {
93− return function (b) {
94− return fn(a, b);
95− };
96− };
97−};
98−
99−exports.runFn3 = function (fn) {
100− return function (a) {
101− return function (b) {
102− return function (c) {
103− return fn(a, b, c);
104− };
105− };
106− };
107−};
108−
109−exports.runFn4 = function (fn) {
110− return function (a) {
111− return function (b) {
112− return function (c) {
113− return function (d) {
114− return fn(a, b, c, d);
115− };
116− };
117− };
118− };
119−};
120−
121−exports.runFn5 = function (fn) {
122− return function (a) {
123− return function (b) {
124− return function (c) {
125− return function (d) {
126− return function (e) {
127− return fn(a, b, c, d, e);
128− };
129− };
130− };
131− };
132− };
133−};
134−
135−exports.runFn6 = function (fn) {
136− return function (a) {
137− return function (b) {
138− return function (c) {
139− return function (d) {
140− return function (e) {
141− return function (f) {
142− return fn(a, b, c, d, e, f);
143− };
144− };
145− };
146− };
147− };
148− };
149−};
150−
151−exports.runFn7 = function (fn) {
152− return function (a) {
153− return function (b) {
154− return function (c) {
155− return function (d) {
156− return function (e) {
157− return function (f) {
158− return function (g) {
159− return fn(a, b, c, d, e, f, g);
160− };
161− };
162− };
163− };
164− };
165− };
166− };
167−};
168−
169−exports.runFn8 = function (fn) {
170− return function (a) {
171− return function (b) {
172− return function (c) {
173− return function (d) {
174− return function (e) {
175− return function (f) {
176− return function (g) {
177− return function (h) {
178− return fn(a, b, c, d, e, f, g, h);
179− };
180− };
181− };
182− };
183− };
184− };
185− };
186− };
187−};
188−
189−exports.runFn9 = function (fn) {
190− return function (a) {
191− return function (b) {
192− return function (c) {
193− return function (d) {
194− return function (e) {
195− return function (f) {
196− return function (g) {
197− return function (h) {
198− return function (i) {
199− return fn(a, b, c, d, e, f, g, h, i);
200− };
201− };
202− };
203− };
204− };
205− };
206− };
207− };
208− };
209−};
210−
211−exports.runFn10 = function (fn) {
212− return function (a) {
213− return function (b) {
214− return function (c) {
215− return function (d) {
216− return function (e) {
217− return function (f) {
218− return function (g) {
219− return function (h) {
220− return function (i) {
221− return function (j) {
222− return fn(a, b, c, d, e, f, g, h, i, j);
223− };
224− };
225− };
226− };
227− };
228− };
229− };
230− };
231− };
232− };
233−};
tests/prelude/js/Debug.Trace.jsdeleted−11
@@ -1,11 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Debug.Trace
5−
6−exports.trace = function(s) {
7− return function() {
8− console.log(s);
9− return {};
10− };
11−};
tests/prelude/js/Prelude.Unsafe.jsdeleted−10
@@ -1,10 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Prelude.Unsafe
5−
6−exports.unsafeIndex = function(xs) {
7− return function(n) {
8− return xs[n];
9− };
10−};
tests/prelude/js/Prelude.jsdeleted−150
@@ -1,150 +0,0 @@
1−/* global exports */
2−"use strict";
3−
4−// module Prelude
5−
6−exports.cons = function(e) {
7− return function(l) {
8− return [e].concat(l);
9− };
10−};
11−
12−exports.concat = function(l1) {
13− return function(l2) {
14− return l1.concat(l2);
15− };
16−};
17−
18−exports.length = function(a) {
19− return a.length;
20−};
21−
22−exports.concatString = function(s1) {
23− return function(s2) {
24− return s1 + s2;
25− };
26−};
27−
28−exports.numAdd = function (n1) {
29− return function (n2) {
30− return n1 + n2;
31− };
32−};
33−
34−exports.numMul = function (n1) {
35− return function (n2) {
36− return n1 * n2;
37− };
38−};
39−
40−exports.numDiv = function (n1) {
41− return function (n2) {
42− return n1 / n2;
43− };
44−};
45−
46−exports.numSub = function (n1) {
47− return function (n2) {
48− return n1 - n2;
49− };
50−};
51−
52−exports.jsMod = function(x) {
53− return function (y) {
54− return x % y;
55− };
56−};
57−
58−exports.refEq = function(r1) {
59− return function(r2) {
60− return r1 === r2;
61− };
62−};
63−
64−exports.refIneq = function(r1) {
65− return function(r2) {
66− return r1 !== r2;
67− };
68−};
69−
70−exports.eqArrayImpl = function(f) {
71− return function(xs) {
72− return function(ys) {
73− if (xs.length !== ys.length) return false;
74− for (var i = 0; i < xs.length; i++) {
75− if (!f(xs[i])(ys[i])) return false;
76− }
77− return true;
78− };
79− };
80−};
81−
82−exports.ordArrayImpl = function(f) {
83− return function (xs) {
84− return function (ys) {
85− var i = 0;
86− while (i < xs.length && i < ys.length) {
87− var x = xs[i];
88− var y = ys[i];
89− var o = f(x)(y);
90− if (o !== 0) {
91− return o;
92− }
93− }
94− if (xs.length == ys.length) {
95− return 0;
96− } else if (xs.length > ys.length) {
97− return 1;
98− } else {
99− return -1;
100− }
101− };
102− };
103−};
104−
105−exports.unsafeCompareImpl = function(lt) {
106− return function(eq) {
107− return function(gt) {
108− return function(x) {
109− return function(y) {
110− return x < y ? lt : x > y ? gt : eq;
111− };
112− };
113− };
114− };
115−};
116−
117−exports.boolOr = function (b1) {
118− return function (b2) {
119− return b1 || b2;
120− };
121−};
122−
123−exports.boolAnd = function (b1) {
124− return function (b2) {
125− return b1 && b2;
126− };
127−};
128−
129−exports.boolNot = function (b) {
130− return !b;
131−};
132−
133−exports.showNumberImpl = function (n) {
134− /* jshint bitwise: false */
135− return n === (n | 0) ? n + ".0" : n.toString();
136−};
137−
138−exports.showStringImpl = function (s) {
139− return JSON.stringify(s);
140−};
141−
142−exports.showArrayImpl = function (f) {
143− return function (xs) {
144− var ss = [];
145− for (var i = 0, l = xs.length; i < l; i++) {
146− ss[i] = f(xs[i]);
147− }
148− return "[" + ss.join(",") + "]";
149− };
150−};
tests/support/.gitignorenew file+2
@@ -0,0 +1,2 @@
1+node_modules/
2+bower_components/
tests/support/bower.jsonnew file+11
@@ -0,0 +1,11 @@
1+{
2+ "name": "purescript-test-suite-support",
3+ "dependencies": {
4+ "purescript-eff": "0.1.0",
5+ "purescript-prelude": "0.1.1",
6+ "purescript-assert": "0.1.1",
7+ "purescript-st": "0.1.0",
8+ "purescript-console": "0.1.0",
9+ "purescript-functions": "0.1.0"
10+ }
11+}
tests/support/package.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "private": true,
3+ "dependencies": {
4+ "bower": "^1.4.1",
5+ "glob": "^5.0.14"
6+ }
7+}
tests/support/setup.jsnew file+22
@@ -0,0 +1,22 @@
1+var glob = require("glob");
2+var fs = require("fs");
3+
4+try {
5+ fs.mkdirSync("./flattened");
6+} catch(e) {
7+ // ignore the error if it already exists
8+ if (e.code !== "EEXIST") {
9+ throw(e);
10+ }
11+}
12+
13+glob("bower_components/*/src/**/*.{js,purs}", function(err, files) {
14+ if (err) throw err;
15+ files.forEach(function(file) {
16+ // We join with "-" because Cabal is weird about file extensions.
17+ var dest = "./flattened/" + file.split("/").slice(3).join("-");
18+ console.log("Copying " + file + " to " + dest);
19+ var content = fs.readFileSync(file, "utf-8");
20+ fs.writeFileSync(dest, content, "utf-8");
21+ });
22+})