@@ -0,0 +1,1045 @@
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
14+ , Semigroupoid, (<<<), (>>>)
16+ , Functor, (<$>), (<#>), void
18+ , Applicative, pure, liftA1
20+ , Monad, return, liftM1, ap
21+ , Semigroup, (<>), (++)
22+ , Semiring, (+), zero, (*), one
23+ , ModuloSemiring, (/), mod
28+ , Ordering(..), Ord, compare, (<), (>), (<=), (>=)
29+ , Bounded, top, bottom
30+ , Lattice, sup, inf, (||), (&&)
32+ , ComplementedLattice, not
33+ , DistributiveLattice
38+ newtype Unit = Unit {}
46+ ($) :: forall a b. (a -> b) -> a -> b
49+ (#) :: forall a b. a -> (a -> b) -> b
52+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
55+ const :: forall a b. a -> b -> a
58+ asTypeOf :: forall a. a -> a -> a
68+ return [e].concat(l);
71+ """ :: forall a. a -> [a] -> [a]
75+ (:) :: forall a. a -> [a] -> [a]
81+ class Semigroupoid a where
82+ (<<<) :: forall b c d. a c d -> a b c -> a b d
84+ instance semigroupoidArr :: Semigroupoid (->) where
85+ (<<<) f g x = f (g x)
87+ (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
90+ class (Semigroupoid a) <= Category a where
91+ id :: forall t. a t t
93+ instance categoryArr :: Category (->) where
99+ class Functor f where
100+ (<$>) :: forall a b. (a -> b) -> f a -> f b
102+ instance functorArr :: Functor ((->) r) where
105+ (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
106+ (<#>) fa f = f <$> fa
108+ void :: forall f a. (Functor f) => f a -> f Unit
109+ void fa = const unit <$> fa
113+ class (Functor f) <= Apply f where
114+ (<*>) :: forall a b. f (a -> b) -> f a -> f b
116+ instance applyArr :: Apply ((->) r) where
117+ (<*>) f g x = f x (g x)
119+ class (Apply f) <= Applicative f where
120+ pure :: forall a. a -> f a
122+ instance applicativeArr :: Applicative ((->) r) where
125+ return :: forall m a. (Applicative m) => a -> m a
128+ liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
129+ liftA1 f a = pure f <*> a
133+ class (Apply m) <= Bind m where
134+ (>>=) :: forall a b. m a -> (a -> m b) -> m b
136+ instance bindArr :: Bind ((->) r) where
137+ (>>=) m f x = f (m x) x
139+ class (Applicative m, Bind m) <= Monad m
141+ instance monadArr :: Monad ((->) r)
143+ liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
148+ ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
157+ class Semigroup a where
160+ (++) :: forall s. (Semigroup s) => s -> s -> s
163+ instance semigroupString :: Semigroup String where
166+ instance semigroupUnit :: Semigroup Unit where
169+ instance semigroupArr :: (Semigroup s') => Semigroup (s -> s') where
170+ (<>) f g = \x -> f x <> g x
172+ instance semigroupOrdering :: Semigroup Ordering where
177+ foreign import concatString
179+ function concatString(s1) {
180+ return function(s2) {
184+ """ :: String -> String -> String
189+ class Semiring a where
195+ instance semiringNumber :: Semiring Number where
201+ instance semiringUnit :: Semiring Unit where
209+ class (Semiring a) <= Ring a where
212+ instance ringNumber :: Ring Number where
215+ instance ringUnit :: Ring Unit where
218+ negate :: forall a. (Ring a) => a -> a
223+ class (Semiring a) <= ModuloSemiring a where
227+ instance moduloSemiringNumber :: ModuloSemiring Number where
231+ instance moduloSemiringUnit :: ModuloSemiring Unit where
235+ class (Ring a, ModuloSemiring a) <= DivisionRing a
237+ instance divisionRingNumber :: DivisionRing Number
239+ instance divisionRingUnit :: DivisionRing Unit
241+ class (DivisionRing a) <= Num a
243+ instance numNumber :: Num Number
245+ instance numUnit :: Num Unit
247+ foreign import numAdd
249+ function numAdd(n1) {
250+ return function(n2) {
254+ """ :: Number -> Number -> Number
256+ foreign import numMul
258+ function numMul(n1) {
259+ return function(n2) {
263+ """ :: Number -> Number -> Number
265+ foreign import numDiv
267+ function numDiv(n1) {
268+ return function(n2) {
272+ """ :: Number -> Number -> Number
274+ foreign import numSub
276+ function numSub(n1) {
277+ return function(n2) {
281+ """ :: Number -> Number -> Number
287+ (==) :: a -> a -> Boolean
288+ (/=) :: a -> a -> Boolean
290+ instance eqBoolean :: Eq Boolean where
294+ instance eqNumber :: Eq Number where
298+ instance eqString :: Eq String where
302+ instance eqUnit :: Eq Unit where
306+ instance eqArray :: (Eq a) => Eq [a] where
307+ (==) = eqArrayImpl (==)
308+ (/=) xs ys = not (xs == ys)
310+ instance eqOrdering :: Eq Ordering where
315+ (/=) x y = not (x == y)
317+ foreign import refEq
319+ function refEq(r1) {
320+ return function(r2) {
324+ """ :: forall a. a -> a -> Boolean
326+ foreign import refIneq
328+ function refIneq(r1) {
329+ return function(r2) {
333+ """ :: forall a. a -> a -> Boolean
335+ foreign import eqArrayImpl
337+ function eqArrayImpl(f) {
338+ return function(xs) {
339+ return function(ys) {
340+ if (xs.length !== ys.length) return false;
341+ for (var i = 0; i < xs.length; i++) {
342+ if (!f(xs[i])(ys[i])) return false;
348+ """ :: forall a. (a -> a -> Boolean) -> [a] -> [a] -> Boolean
350+ data Ordering = LT | GT | EQ
352+ class (Eq a) <= Ord a where
353+ compare :: a -> a -> Ordering
355+ instance ordBoolean :: Ord Boolean where
356+ compare false false = EQ
357+ compare false true = LT
358+ compare true true = EQ
359+ compare true false = GT
361+ instance ordNumber :: Ord Number where
362+ compare = unsafeCompare
364+ instance ordString :: Ord String where
365+ compare = unsafeCompare
367+ instance ordUnit :: Ord Unit where
370+ instance ordArray :: (Ord a) => Ord [a] where
374+ compare (x:xs) (y:ys) = case compare x y of
378+ instance ordOrdering :: Ord Ordering where
392+ (<) :: forall a. (Ord a) => a -> a -> Boolean
393+ (<) a1 a2 = case a1 `compare` a2 of
397+ (>) :: forall a. (Ord a) => a -> a -> Boolean
398+ (>) a1 a2 = case a1 `compare` a2 of
402+ (<=) :: forall a. (Ord a) => a -> a -> Boolean
403+ (<=) a1 a2 = case a1 `compare` a2 of
407+ (>=) :: forall a. (Ord a) => a -> a -> Boolean
408+ (>=) a1 a2 = case a1 `compare` a2 of
412+ unsafeCompare :: forall a. a -> a -> Ordering
413+ unsafeCompare = unsafeCompareImpl LT EQ GT
415+ foreign import unsafeCompareImpl
417+ function unsafeCompareImpl(lt) {
418+ return function(eq) {
419+ return function(gt) {
420+ return function(x) {
421+ return function(y) {
422+ return x < y ? lt : x > y ? gt : eq;
428+ """ :: forall a. Ordering -> Ordering -> Ordering -> a -> a -> Ordering
430+ class (Ord a) <= Bounded a where
434+ instance boundedBoolean :: Bounded Boolean where
438+ instance boundedUnit :: Bounded Unit where
442+ instance boundedOrdering :: Bounded Ordering where
446+ class (Ord a) <= Lattice a where
450+ instance latticeBoolean :: Lattice Boolean where
454+ instance latticeUnit :: Lattice Unit where
461+ (||) :: forall a. (Lattice a) => a -> a -> a
464+ (&&) :: forall a. (Lattice a) => a -> a -> a
467+ class (Bounded a, Lattice a) <= BoundedLattice a
469+ instance boundedLatticeBoolean :: BoundedLattice Boolean
471+ instance boundedLatticeUnit :: BoundedLattice Unit
473+ class (BoundedLattice a) <= ComplementedLattice a where
476+ instance complementedLatticeBoolean :: ComplementedLattice Boolean where
479+ instance complementedLatticeUnit :: ComplementedLattice Unit where
482+ class (Lattice a) <= DistributiveLattice a
484+ instance distributiveLatticeBoolean :: DistributiveLattice Boolean
486+ instance distributiveLatticeUnit :: DistributiveLattice Unit
488+ class (ComplementedLattice a, DistributiveLattice a) <= BooleanAlgebra a
490+ instance booleanAlgebraBoolean :: BooleanAlgebra Boolean
492+ instance booleanAlgebraUnit :: BooleanAlgebra Unit
494+ foreign import boolOr
496+ function boolOr(b1) {
497+ return function(b2) {
501+ """ :: Boolean -> Boolean -> Boolean
503+ foreign import boolAnd
505+ function boolAnd(b1) {
506+ return function(b2) {
510+ """ :: Boolean -> Boolean -> Boolean
512+ foreign import boolNot
514+ function boolNot(b) {
517+ """ :: Boolean -> Boolean
522+ instance showBoolean :: Show Boolean where
524+ show false = "false"
526+ instance showNumber :: Show Number where
527+ show = showNumberImpl
529+ instance showString :: Show String where
530+ show = showStringImpl
532+ instance showUnit :: Show Unit where
535+ instance showArray :: (Show a) => Show [a] where
536+ show = showArrayImpl show
538+ instance showOrdering :: Show Ordering where
543+ foreign import showNumberImpl
545+ function showNumberImpl(n) {
546+ return n.toString();
548+ """ :: Number -> String
550+ foreign import showStringImpl
552+ function showStringImpl(s) {
553+ return JSON.stringify(s);
555+ """ :: String -> String
557+ foreign import showArrayImpl
559+ function showArrayImpl(f) {
560+ return function(xs) {
562+ for (var i = 0, l = xs.length; i < l; i++) {
565+ return '[' + ss.join(',') + ']';
568+ """ :: forall a. (a -> String) -> [a] -> String
570+module Data.Function where
572+ on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
573+ on f g x y = g x `f` g y
575+ foreign import data Fn0 :: * -> *
577+ foreign import data Fn1 :: * -> * -> *
579+ foreign import data Fn2 :: * -> * -> * -> *
581+ foreign import data Fn3 :: * -> * -> * -> * -> *
583+ foreign import data Fn4 :: * -> * -> * -> * -> * -> *
585+ foreign import data Fn5 :: * -> * -> * -> * -> * -> * -> *
587+ foreign import data Fn6 :: * -> * -> * -> * -> * -> * -> * -> *
589+ foreign import data Fn7 :: * -> * -> * -> * -> * -> * -> * -> * -> *
591+ foreign import data Fn8 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> *
593+ foreign import data Fn9 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
595+ foreign import data Fn10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
597+ foreign import mkFn0
599+ function mkFn0(fn) {
604+ """ :: forall a. (Unit -> a) -> Fn0 a
606+ foreign import mkFn1
608+ function mkFn1(fn) {
609+ return function(a) {
613+ """ :: forall a b. (a -> b) -> Fn1 a b
615+ foreign import mkFn2
617+ function mkFn2(fn) {
618+ return function(a, b) {
622+ """ :: forall a b c. (a -> b -> c) -> Fn2 a b c
624+ foreign import mkFn3
626+ function mkFn3(fn) {
627+ return function(a, b, c) {
631+ """ :: forall a b c d. (a -> b -> c -> d) -> Fn3 a b c d
633+ foreign import mkFn4
635+ function mkFn4(fn) {
636+ return function(a, b, c, d) {
637+ return fn(a)(b)(c)(d);
640+ """ :: forall a b c d e. (a -> b -> c -> d -> e) -> Fn4 a b c d e
642+ foreign import mkFn5
644+ function mkFn5(fn) {
645+ return function(a, b, c, d, e) {
646+ return fn(a)(b)(c)(d)(e);
649+ """ :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Fn5 a b c d e f
651+ foreign import mkFn6
653+ function mkFn6(fn) {
654+ return function(a, b, c, d, e, f) {
655+ return fn(a)(b)(c)(d)(e)(f);
658+ """ :: forall a b c d e f g. (a -> b -> c -> d -> e -> f -> g) -> Fn6 a b c d e f g
660+ foreign import mkFn7
662+ function mkFn7(fn) {
663+ return function(a, b, c, d, e, f, g) {
664+ return fn(a)(b)(c)(d)(e)(f)(g);
667+ """ :: 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
669+ foreign import mkFn8
671+ function mkFn8(fn) {
672+ return function(a, b, c, d, e, f, g, h) {
673+ return fn(a)(b)(c)(d)(e)(f)(g)(h);
676+ """ :: 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
678+ foreign import mkFn9
680+ function mkFn9(fn) {
681+ return function(a, b, c, d, e, f, g, h, i) {
682+ return fn(a)(b)(c)(d)(e)(f)(g)(h)(i);
685+ """ :: 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
687+ foreign import mkFn10
689+ function mkFn10(fn) {
690+ return function(a, b, c, d, e, f, g, h, i, j) {
691+ return fn(a)(b)(c)(d)(e)(f)(g)(h)(i)(j);
694+ """ :: 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
696+ foreign import runFn0
698+ function runFn0(fn) {
701+ """ :: forall a. Fn0 a -> a
703+ foreign import runFn1
705+ function runFn1(fn) {
706+ return function(a) {
710+ """ :: forall a b. Fn1 a b -> a -> b
712+ foreign import runFn2
714+ function runFn2(fn) {
715+ return function(a) {
716+ return function(b) {
721+ """ :: forall a b c. Fn2 a b c -> a -> b -> c
723+ foreign import runFn3
725+ function runFn3(fn) {
726+ return function(a) {
727+ return function(b) {
728+ return function(c) {
734+ """ :: forall a b c d. Fn3 a b c d -> a -> b -> c -> d
736+ foreign import runFn4
738+ function runFn4(fn) {
739+ return function(a) {
740+ return function(b) {
741+ return function(c) {
742+ return function(d) {
743+ return fn(a, b, c, d);
749+ """ :: forall a b c d e. Fn4 a b c d e -> a -> b -> c -> d -> e
751+ foreign import runFn5
753+ function runFn5(fn) {
754+ return function(a) {
755+ return function(b) {
756+ return function(c) {
757+ return function(d) {
758+ return function(e) {
759+ return fn(a, b, c, d, e);
766+ """ :: forall a b c d e f. Fn5 a b c d e f -> a -> b -> c -> d -> e -> f
768+ foreign import runFn6
770+ function runFn6(fn) {
771+ return function(a) {
772+ return function(b) {
773+ return function(c) {
774+ return function(d) {
775+ return function(e) {
776+ return function(f) {
777+ return fn(a, b, c, d, e, f);
785+ """ :: forall a b c d e f g. Fn6 a b c d e f g -> a -> b -> c -> d -> e -> f -> g
787+ foreign import runFn7
789+ function runFn7(fn) {
790+ return function(a) {
791+ return function(b) {
792+ return function(c) {
793+ return function(d) {
794+ return function(e) {
795+ return function(f) {
796+ return function(g) {
797+ return fn(a, b, c, d, e, f, g);
806+ """ :: 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
808+ foreign import runFn8
810+ function runFn8(fn) {
811+ return function(a) {
812+ return function(b) {
813+ return function(c) {
814+ return function(d) {
815+ return function(e) {
816+ return function(f) {
817+ return function(g) {
818+ return function(h) {
819+ return fn(a, b, c, d, e, f, g, h);
829+ """ :: 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
831+ foreign import runFn9
833+ function runFn9(fn) {
834+ return function(a) {
835+ return function(b) {
836+ return function(c) {
837+ return function(d) {
838+ return function(e) {
839+ return function(f) {
840+ return function(g) {
841+ return function(h) {
842+ return function(i) {
843+ return fn(a, b, c, d, e, f, g, h, i);
854+ """ :: 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
856+ foreign import runFn10
858+ function runFn10(fn) {
859+ return function(a) {
860+ return function(b) {
861+ return function(c) {
862+ return function(d) {
863+ return function(e) {
864+ return function(f) {
865+ return function(g) {
866+ return function(h) {
867+ return function(i) {
868+ return function(j) {
869+ return fn(a, b, c, d, e, f, g, h, i, j);
881+ """ :: 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
883+module Prelude.Unsafe where
885+ foreign import unsafeIndex
887+ function unsafeIndex(xs) {
888+ return function(n) {
892+ """ :: forall a. [a] -> Number -> a
894+module Control.Monad.Eff
901+ foreign import data Eff :: # ! -> * -> *
903+ foreign import returnE
905+ function returnE(a) {
910+ """ :: forall e a. a -> Eff e a
912+ foreign import bindE
915+ return function(f) {
921+ """ :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
923+ type Pure a = forall e. Eff e a
925+ foreign import runPure
927+ function runPure(f) {
930+ """ :: forall a. Pure a -> a
932+ instance functorEff :: Functor (Eff e) where
935+ instance applyEff :: Apply (Eff e) where
938+ instance applicativeEff :: Applicative (Eff e) where
941+ instance bindEff :: Bind (Eff e) where
944+ instance monadEff :: Monad (Eff e)
946+ foreign import untilE
948+ function untilE(f) {
954+ """ :: forall e. Eff e Boolean -> Eff e Unit
956+ foreign import whileE
958+ function whileE(f) {
959+ return function(a) {
968+ """ :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
970+module Debug.Trace where
972+ import Control.Monad.Eff
974+ foreign import data Trace :: !
976+ foreign import trace
984+ """ :: forall r. String -> Eff (trace :: Trace | r) Unit
986+ print :: forall a r. (Show a) => a -> Eff (trace :: Trace | r) Unit
987+ print o = trace (show o)
989+module Control.Monad.ST where
991+ import Control.Monad.Eff
993+ foreign import data ST :: * -> !
995+ foreign import data STRef :: * -> * -> *
997+ foreign import newSTRef
999+ function newSTRef(val) {
1000+ return function() {
1001+ return { value: val };
1004+ """ :: forall a h r. a -> Eff (st :: ST h | r) (STRef h a)
1006+ foreign import readSTRef
1008+ function readSTRef(ref) {
1009+ return function() {
1013+ """ :: forall a h r. STRef h a -> Eff (st :: ST h | r) a
1015+ foreign import modifySTRef
1017+ function modifySTRef(ref) {
1018+ return function(f) {
1019+ return function() {
1020+ return ref.value = f(ref.value);
1024+ """ :: forall a h r. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a
1026+ foreign import writeSTRef
1028+ function writeSTRef(ref) {
1029+ return function(a) {
1030+ return function() {
1031+ return ref.value = a;
1035+ """ :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a
1037+ foreign import runST
1039+ function runST(f) {
1042+ """ :: forall a r. (forall h. Eff (st :: ST h | r) a) -> Eff r a
1044+ pureST :: forall a. (forall h r. Eff (st :: ST h | r) a) -> a
1045+ pureST st = runPure (runST st)