@@ -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)