git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
updated docs
8a10621JP Smith
prelude/README.md+763−301
@@ -2,684 +2,1146 @@
2
2
3## Module Prelude
3## Module Prelude
4
4
5−### Types
6
5
7−#### `Ordering`
8
6
9− data Ordering
7+#### `otherwise`
10− = LT
11− | GT
12− | EQ
13
8
14−#### `Unit`
9+``` purescript
10+otherwise :: Boolean
11+```
15
12
16− newtype Unit
13+An alias for `true`, which can be useful in guard clauses:
17− = Unit { }
18
14
15+E.g.
19
16
20−### Type Classes
17+ max x y | x >= y = x
18+ | otherwise = y
21
19
22−![Prelude](images/Prelude.png)
20+#### `flip`
23
21
24−#### `Applicative`
22+``` purescript
23+flip :: forall a b c. (a -> b -> c) -> b -> a -> c
24+```
25
25
26− class (Apply f) <= Applicative f where
26+Flips the order of the arguments to a function of two arguments.
27− pure :: forall a. a -> f a
28
27
29−#### `Apply`
28+#### `const`
30
29
31− class (Functor f) <= Apply f where
30+``` purescript
32− (<*>) :: forall a b. f (a -> b) -> f a -> f b
31+const :: forall a b. a -> b -> a
32+```
33
33
34−#### `Bind`
34+Returns its first argument and ignores its second.
35+
36+#### `asTypeOf`
35
37
36− class (Apply m) <= Bind m where
38+``` purescript
37− (>>=) :: forall a b. m a -> (a -> m b) -> m b
39+asTypeOf :: forall a. a -> a -> a
40+```
38
41
39−#### `Bits`
42+This function returns its first argument, and can be used to assert type equalities.
43+This can be useful when types are otherwise ambiguous.
40
44
45+E.g.
46+
47+ main = print $ [] `asTypeOf` [0]
48+
49+If instead, we had written `main = print []`, the type of the argument `[]` would have
50+been ambiguous, resulting in a compile-time error.
51+
52+#### `Semigroupoid`
53+
54+``` purescript
41− class Bits b where
55+class Semigroupoid a where
42− (.&.) :: b -> b -> b
56+ (<<<) :: forall b c d. a c d -> a b c -> a b d
43− (.|.) :: b -> b -> b
57+```
44− (.^.) :: b -> b -> b
58+
45− shl :: b -> Number -> b
59+A `Semigroupoid` is similar to a [`Category`](#Category) but does not require an identity
46− shr :: b -> Number -> b
60+element `id`, just composable morphisms.
47− zshr :: b -> Number -> b
61+
48− complement :: b -> b
62+`Semigroupoid`s should obey the following rule:
63+
64+Association:
65+ `forall p q r. p <<< (q <<< r) = (p <<< q) <<< r`
66+
67+
68+#### `semigroupoidArr`
69+
70+``` purescript
71+instance semigroupoidArr :: Semigroupoid Prim.Function
72+```
49
73
50−#### `BoolLike`
51
74
52− class BoolLike b where
75+#### `(>>>)`
53− (&&) :: b -> b -> b
76+
54− (||) :: b -> b -> b
77+``` purescript
55− not :: b -> b
78+(>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
79+```
80+
56
81
57#### `Category`
82#### `Category`
58
83
84+``` purescript
59− class (Semigroupoid a) <= Category a where
85+class (Semigroupoid a) <= Category a where
60− id :: forall t. a t t
86+ id :: forall t. a t t
87+```
61
88
62−#### `DivisionRing`
89+`Category`s consist of objects and composable morphisms between them, and as such are
90+[`Semigroupoids`](#Semigroupoid), but unlike `semigroupoids` must have an identity element.
63
91
64−Ring where every nonzero element has a multiplicative inverse (possibly
92+`Category`s should obey the following rules.
65−a non-commutative field) so that ```a `mod` b = zero```
66
93
67− class (Ring a, ModuloSemiring a) <= DivisionRing a where
94+Left Identity:
95+ `forall p. id <<< p = p`
68
96
97+Right Identity:
98+ `forall p. p <<< id = p`
99+
100+
101+#### `categoryArr`
102+
103+``` purescript
104+instance categoryArr :: Category Prim.Function
105+```
106+
107+
108+#### `($)`
109+
110+``` purescript
111+($) :: forall a b. (a -> b) -> a -> b
112+```
113+
114+
69−#### `Eq`
115+#### `(#)`
116+
117+``` purescript
118+(#) :: forall a b. a -> (a -> b) -> b
119+```
120+
121+
122+#### `(:)`
123+
124+``` purescript
125+(:) :: forall a. a -> [a] -> [a]
126+```
127+
128+
129+#### `cons`
130+
131+``` purescript
132+cons :: forall a. a -> [a] -> [a]
133+```
134+
135+
136+#### `Show`
137+
138+``` purescript
139+class Show a where
140+ show :: a -> String
141+```
142+
143+
144+#### `showUnit`
145+
146+``` purescript
147+instance showUnit :: Show Unit
148+```
149+
150+
151+#### `showString`
152+
153+``` purescript
154+instance showString :: Show String
155+```
156+
157+
158+#### `showBoolean`
159+
160+``` purescript
161+instance showBoolean :: Show Boolean
162+```
163+
164+
165+#### `showNumber`
166+
167+``` purescript
168+instance showNumber :: Show Number
169+```
170+
171+
172+#### `showArray`
173+
174+``` purescript
175+instance showArray :: (Show a) => Show [a]
176+```
70
177
71− class Eq a where
72− (==) :: a -> a -> Boolean
73− (/=) :: a -> a -> Boolean
74
178
75#### `Functor`
179#### `Functor`
76
180
181+``` purescript
77− class Functor f where
182+class Functor f where
78− (<$>) :: forall a b. (a -> b) -> f a -> f b
183+ (<$>) :: forall a b. (a -> b) -> f a -> f b
184+```
79
185
80−#### `ModuloSemiring`
186+A `Functor` is intuitively a type which can be mapped over, and more formally a mapping
187+between [`Category`](#Category)s that preserves structure.
81
188
82−Semiring with modulo operation and division where
189+`Functor`s should obey the following rules.
83−```a / b * b + (a `mod` b) = a```
84
190
85− class (Semiring a) <= ModuloSemiring a where
191+Identity:
86− (/) :: a -> a -> a
192+ `(<$>) id = id`
87− mod :: a -> a -> a
88
193
89−#### `Monad`
194+Composition:
195+ `forall f g. (<$>) (f . g) = ((<$>) f) . ((<$>) g)`
90
196
91− class (Applicative m, Bind m) <= Monad m where
92
197
93−#### `Num`
198+#### `(<#>)`
94
199
95−A commutative field
200+``` purescript
201+(<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
202+```
96
203
97− class (DivisionRing a) <= Num a where
98
204
99−#### `Ord`
205+#### `void`
100
206
101− class (Eq a) <= Ord a where
207+``` purescript
102− compare :: a -> a -> Ordering
208+void :: forall f a. (Functor f) => f a -> f Unit
209+```
103
210
104−#### `Ring`
105
211
106−Addition, multiplication, and subtraction
212+#### `Apply`
107
213
214+``` purescript
108− class (Semiring a) <= Ring a where
215+class (Functor f) <= Apply f where
109− (-) :: a -> a -> a
216+ (<*>) :: forall a b. f (a -> b) -> f a -> f b
217+```
110
218
111−#### `Semigroup`
219+`Apply`s are intuitively [`Applicative`](#Applicative)s less `pure`, and more formally a
220+strong lax semi-monoidal endofunctor.
112
221
113− class Semigroup a where
222+`Apply`s should obey the following rules.
114− (<>) :: a -> a -> a
115
223
116−#### `Semigroupoid`
224+Associative Composition:
225+ `forall f g h. (.) <$> f <*> g <*> h = f <*> (g <*> h)`
117
226
118− class Semigroupoid a where
119− (<<<) :: forall b c d. a c d -> a b c -> a b d
120
227
121−#### `Semiring`
228+#### `Applicative`
122
229
123−Addition and multiplication
230+``` purescript
231+class (Apply f) <= Applicative f where
232+ pure :: forall a. a -> f a
233+```
124
234
125− class Semiring a where
235+`Applicative`s are [`Functor`](#Functor)s which can be "applied" by sequencing composition
126− (+) :: a -> a -> a
236+(`<*>`) or embedding pure expressions (`pure`).
127− zero :: a
128− (*) :: a -> a -> a
129− one :: a
130
237
131−#### `Show`
238+`Applicative`s should obey the following rules.
132
239
133− class Show a where
240+Identity:
134− show :: a -> String
241+ `forall v. (pure id) <*> v = v`
135
242
243+Composition:
244+ `forall f g h. (pure (.)) <*> f <*> g <*> h = f <*> (g <*> h)`
136
245
137−### Type Class Instances
246+Homomorphism:
247+ `forall f x. (pure f) <*> (pure x) = pure (f x)`
248+
249+Interchange:
250+ `forall u y. u <*> (pure y) = (pure (($) y)) <*> u`
138
251
139−#### `applicativeArr`
140
252
253+#### `liftA1`
254+
255+``` purescript
256+liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
257+```
258+
259+
260+#### `Bind`
261+
262+``` purescript
263+class (Apply m) <= Bind m where
264+ (>>=) :: forall a b. m a -> (a -> m b) -> m b
265+```
266+
267+A `Bind` is an [`Apply`](#Apply) with a bind operation which sequentially composes actions.
268+
269+`Bind`s should obey the following rule.
270+
271+Associativity:
272+ `forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)`
273+
274+
275+#### `Monad`
276+
277+``` purescript
278+class (Applicative m, Bind m) <= Monad m where
279+```
280+
281+`Monad` is a class which can be intuitively thought of as an abstract datatype of actions or
282+more formally though of as a monoid in the category of endofunctors.
283+
284+`Monad`s should obey the following rules.
285+
286+Left Identity:
287+ `forall f x. pure x >>= f = f x`
288+
289+Right Identity:
290+ `forall x. x >>= pure = x`
291+
292+
293+#### `return`
294+
295+``` purescript
296+return :: forall m a. (Monad m) => a -> m a
297+```
298+
299+
300+#### `liftM1`
301+
302+``` purescript
303+liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
304+```
305+
306+
307+#### `ap`
308+
309+``` purescript
310+ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
311+```
312+
313+
314+#### `functorArr`
315+
316+``` purescript
141− instance applicativeArr :: Applicative (Prim.Function r)
317+instance functorArr :: Functor (Prim.Function r)
318+```
319+
142
320
143#### `applyArr`
321#### `applyArr`
144
322
323+``` purescript
145− instance applyArr :: Apply (Prim.Function r)
324+instance applyArr :: Apply (Prim.Function r)
325+```
326+
327+
328+#### `applicativeArr`
329+
330+``` purescript
331+instance applicativeArr :: Applicative (Prim.Function r)
332+```
333+
146
334
147#### `bindArr`
335#### `bindArr`
148
336
337+``` purescript
149− instance bindArr :: Bind (Prim.Function r)
338+instance bindArr :: Bind (Prim.Function r)
339+```
150
340
151−#### `bitsNumber`
152
341
153− instance bitsNumber :: Bits Number
342+#### `monadArr`
154
343
155−#### `boolLikeBoolean`
344+``` purescript
345+instance monadArr :: Monad (Prim.Function r)
346+```
156
347
157− instance boolLikeBoolean :: BoolLike Boolean
158
348
159−#### `categoryArr`
349+#### `Semiring`
160
350
161− instance categoryArr :: Category Prim.Function
351+``` purescript
352+class Semiring a where
353+ (+) :: a -> a -> a
354+ zero :: a
355+ (*) :: a -> a -> a
356+ one :: a
357+```
162
358
163−#### `divisionRingNumber`
359+Addition and multiplication
164
360
165− instance divisionRingNumber :: DivisionRing Number
361+#### `ModuloSemiring`
166
362
167−#### `eqArray`
363+``` purescript
364+class (Semiring a) <= ModuloSemiring a where
365+ (/) :: a -> a -> a
366+ mod :: a -> a -> a
367+```
168
368
169− instance eqArray :: (Eq a) => Eq [a]
369+Semiring with modulo operation and division where
370+```a / b * b + (a `mod` b) = a```
170
371
171−#### `eqBoolean`
372+#### `Ring`
172
373
173− instance eqBoolean :: Eq Boolean
374+``` purescript
375+class (Semiring a) <= Ring a where
376+ (-) :: a -> a -> a
377+```
174
378
175−#### `eqNumber`
379+Addition, multiplication, and subtraction
176
380
177− instance eqNumber :: Eq Number
381+#### `negate`
178
382
179−#### `eqOrdering`
383+``` purescript
384+negate :: forall a. (Ring a) => a -> a
385+```
180
386
181− instance eqOrdering :: Eq Ordering
182
387
183−#### `eqString`
388+#### `DivisionRing`
184
389
185− instance eqString :: Eq String
390+``` purescript
391+class (Ring a, ModuloSemiring a) <= DivisionRing a where
392+```
186
393
187−#### `eqUnit`
394+Ring where every nonzero element has a multiplicative inverse (possibly
395+a non-commutative field) so that ```a `mod` b = zero```
396+
397+#### `Num`
188
398
189− instance eqUnit :: Eq Unit
399+``` purescript
400+class (DivisionRing a) <= Num a where
401+```
190
402
191−#### `functorArr`
403+A commutative field
404+
405+#### `semiringNumber`
406+
407+``` purescript
408+instance semiringNumber :: Semiring Number
409+```
410+
411+
412+#### `ringNumber`
413+
414+``` purescript
415+instance ringNumber :: Ring Number
416+```
192
417
193− instance functorArr :: Functor (Prim.Function r)
194
418
195#### `moduloSemiringNumber`
419#### `moduloSemiringNumber`
196
420
421+``` purescript
197− instance moduloSemiringNumber :: ModuloSemiring Number
422+instance moduloSemiringNumber :: ModuloSemiring Number
423+```
198
424
199−#### `monadArr`
200
425
201− instance monadArr :: Monad (Prim.Function r)
426+#### `divisionRingNumber`
427+
428+``` purescript
429+instance divisionRingNumber :: DivisionRing Number
430+```
431+
202
432
203#### `numNumber`
433#### `numNumber`
204
434
435+``` purescript
205− instance numNumber :: Num Number
436+instance numNumber :: Num Number
437+```
206
438
207−#### `ordArray`
208
439
209− instance ordArray :: (Ord a) => Ord [a]
440+#### `Unit`
210
441
211−#### `ordBoolean`
442+``` purescript
443+newtype Unit
444+ = Unit { }
445+```
212
446
213− instance ordBoolean :: Ord Boolean
214
447
215−#### `ordNumber`
448+#### `unit`
216
449
217− instance ordNumber :: Ord Number
450+``` purescript
451+unit :: Unit
452+```
218
453
219−#### `ordString`
220
454
221− instance ordString :: Ord String
455+#### `Eq`
222
456
223−#### `ordUnit`
457+``` purescript
458+class Eq a where
459+ (==) :: a -> a -> Boolean
460+ (/=) :: a -> a -> Boolean
461+```
224
462
225− instance ordUnit :: Ord Unit
226
463
227−#### `ringNumber`
464+#### `refEq`
228
465
229− instance ringNumber :: Ring Number
466+``` purescript
467+refEq :: forall a. a -> a -> Boolean
468+```
230
469
231−#### `semigroupArr`
232
470
233− instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
471+#### `refIneq`
234
472
235−#### `semigroupString`
473+``` purescript
474+refIneq :: forall a. a -> a -> Boolean
475+```
236
476
237− instance semigroupString :: Semigroup String
238
477
239−#### `semigroupUnit`
478+#### `eqUnit`
240
479
480+``` purescript
241− instance semigroupUnit :: Semigroup Unit
481+instance eqUnit :: Eq Unit
482+```
242
483
243−#### `semigroupoidArr`
244
484
245− instance semigroupoidArr :: Semigroupoid Prim.Function
485+#### `eqString`
246
486
247−#### `semiringNumber`
487+``` purescript
488+instance eqString :: Eq String
489+```
248
490
249− instance semiringNumber :: Semiring Number
250
491
251−#### `showArray`
492+#### `eqNumber`
252
493
253− instance showArray :: (Show a) => Show [a]
494+``` purescript
495+instance eqNumber :: Eq Number
496+```
254
497
255−#### `showBoolean`
256
498
257− instance showBoolean :: Show Boolean
499+#### `eqBoolean`
258
500
259−#### `showNumber`
501+``` purescript
502+instance eqBoolean :: Eq Boolean
503+```
260
504
261− instance showNumber :: Show Number
262
505
263−#### `showOrdering`
506+#### `eqArray`
264
507
265− instance showOrdering :: Show Ordering
508+``` purescript
509+instance eqArray :: (Eq a) => Eq [a]
510+```
266
511
267−#### `showString`
268
512
269− instance showString :: Show String
513+#### `Ordering`
270
514
271−#### `showUnit`
515+``` purescript
516+data Ordering
517+ = LT
518+ | GT
519+ | EQ
520+```
272
521
273− instance showUnit :: Show Unit
274
522
523+#### `eqOrdering`
275
524
276−### Values
525+``` purescript
526+instance eqOrdering :: Eq Ordering
527+```
277
528
278−#### `(#)`
279
529
280− (#) :: forall a b. a -> (a -> b) -> b
530+#### `showOrdering`
281
531
282−#### `($)`
532+``` purescript
533+instance showOrdering :: Show Ordering
534+```
283
535
284− ($) :: forall a b. (a -> b) -> a -> b
285
536
286−#### `(++)`
537+#### `semigroupOrdening`
287
538
288− (++) :: forall s. (Semigroup s) => s -> s -> s
539+``` purescript
540+instance semigroupOrdening :: Semigroup Ordering
541+```
289
542
290−#### `(:)`
291
543
292− (:) :: forall a. a -> [a] -> [a]
544+#### `Ord`
293
545
294−#### `(<#>)`
546+``` purescript
547+class (Eq a) <= Ord a where
548+ compare :: a -> a -> Ordering
549+```
295
550
296− (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
297
551
298#### `(<)`
552#### `(<)`
299
553
554+``` purescript
300− (<) :: forall a. (Ord a) => a -> a -> Boolean
555+(<) :: forall a. (Ord a) => a -> a -> Boolean
556+```
301
557
302−#### `(<=)`
303−
304− (<=) :: forall a. (Ord a) => a -> a -> Boolean
305
558
306#### `(>)`
559#### `(>)`
307
560
561+``` purescript
308− (>) :: forall a. (Ord a) => a -> a -> Boolean
562+(>) :: forall a. (Ord a) => a -> a -> Boolean
563+```
564+
565+
566+#### `(<=)`
567+
568+``` purescript
569+(<=) :: forall a. (Ord a) => a -> a -> Boolean
570+```
571+
309
572
310#### `(>=)`
573#### `(>=)`
311
574
575+``` purescript
312− (>=) :: forall a. (Ord a) => a -> a -> Boolean
576+(>=) :: forall a. (Ord a) => a -> a -> Boolean
577+```
313
578
314−#### `(>>>)`
315
579
316− (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
580+#### `ordUnit`
317
581
318−#### `ap`
582+``` purescript
583+instance ordUnit :: Ord Unit
584+```
319
585
320− ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
321
586
322−#### `asTypeOf`
587+#### `ordBoolean`
323
588
324−This function returns its first argument, and can be used to assert type equalities.
589+``` purescript
325−This can be useful when types are otherwise ambiguous.
590+instance ordBoolean :: Ord Boolean
591+```
326
592
327−E.g.
328
593
329− main = print $ [] `asTypeOf` [0]
594+#### `ordNumber`
330
595
331−If instead, we had written `main = print []`, the type of the argument `[]` would have
596+``` purescript
332−been ambiguous, resulting in a compile-time error.
597+instance ordNumber :: Ord Number
598+```
333
599
334− asTypeOf :: forall a. a -> a -> a
335
600
336−#### `cons`
601+#### `ordString`
337
602
338− cons :: forall a. a -> [a] -> [a]
603+``` purescript
604+instance ordString :: Ord String
605+```
339
606
340−#### `const`
341
607
342−Returns its first argument and ignores its second.
608+#### `ordArray`
343
609
344− const :: forall a b. a -> b -> a
610+``` purescript
611+instance ordArray :: (Ord a) => Ord [a]
612+```
345
613
346−#### `flip`
347
614
348−Flips the order of the arguments to a function of two arguments.
615+#### `Bits`
349
616
350− flip :: forall a b c. (a -> b -> c) -> b -> a -> c
617+``` purescript
618+class Bits b where
619+ (.&.) :: b -> b -> b
620+ (.|.) :: b -> b -> b
621+ (.^.) :: b -> b -> b
622+ shl :: b -> Number -> b
623+ shr :: b -> Number -> b
624+ zshr :: b -> Number -> b
625+ complement :: b -> b
626+```
351
627
352−#### `liftA1`
353
628
354− liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
629+#### `bitsNumber`
355
630
356−#### `liftM1`
631+``` purescript
632+instance bitsNumber :: Bits Number
633+```
357
634
358− liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
359
635
360−#### `negate`
636+#### `BoolLike`
361
637
362− negate :: forall a. (Ring a) => a -> a
638+``` purescript
639+class BoolLike b where
640+ (&&) :: b -> b -> b
641+ (||) :: b -> b -> b
642+ not :: b -> b
643+```
363
644
364−#### `otherwise`
365
645
366−An alias for `true`, which can be useful in guard clauses:
646+#### `boolLikeBoolean`
367
647
368−E.g.
648+``` purescript
649+instance boolLikeBoolean :: BoolLike Boolean
650+```
369
651
370− max x y | x >= y = x
371− | otherwise = y
372
652
373− otherwise :: Boolean
653+#### `Semigroup`
374
654
375−#### `refEq`
655+``` purescript
656+class Semigroup a where
657+ (<>) :: a -> a -> a
658+```
376
659
377− refEq :: forall a. a -> a -> Boolean
378
660
379−#### `refIneq`
661+#### `semigroupUnit`
380
662
381− refIneq :: forall a. a -> a -> Boolean
663+``` purescript
664+instance semigroupUnit :: Semigroup Unit
665+```
382
666
383−#### `return`
384
667
385− return :: forall m a. (Monad m) => a -> m a
668+#### `semigroupString`
386
669
387−#### `unit`
670+``` purescript
671+instance semigroupString :: Semigroup String
672+```
388
673
389− unit :: Unit
390
674
391−#### `void`
675+#### `semigroupArr`
676+
677+``` purescript
678+instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
679+```
680+
681+
682+#### `(++)`
683+
684+``` purescript
685+(++) :: forall s. (Semigroup s) => s -> s -> s
686+```
392
687
393− void :: forall f a. (Functor f) => f a -> f Unit
394
688
395
689
396## Module Data.Function
690## Module Data.Function
397
691
398−### Types
692+
693+
694+#### `on`
695+
696+``` purescript
697+on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
698+```
699+
399
700
400#### `Fn0`
701#### `Fn0`
401
702
703+``` purescript
402− data Fn0 :: * -> *
704+data Fn0 :: * -> *
705+```
403
706
404−#### `Fn1`
405
707
406− data Fn1 :: * -> * -> *
708+#### `Fn1`
407
709
408−#### `Fn10`
710+``` purescript
711+data Fn1 :: * -> * -> *
712+```
409
713
410− data Fn10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
411
714
412#### `Fn2`
715#### `Fn2`
413
716
717+``` purescript
414− data Fn2 :: * -> * -> * -> *
718+data Fn2 :: * -> * -> * -> *
719+```
720+
415
721
416#### `Fn3`
722#### `Fn3`
417
723
724+``` purescript
418− data Fn3 :: * -> * -> * -> * -> *
725+data Fn3 :: * -> * -> * -> * -> *
726+```
727+
419
728
420#### `Fn4`
729#### `Fn4`
421
730
731+``` purescript
422− data Fn4 :: * -> * -> * -> * -> * -> *
732+data Fn4 :: * -> * -> * -> * -> * -> *
733+```
734+
423
735
424#### `Fn5`
736#### `Fn5`
425
737
738+``` purescript
426− data Fn5 :: * -> * -> * -> * -> * -> * -> *
739+data Fn5 :: * -> * -> * -> * -> * -> * -> *
740+```
741+
427
742
428#### `Fn6`
743#### `Fn6`
429
744
745+``` purescript
430− data Fn6 :: * -> * -> * -> * -> * -> * -> * -> *
746+data Fn6 :: * -> * -> * -> * -> * -> * -> * -> *
747+```
748+
431
749
432#### `Fn7`
750#### `Fn7`
433
751
752+``` purescript
434− data Fn7 :: * -> * -> * -> * -> * -> * -> * -> * -> *
753+data Fn7 :: * -> * -> * -> * -> * -> * -> * -> * -> *
754+```
755+
435
756
436#### `Fn8`
757#### `Fn8`
437
758
759+``` purescript
438− data Fn8 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> *
760+data Fn8 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> *
761+```
762+
439
763
440#### `Fn9`
764#### `Fn9`
441
765
766+``` purescript
442− data Fn9 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
767+data Fn9 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
768+```
769+
443
770
771+#### `Fn10`
772+
773+``` purescript
774+data Fn10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
775+```
444
776
445−### Values
446
777
447#### `mkFn0`
778#### `mkFn0`
448
779
780+``` purescript
449− mkFn0 :: forall a. (Unit -> a) -> Fn0 a
781+mkFn0 :: forall a. (Unit -> a) -> Fn0 a
782+```
450
783
451−#### `mkFn1`
452
784
453− mkFn1 :: forall a b. (a -> b) -> Fn1 a b
785+#### `mkFn1`
454
786
455−#### `mkFn10`
787+``` purescript
788+mkFn1 :: forall a b. (a -> b) -> Fn1 a b
789+```
456
790
457− 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
458
791
459#### `mkFn2`
792#### `mkFn2`
460
793
794+``` purescript
461− mkFn2 :: forall a b c. (a -> b -> c) -> Fn2 a b c
795+mkFn2 :: forall a b c. (a -> b -> c) -> Fn2 a b c
796+```
797+
462
798
463#### `mkFn3`
799#### `mkFn3`
464
800
801+``` purescript
465− mkFn3 :: forall a b c d. (a -> b -> c -> d) -> Fn3 a b c d
802+mkFn3 :: forall a b c d. (a -> b -> c -> d) -> Fn3 a b c d
803+```
804+
466
805
467#### `mkFn4`
806#### `mkFn4`
468
807
808+``` purescript
469− mkFn4 :: forall a b c d e. (a -> b -> c -> d -> e) -> Fn4 a b c d e
809+mkFn4 :: forall a b c d e. (a -> b -> c -> d -> e) -> Fn4 a b c d e
810+```
811+
470
812
471#### `mkFn5`
813#### `mkFn5`
472
814
815+``` purescript
473− mkFn5 :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Fn5 a b c d e f
816+mkFn5 :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Fn5 a b c d e f
817+```
818+
474
819
475#### `mkFn6`
820#### `mkFn6`
476
821
822+``` purescript
477− mkFn6 :: forall a b c d e f g. (a -> b -> c -> d -> e -> f -> g) -> Fn6 a b c d e f g
823+mkFn6 :: forall a b c d e f g. (a -> b -> c -> d -> e -> f -> g) -> Fn6 a b c d e f g
824+```
825+
478
826
479#### `mkFn7`
827#### `mkFn7`
480
828
829+``` purescript
481− 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
830+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
831+```
832+
482
833
483#### `mkFn8`
834#### `mkFn8`
484
835
836+``` purescript
485− 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
837+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
838+```
839+
486
840
487#### `mkFn9`
841#### `mkFn9`
488
842
843+``` purescript
489− 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
844+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
845+```
490
846
491−#### `on`
492
847
493− on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
848+#### `mkFn10`
849+
850+``` purescript
851+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
852+```
853+
494
854
495#### `runFn0`
855#### `runFn0`
496
856
857+``` purescript
497− runFn0 :: forall a. Fn0 a -> a
858+runFn0 :: forall a. Fn0 a -> a
859+```
498
860
499−#### `runFn1`
500
861
501− runFn1 :: forall a b. Fn1 a b -> a -> b
862+#### `runFn1`
502
863
503−#### `runFn10`
864+``` purescript
865+runFn1 :: forall a b. Fn1 a b -> a -> b
866+```
504
867
505− 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
506
868
507#### `runFn2`
869#### `runFn2`
508
870
871+``` purescript
509− runFn2 :: forall a b c. Fn2 a b c -> a -> b -> c
872+runFn2 :: forall a b c. Fn2 a b c -> a -> b -> c
873+```
874+
510
875
511#### `runFn3`
876#### `runFn3`
512
877
878+``` purescript
513− runFn3 :: forall a b c d. Fn3 a b c d -> a -> b -> c -> d
879+runFn3 :: forall a b c d. Fn3 a b c d -> a -> b -> c -> d
880+```
881+
514
882
515#### `runFn4`
883#### `runFn4`
516
884
885+``` purescript
517− runFn4 :: forall a b c d e. Fn4 a b c d e -> a -> b -> c -> d -> e
886+runFn4 :: forall a b c d e. Fn4 a b c d e -> a -> b -> c -> d -> e
887+```
888+
518
889
519#### `runFn5`
890#### `runFn5`
520
891
892+``` purescript
521− runFn5 :: forall a b c d e f. Fn5 a b c d e f -> a -> b -> c -> d -> e -> f
893+runFn5 :: forall a b c d e f. Fn5 a b c d e f -> a -> b -> c -> d -> e -> f
894+```
895+
522
896
523#### `runFn6`
897#### `runFn6`
524
898
899+``` purescript
525− runFn6 :: forall a b c d e f g. Fn6 a b c d e f g -> a -> b -> c -> d -> e -> f -> g
900+runFn6 :: forall a b c d e f g. Fn6 a b c d e f g -> a -> b -> c -> d -> e -> f -> g
901+```
902+
526
903
527#### `runFn7`
904#### `runFn7`
528
905
906+``` purescript
529− 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
907+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
908+```
909+
530
910
531#### `runFn8`
911#### `runFn8`
532
912
913+``` purescript
533− 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
914+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
915+```
916+
534
917
535#### `runFn9`
918#### `runFn9`
536
919
920+``` purescript
537− 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
921+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
922+```
923+
924+
925+#### `runFn10`
926+
927+``` purescript
928+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
929+```
930+
538
931
539
932
540## Module Prelude.Unsafe
933## Module Prelude.Unsafe
541
934
542−### Values
935+
543
936
544#### `unsafeIndex`
937#### `unsafeIndex`
545
938
939+``` purescript
546− unsafeIndex :: forall a. [a] -> Number -> a
940+unsafeIndex :: forall a. [a] -> Number -> a
941+```
942+
547
943
548
944
549## Module Control.Monad.Eff
945## Module Control.Monad.Eff
550
946
551−### Types
947+
552
948
553#### `Eff`
949#### `Eff`
554
950
951+``` purescript
555− data Eff :: # ! -> * -> *
952+data Eff :: # ! -> * -> *
953+```
556
954
557−#### `Pure`
558
955
559− type Pure a = forall e. Eff e a
956+#### `returnE`
560
957
958+``` purescript
959+returnE :: forall e a. a -> Eff e a
960+```
561
961
562−### Type Class Instances
563
962
564−#### `applicativeEff`
963+#### `bindE`
565
964
566− instance applicativeEff :: Applicative (Eff e)
965+``` purescript
966+bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
967+```
567
968
568−#### `applyEff`
569
969
570− instance applyEff :: Apply (Eff e)
970+#### `Pure`
571
971
572−#### `bindEff`
972+``` purescript
973+type Pure a = forall e. Eff e a
974+```
573
975
574− instance bindEff :: Bind (Eff e)
575
976
576−#### `functorEff`
977+#### `runPure`
577
978
578− instance functorEff :: Functor (Eff e)
979+``` purescript
980+runPure :: forall a. Pure a -> a
981+```
579
982
580−#### `monadEff`
581
983
582− instance monadEff :: Monad (Eff e)
984+#### `functorEff`
583
985
986+``` purescript
987+instance functorEff :: Functor (Eff e)
988+```
584
989
585−### Values
586
990
587−#### `bindE`
991+#### `applyEff`
588
992
589− bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
993+``` purescript
994+instance applyEff :: Apply (Eff e)
995+```
590
996
591−#### `forE`
592
997
593− forE :: forall e. Number -> Number -> (Number -> Eff e Unit) -> Eff e Unit
998+#### `applicativeEff`
594
999
595−#### `foreachE`
1000+``` purescript
1001+instance applicativeEff :: Applicative (Eff e)
1002+```
596
1003
597− foreachE :: forall e a. [a] -> (a -> Eff e Unit) -> Eff e Unit
598
1004
599−#### `returnE`
1005+#### `bindEff`
600
1006
601− returnE :: forall e a. a -> Eff e a
1007+``` purescript
1008+instance bindEff :: Bind (Eff e)
1009+```
602
1010
603−#### `runPure`
604
1011
605− runPure :: forall a. Pure a -> a
1012+#### `monadEff`
1013+
1014+``` purescript
1015+instance monadEff :: Monad (Eff e)
1016+```
1017+
606
1018
607#### `untilE`
1019#### `untilE`
608
1020
1021+``` purescript
609− untilE :: forall e. Eff e Boolean -> Eff e Unit
1022+untilE :: forall e. Eff e Boolean -> Eff e Unit
1023+```
1024+
610
1025
611#### `whileE`
1026#### `whileE`
612
1027
1028+``` purescript
613− whileE :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
1029+whileE :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
1030+```
1031+
1032+
1033+#### `forE`
1034+
1035+``` purescript
1036+forE :: forall e. Number -> Number -> (Number -> Eff e Unit) -> Eff e Unit
1037+```
1038+
1039+
1040+#### `foreachE`
1041+
1042+``` purescript
1043+foreachE :: forall e a. [a] -> (a -> Eff e Unit) -> Eff e Unit
1044+```
1045+
614
1046
615
1047
616## Module Control.Monad.Eff.Unsafe
1048## Module Control.Monad.Eff.Unsafe
617
1049
618−### Values
1050+
619
1051
620#### `unsafeInterleaveEff`
1052#### `unsafeInterleaveEff`
621
1053
1054+``` purescript
622− unsafeInterleaveEff :: forall eff1 eff2 a. Eff eff1 a -> Eff eff2 a
1055+unsafeInterleaveEff :: forall eff1 eff2 a. Eff eff1 a -> Eff eff2 a
1056+```
1057+
623
1058
624
1059
625## Module Debug.Trace
1060## Module Debug.Trace
626
1061
627−### Types
1062+
628
1063
629#### `Trace`
1064#### `Trace`
630
1065
1066+``` purescript
631− data Trace :: !
1067+data Trace :: !
1068+```
632
1069
633
1070
634−### Values
1071+#### `trace`
635
1072
636−#### `print`
1073+``` purescript
1074+trace :: forall r. String -> Eff (trace :: Trace | r) Unit
1075+```
637
1076
638− print :: forall a r. (Show a) => a -> Eff (trace :: Trace | r) Unit
639
1077
640−#### `trace`
1078+#### `print`
1079+
1080+``` purescript
1081+print :: forall a r. (Show a) => a -> Eff (trace :: Trace | r) Unit
1082+```
641
1083
642− trace :: forall r. String -> Eff (trace :: Trace | r) Unit
643
1084
644
1085
645## Module Control.Monad.ST
1086## Module Control.Monad.ST
646
1087
647−### Types
1088+
648
1089
649#### `ST`
1090#### `ST`
650
1091
1092+``` purescript
651− data ST :: * -> !
1093+data ST :: * -> !
1094+```
1095+
652
1096
653#### `STRef`
1097#### `STRef`
654
1098
1099+``` purescript
655− data STRef :: * -> * -> *
1100+data STRef :: * -> * -> *
1101+```
656
1102
657
1103
658−### Values
1104+#### `newSTRef`
659
1105
660−#### `modifySTRef`
1106+``` purescript
1107+newSTRef :: forall a h r. a -> Eff (st :: ST h | r) (STRef h a)
1108+```
661
1109
662− modifySTRef :: forall a h r. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a
663
1110
664−#### `newSTRef`
1111+#### `readSTRef`
665
1112
1113+``` purescript
666− newSTRef :: forall a h r. a -> Eff (st :: ST h | r) (STRef h a)
1114+readSTRef :: forall a h r. STRef h a -> Eff (st :: ST h | r) a
1115+```
667
1116
668−#### `pureST`
669
1117
670− pureST :: forall a. (forall h r. Eff (st :: ST h | r) a) -> a
1118+#### `modifySTRef`
671
1119
672−#### `readSTRef`
1120+``` purescript
1121+modifySTRef :: forall a h r. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a
1122+```
1123+
1124+
1125+#### `writeSTRef`
1126+
1127+``` purescript
1128+writeSTRef :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a
1129+```
673
1130
674− readSTRef :: forall a h r. STRef h a -> Eff (st :: ST h | r) a
675
1131
676#### `runST`
1132#### `runST`
677
1133
1134+``` purescript
678− runST :: forall a r. (forall h. Eff (st :: ST h | r) a) -> Eff r a
1135+runST :: forall a r. (forall h. Eff (st :: ST h | r) a) -> Eff r a
1136+```
679
1137
680−#### `writeSTRef`
681
1138
1139+#### `pureST`
1140+
1141+``` purescript
682− writeSTRef :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a
1142+pureST :: forall a. (forall h r. Eff (st :: ST h | r) a) -> a
1143+```
1144+
683
1145
684
1146
685
1147
prelude/images/Prelude.png

Binary file not shown.

prelude/prelude.purs+26−26
@@ -66,8 +66,8 @@ module Prelude
66 -- |
66 -- |
67 -- | `Semigroupoid`s should obey the following rule:
67 -- | `Semigroupoid`s should obey the following rule:
68 -- |
68 -- |
69− -- | Association
69+ -- | Association:
70− -- | forall p q r. p <<< (q <<< r) = (p <<< q) <<< r
70+ -- | `forall p q r. p <<< (q <<< r) = (p <<< q) <<< r`
71 -- |
71 -- |
72 class Semigroupoid a where
72 class Semigroupoid a where
73 (<<<) :: forall b c d. a c d -> a b c -> a b d
73 (<<<) :: forall b c d. a c d -> a b c -> a b d
@@ -83,11 +83,11 @@ module Prelude
83 -- |
83 -- |
84 -- | `Category`s should obey the following rules.
84 -- | `Category`s should obey the following rules.
85 -- |
85 -- |
86− -- | Left Identity
86+ -- | Left Identity:
87− -- | forall p. id <<< p = p
87+ -- | `forall p. id <<< p = p`
88 -- |
88 -- |
89− -- | Right Identity
89+ -- | Right Identity:
90− -- | forall p. p <<< id = p
90+ -- | `forall p. p <<< id = p`
91 -- |
91 -- |
92 class (Semigroupoid a) <= Category a where
92 class (Semigroupoid a) <= Category a where
93 id :: forall t. a t t
93 id :: forall t. a t t
@@ -172,11 +172,11 @@ module Prelude
172 -- |
172 -- |
173 -- | `Functor`s should obey the following rules.
173 -- | `Functor`s should obey the following rules.
174 -- |
174 -- |
175− -- | Identity
175+ -- | Identity:
176− -- | (<$>) id = id
176+ -- | `(<$>) id = id`
177 -- |
177 -- |
178− -- | Composition
178+ -- | Composition:
179− -- | forall f g. (<$>) (f . g) = ((<$>) f) . ((<$>) g)
179+ -- | `forall f g. (<$>) (f . g) = ((<$>) f) . ((<$>) g)`
180 -- |
180 -- |
181 class Functor f where
181 class Functor f where
182 (<$>) :: forall a b. (a -> b) -> f a -> f b
182 (<$>) :: forall a b. (a -> b) -> f a -> f b
@@ -194,8 +194,8 @@ module Prelude
194 -- |
194 -- |
195 -- | `Apply`s should obey the following rules.
195 -- | `Apply`s should obey the following rules.
196 -- |
196 -- |
197− -- | Associative Composition
197+ -- | Associative Composition:
198− -- | forall f g h. (.) <$> f <*> g <*> h = f <*> (g <*> h)
198+ -- | `forall f g h. (.) <$> f <*> g <*> h = f <*> (g <*> h)`
199 -- |
199 -- |
200 class (Functor f) <= Apply f where
200 class (Functor f) <= Apply f where
201 (<*>) :: forall a b. f (a -> b) -> f a -> f b
201 (<*>) :: forall a b. f (a -> b) -> f a -> f b
@@ -205,17 +205,17 @@ module Prelude
205 -- |
205 -- |
206 -- | `Applicative`s should obey the following rules.
206 -- | `Applicative`s should obey the following rules.
207 -- |
207 -- |
208− -- | Identity
208+ -- | Identity:
209− -- | forall v. (pure id) <*> v = v
209+ -- | `forall v. (pure id) <*> v = v`
210 -- |
210 -- |
211− -- | Composition
211+ -- | Composition:
212− -- | forall f g h. (pure (.)) <*> f <*> g <*> h = f <*> (g <*> h)
212+ -- | `forall f g h. (pure (.)) <*> f <*> g <*> h = f <*> (g <*> h)`
213 -- |
213 -- |
214− -- | Homomorphism
214+ -- | Homomorphism:
215− -- | forall f x. (pure f) <*> (pure x) = pure (f x)
215+ -- | `forall f x. (pure f) <*> (pure x) = pure (f x)`
216 -- |
216 -- |
217− -- | Interchange
217+ -- | Interchange:
218− -- | forall u y. u <*> (pure y) = (pure (($) y)) <*> u
218+ -- | `forall u y. u <*> (pure y) = (pure (($) y)) <*> u`
219 -- |
219 -- |
220 class (Apply f) <= Applicative f where
220 class (Apply f) <= Applicative f where
221 pure :: forall a. a -> f a
221 pure :: forall a. a -> f a
@@ -229,8 +229,8 @@ module Prelude
229 -- |
229 -- |
230 -- | `Bind`s should obey the following rule.
230 -- | `Bind`s should obey the following rule.
231 -- |
231 -- |
232− -- | Associativity
232+ -- | Associativity:
233− -- | forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)
233+ -- | `forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)`
234 -- |
234 -- |
235 class (Apply m) <= Bind m where
235 class (Apply m) <= Bind m where
236 (>>=) :: forall a b. m a -> (a -> m b) -> m b
236 (>>=) :: forall a b. m a -> (a -> m b) -> m b
@@ -240,11 +240,11 @@ module Prelude
240 -- |
240 -- |
241 -- | `Monad`s should obey the following rules.
241 -- | `Monad`s should obey the following rules.
242 -- |
242 -- |
243− -- | Left Identity
243+ -- | Left Identity:
244− -- | forall f x. pure x >>= f = f x
244+ -- | `forall f x. pure x >>= f = f x`
245 -- |
245 -- |
246− -- | Right Identity
246+ -- | Right Identity:
247− -- | forall x. x >>= pure = x
247+ -- | `forall x. x >>= pure = x`
248 -- |
248 -- |
249 class (Applicative m, Bind m) <= Monad m
249 class (Applicative m, Bind m) <= Monad m
250
250
prelude/updateDocs.sh+1−1
@@ -1,4 +1,4 @@
1−../dist/build/psc-docs/psc-docs --hierarchy-images prelude.purs > README.md
1+../dist/build/psc-docs/psc-docs prelude.purs > README.md
2../dist/build/psc-hierarchy/psc-hierarchy prelude.purs -o prelude
2../dist/build/psc-hierarchy/psc-hierarchy prelude.purs -o prelude
3
3
4mkdir -p images
4mkdir -p images