-
-
Notifications
You must be signed in to change notification settings - Fork 505
/
Copy pathpipeable.ts
2611 lines (2473 loc) · 94.8 KB
/
pipeable.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @since 2.0.0
*/
import { Alt, Alt1, Alt2, Alt2C, Alt3, Alt3C, Alt4 } from './Alt'
import {
apFirst as apFirst_,
Apply,
Apply1,
Apply2,
Apply2C,
Apply3,
Apply3C,
Apply4,
apSecond as apSecond_
} from './Apply'
import { Bifunctor, Bifunctor2, Bifunctor2C, Bifunctor3, Bifunctor3C, Bifunctor4 } from './Bifunctor'
import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C, Chain4, chainFirst as chainFirst_ } from './Chain'
import {
Compactable,
Compactable1,
Compactable2,
Compactable2C,
Compactable3,
Compactable3C,
Compactable4
} from './Compactable'
import {
Contravariant,
Contravariant1,
Contravariant2,
Contravariant2C,
Contravariant3,
Contravariant3C,
Contravariant4
} from './Contravariant'
import { Either } from './Either'
import { Extend, Extend1, Extend2, Extend2C, Extend3, Extend3C, Extend4 } from './Extend'
import {
Filterable,
Filterable1,
Filterable2,
Filterable2C,
Filterable3,
Filterable3C,
Filterable4
} from './Filterable'
import {
FilterableWithIndex,
FilterableWithIndex1,
FilterableWithIndex2,
FilterableWithIndex2C,
FilterableWithIndex3,
FilterableWithIndex3C,
FilterableWithIndex4,
PredicateWithIndex,
RefinementWithIndex
} from './FilterableWithIndex'
import { Foldable, Foldable1, Foldable2, Foldable2C, Foldable3, Foldable3C, Foldable4 } from './Foldable'
import {
FoldableWithIndex,
FoldableWithIndex1,
FoldableWithIndex2,
FoldableWithIndex2C,
FoldableWithIndex3,
FoldableWithIndex3C,
FoldableWithIndex4
} from './FoldableWithIndex'
import { identity, LazyArg, pipe as pipeFromFunctionModule } from './function'
import { Functor, Functor1, Functor2, Functor2C, Functor3, Functor3C, Functor4 } from './Functor'
import {
FunctorWithIndex,
FunctorWithIndex1,
FunctorWithIndex2,
FunctorWithIndex2C,
FunctorWithIndex3,
FunctorWithIndex3C,
FunctorWithIndex4
} from './FunctorWithIndex'
import { HKT, HKT2, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
import {
MonadThrow,
MonadThrow1,
MonadThrow2,
MonadThrow2C,
MonadThrow3,
MonadThrow3C,
MonadThrow4
} from './MonadThrow'
import { Monoid } from './Monoid'
import { Option } from './Option'
import { Predicate } from './Predicate'
import { Profunctor, Profunctor2, Profunctor2C, Profunctor3, Profunctor3C, Profunctor4 } from './Profunctor'
import { Refinement } from './Refinement'
import {
Semigroupoid,
Semigroupoid2,
Semigroupoid2C,
Semigroupoid3,
Semigroupoid3C,
Semigroupoid4
} from './Semigroupoid'
import { Separated } from './Separated'
// -------------------------------------------------------------------------------------
// pipeable helpers
// -------------------------------------------------------------------------------------
/**
* Returns a pipeable `map`
*
* @category pipeable helper
* @since 2.13.0
*/
export function map<F extends URIS4>(
F: Functor4<F>
): <A, B>(f: (a: A) => B) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function map<F extends URIS3>(
F: Functor3<F>
): <A, B>(f: (a: A) => B) => <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function map<F extends URIS3, E>(
F: Functor3C<F, E>
): <A, B>(f: (a: A) => B) => <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function map<F extends URIS2>(
F: Functor2<F>
): <A, B>(f: (a: A) => B) => <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function map<F extends URIS2, E>(
F: Functor2C<F, E>
): <A, B>(f: (a: A) => B) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function map<F extends URIS>(F: Functor1<F>): <A, B>(f: (a: A) => B) => (fa: Kind<F, A>) => Kind<F, B>
export function map<F>(F: Functor<F>): <A, B>(f: (a: A) => B) => (fa: HKT<F, A>) => HKT<F, B>
export function map<F>(F: Functor<F>): <A, B>(f: (a: A) => B) => (fa: HKT<F, A>) => HKT<F, B> {
return (f) => (fa) => F.map(fa, f)
}
/**
* Returns a pipeable `contramap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function contramap<F extends URIS4>(
F: Contravariant4<F>
): <A, B>(f: (b: B) => A) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function contramap<F extends URIS3>(
F: Contravariant3<F>
): <A, B>(f: (b: B) => A) => <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function contramap<F extends URIS3, E>(
F: Contravariant3C<F, E>
): <A, B>(f: (b: B) => A) => <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function contramap<F extends URIS2>(
F: Contravariant2<F>
): <A, B>(f: (b: B) => A) => <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function contramap<F extends URIS2, E>(
F: Contravariant2C<F, E>
): <A, B>(f: (b: B) => A) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function contramap<F extends URIS>(
F: Contravariant1<F>
): <A, B>(f: (b: B) => A) => (fa: Kind<F, A>) => Kind<F, B>
export function contramap<F>(F: Contravariant<F>): <A, B>(f: (b: B) => A) => (fa: HKT<F, A>) => HKT<F, B>
export function contramap<F>(F: Contravariant<F>): <A, B>(f: (b: B) => A) => (fa: HKT<F, A>) => HKT<F, B> {
return (f) => (fa) => F.contramap(fa, f)
}
/**
* Returns a pipeable `mapWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function mapWithIndex<F extends URIS4, I>(
F: FunctorWithIndex4<F, I>
): <A, B>(f: (i: I, a: A) => B) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function mapWithIndex<F extends URIS3, I>(
F: FunctorWithIndex3<F, I>
): <A, B>(f: (i: I, a: A) => B) => <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function mapWithIndex<F extends URIS3, I, E>(
F: FunctorWithIndex3C<F, I, E>
): <A, B>(f: (i: I, a: A) => B) => <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function mapWithIndex<F extends URIS2, I>(
F: FunctorWithIndex2<F, I>
): <A, B>(f: (i: I, a: A) => B) => <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function mapWithIndex<F extends URIS2, I, E>(
F: FunctorWithIndex2C<F, I, E>
): <A, B>(f: (i: I, a: A) => B) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function mapWithIndex<F extends URIS, I>(
F: FunctorWithIndex1<F, I>
): <A, B>(f: (i: I, a: A) => B) => (fa: Kind<F, A>) => Kind<F, B>
export function mapWithIndex<F, I>(
F: FunctorWithIndex<F, I>
): <A, B>(f: (i: I, a: A) => B) => (fa: HKT<F, A>) => HKT<F, B>
export function mapWithIndex<F, I>(
F: FunctorWithIndex<F, I>
): <A, B>(f: (i: I, a: A) => B) => (fa: HKT<F, A>) => HKT<F, B> {
return (f) => (fa) => F.mapWithIndex(fa, f)
}
/**
* Returns a pipeable `ap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function ap<F extends URIS4>(
F: Apply4<F>
): <S, R, E, A>(fa: Kind4<F, S, R, E, A>) => <B>(fab: Kind4<F, S, R, E, (a: A) => B>) => Kind4<F, S, R, E, B>
export function ap<F extends URIS3>(
F: Apply3<F>
): <R, E, A>(fa: Kind3<F, R, E, A>) => <B>(fab: Kind3<F, R, E, (a: A) => B>) => Kind3<F, R, E, B>
export function ap<F extends URIS3, E>(
F: Apply3C<F, E>
): <R, A>(fa: Kind3<F, R, E, A>) => <B>(fab: Kind3<F, R, E, (a: A) => B>) => Kind3<F, R, E, B>
export function ap<F extends URIS2>(
F: Apply2<F>
): <E, A>(fa: Kind2<F, E, A>) => <B>(fab: Kind2<F, E, (a: A) => B>) => Kind2<F, E, B>
export function ap<F extends URIS2, E>(
F: Apply2C<F, E>
): <A>(fa: Kind2<F, E, A>) => <B>(fab: Kind2<F, E, (a: A) => B>) => Kind2<F, E, B>
export function ap<F extends URIS>(F: Apply1<F>): <A>(fa: Kind<F, A>) => <B>(fab: Kind<F, (a: A) => B>) => Kind<F, B>
export function ap<F>(F: Apply<F>): <A>(fa: HKT<F, A>) => <B>(fab: HKT<F, (a: A) => B>) => HKT<F, B>
export function ap<F>(F: Apply<F>): <A>(fa: HKT<F, A>) => <B>(fab: HKT<F, (a: A) => B>) => HKT<F, B> {
return (fa) => (fab) => F.ap(fab, fa)
}
/**
* Returns a pipeable `chain`
*
* @category pipeable helper
* @since 2.13.0
*/
export function chain<F extends URIS4>(
F: Chain4<F>
): <A, S, R, E, B>(f: (a: A) => Kind4<F, S, R, E, B>) => (fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function chain<F extends URIS3>(
F: Chain3<F>
): <A, R, E, B>(f: (a: A) => Kind3<F, R, E, B>) => (fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function chain<F extends URIS3, E>(
F: Chain3C<F, E>
): <A, R, B>(f: (a: A) => Kind3<F, R, E, B>) => (fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function chain<F extends URIS2>(
F: Chain2<F>
): <A, E, B>(f: (a: A) => Kind2<F, E, B>) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function chain<F extends URIS2, E>(
F: Chain2C<F, E>
): <A, B>(f: (a: A) => Kind2<F, E, B>) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function chain<F extends URIS>(F: Chain1<F>): <A, B>(f: (a: A) => Kind<F, B>) => (fa: Kind<F, A>) => Kind<F, B>
export function chain<F>(F: Chain<F>): <A, B>(f: (a: A) => HKT<F, B>) => (fa: HKT<F, A>) => HKT<F, B>
export function chain<F>(F: Chain<F>): <A, B>(f: (a: A) => HKT<F, B>) => (fa: HKT<F, A>) => HKT<F, B> {
return (f) => (fa) => F.chain(fa, f)
}
/**
* Returns a pipeable `bimap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function bimap<F extends URIS4>(
F: Bifunctor4<F>
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => <S, R>(fea: Kind4<F, S, R, E, A>) => Kind4<F, S, R, G, B>
export function bimap<F extends URIS3>(
F: Bifunctor3<F>
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => <R>(fea: Kind3<F, R, E, A>) => Kind3<F, R, G, B>
export function bimap<F extends URIS3, E>(
F: Bifunctor3C<F, E>
): <G, A, B>(f: (e: E) => G, g: (a: A) => B) => <R>(fea: Kind3<F, R, E, A>) => Kind3<F, R, G, B>
export function bimap<F extends URIS2>(
F: Bifunctor2<F>
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (fea: Kind2<F, E, A>) => Kind2<F, G, B>
export function bimap<F extends URIS2, E>(
F: Bifunctor2C<F, E>
): <G, A, B>(f: (e: E) => G, g: (a: A) => B) => (fea: Kind2<F, E, A>) => Kind2<F, G, B>
export function bimap<F>(
F: Bifunctor<F>
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (fea: HKT2<F, E, A>) => HKT2<F, G, B>
export function bimap<F>(
F: Bifunctor<F>
): <E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (fea: HKT2<F, E, A>) => HKT2<F, G, B> {
return (f, g) => (fea) => F.bimap(fea, f, g)
}
/**
* Returns a pipeable `mapLeft`
*
* @category pipeable helper
* @since 2.13.0
*/
export function mapLeft<F extends URIS4>(
F: Bifunctor4<F>
): <E, G>(f: (e: E) => G) => <S, R, A>(fea: Kind4<F, S, R, E, A>) => Kind4<F, S, R, G, A>
export function mapLeft<F extends URIS3>(
F: Bifunctor3<F>
): <E, G>(f: (e: E) => G) => <R, A>(fea: Kind3<F, R, E, A>) => Kind3<F, R, G, A>
export function mapLeft<F extends URIS3, E>(
F: Bifunctor3C<F, E>
): <E, G>(f: (e: E) => G) => <R, A>(fea: Kind3<F, R, E, A>) => Kind3<F, R, G, A>
export function mapLeft<F extends URIS2>(
F: Bifunctor2<F>
): <E, G>(f: (e: E) => G) => <A>(fea: Kind2<F, E, A>) => Kind2<F, G, A>
export function mapLeft<F extends URIS2, E>(
F: Bifunctor2C<F, E>
): <E, G>(f: (e: E) => G) => <A>(fea: Kind2<F, E, A>) => Kind2<F, G, A>
export function mapLeft<F>(F: Bifunctor<F>): <E, G>(f: (e: E) => G) => <A>(fea: HKT2<F, E, A>) => HKT2<F, G, A>
export function mapLeft<F>(F: Bifunctor<F>): <E, G>(f: (e: E) => G) => <A>(fea: HKT2<F, E, A>) => HKT2<F, G, A> {
return (f) => (fea) => F.mapLeft(fea, f)
}
/**
* Returns a pipeable `extend`
*
* @category pipeable helper
* @since 2.13.0
*/
export function extend<F extends URIS4>(
F: Extend4<F>
): <S, R, E, A, B>(f: (wa: Kind4<F, S, R, E, A>) => B) => (wa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function extend<F extends URIS3>(
F: Extend3<F>
): <R, E, A, B>(f: (wa: Kind3<F, R, E, A>) => B) => (wa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function extend<F extends URIS3, E>(
F: Extend3C<F, E>
): <R, A, B>(f: (wa: Kind3<F, R, E, A>) => B) => (wa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function extend<F extends URIS2>(
F: Extend2<F>
): <E, A, B>(f: (wa: Kind2<F, E, A>) => B) => (wa: Kind2<F, E, A>) => Kind2<F, E, B>
export function extend<F extends URIS2, E>(
F: Extend2C<F, E>
): <A, B>(f: (wa: Kind2<F, E, A>) => B) => (wa: Kind2<F, E, A>) => Kind2<F, E, B>
export function extend<F extends URIS>(
F: Extend1<F>
): <A, B>(f: (wa: Kind<F, A>) => B) => (wa: Kind<F, A>) => Kind<F, B>
export function extend<F>(F: Extend<F>): <A, B>(f: (wa: HKT<F, A>) => B) => (wa: HKT<F, A>) => HKT<F, B>
export function extend<F>(F: Extend<F>): <A, B>(f: (wa: HKT<F, A>) => B) => (wa: HKT<F, A>) => HKT<F, B> {
return (f) => (wa) => F.extend(wa, f)
}
/**
* Returns a pipeable `reduce`
*
* @category pipeable helper
* @since 2.13.0
*/
export function reduce<F extends URIS4>(
F: Foldable4<F>
): <A, B>(b: B, f: (b: B, a: A) => B) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => B
export function reduce<F extends URIS3>(
F: Foldable3<F>
): <A, B>(b: B, f: (b: B, a: A) => B) => <R, E>(fa: Kind3<F, R, E, A>) => B
export function reduce<F extends URIS3, E>(
F: Foldable3C<F, E>
): <A, B>(b: B, f: (b: B, a: A) => B) => <R>(fa: Kind3<F, R, E, A>) => B
export function reduce<F extends URIS2>(
F: Foldable2<F>
): <A, B>(b: B, f: (b: B, a: A) => B) => <E>(fa: Kind2<F, E, A>) => B
export function reduce<F extends URIS2, E>(
F: Foldable2C<F, E>
): <A, B>(b: B, f: (b: B, a: A) => B) => (fa: Kind2<F, E, A>) => B
export function reduce<F extends URIS>(F: Foldable1<F>): <A, B>(b: B, f: (b: B, a: A) => B) => (fa: Kind<F, A>) => B
export function reduce<F>(F: Foldable<F>): <A, B>(b: B, f: (b: B, a: A) => B) => (fa: HKT<F, A>) => B
export function reduce<F>(F: Foldable<F>): <A, B>(b: B, f: (b: B, a: A) => B) => (fa: HKT<F, A>) => B {
return (b, f) => (fa) => F.reduce(fa, b, f)
}
/**
* Returns a pipeable `foldMap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function foldMap<F extends URIS4>(
F: Foldable4<F>
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => M
export function foldMap<F extends URIS3>(
F: Foldable3<F>
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => <R, E>(fa: Kind3<F, R, E, A>) => M
export function foldMap<F extends URIS3, E>(
F: Foldable3C<F, E>
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => <R>(fa: Kind3<F, R, E, A>) => M
export function foldMap<F extends URIS2>(
F: Foldable2<F>
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => <E>(fa: Kind2<F, E, A>) => M
export function foldMap<F extends URIS2, E>(
F: Foldable2C<F, E>
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: Kind2<F, E, A>) => M
export function foldMap<F extends URIS>(
F: Foldable1<F>
): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: Kind<F, A>) => M
export function foldMap<F>(F: Foldable<F>): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: HKT<F, A>) => M
export function foldMap<F>(F: Foldable<F>): <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: HKT<F, A>) => M {
return (M) => {
const foldMapM = F.foldMap(M)
return (f) => (fa) => foldMapM(fa, f)
}
}
/**
* Returns a pipeable `reduceRight`
*
* @category pipeable helper
* @since 2.13.0
*/
export function reduceRight<F extends URIS4>(
F: Foldable4<F>
): <A, B>(b: B, f: (a: A, b: B) => B) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => B
export function reduceRight<F extends URIS3>(
F: Foldable3<F>
): <A, B>(b: B, f: (a: A, b: B) => B) => <R, E>(fa: Kind3<F, R, E, A>) => B
export function reduceRight<F extends URIS3, E>(
F: Foldable3C<F, E>
): <A, B>(b: B, f: (a: A, b: B) => B) => <R>(fa: Kind3<F, R, E, A>) => B
export function reduceRight<F extends URIS2>(
F: Foldable2<F>
): <A, B>(b: B, f: (a: A, b: B) => B) => <E>(fa: Kind2<F, E, A>) => B
export function reduceRight<F extends URIS2, E>(
F: Foldable2C<F, E>
): <A, B>(b: B, f: (a: A, b: B) => B) => (fa: Kind2<F, E, A>) => B
export function reduceRight<F extends URIS>(
F: Foldable1<F>
): <A, B>(b: B, f: (a: A, b: B) => B) => (fa: Kind<F, A>) => B
export function reduceRight<F>(F: Foldable<F>): <A, B>(b: B, f: (a: A, b: B) => B) => (fa: HKT<F, A>) => B
export function reduceRight<F>(F: Foldable<F>): <A, B>(b: B, f: (a: A, b: B) => B) => (fa: HKT<F, A>) => B {
return (b, f) => (fa) => F.reduceRight(fa, b, f)
}
/**
* Returns a pipeable `reduceWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function reduceWithIndex<F extends URIS4, I>(
F: FoldableWithIndex4<F, I>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => B
export function reduceWithIndex<F extends URIS3, I>(
F: FoldableWithIndex3<F, I>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => <R, E>(fa: Kind3<F, R, E, A>) => B
export function reduceWithIndex<F extends URIS3, I, E>(
F: FoldableWithIndex3C<F, I, E>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => <R>(fa: Kind3<F, R, E, A>) => B
export function reduceWithIndex<F extends URIS2, I>(
F: FoldableWithIndex2<F, I>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => <E>(fa: Kind2<F, E, A>) => B
export function reduceWithIndex<F extends URIS2, I, E>(
F: FoldableWithIndex2C<F, I, E>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => (fa: Kind2<F, E, A>) => B
export function reduceWithIndex<F extends URIS, I>(
F: FoldableWithIndex1<F, I>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => (fa: Kind<F, A>) => B
export function reduceWithIndex<F, I>(
F: FoldableWithIndex<F, I>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => (fa: HKT<F, A>) => B
export function reduceWithIndex<F, I>(
F: FoldableWithIndex<F, I>
): <A, B>(b: B, f: (i: I, b: B, a: A) => B) => (fa: HKT<F, A>) => B {
return (b, f) => (fa) => F.reduceWithIndex(fa, b, f)
}
/**
* Returns a pipeable `foldMapWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function foldMapWithIndex<F extends URIS4, I>(
F: FoldableWithIndex4<F, I>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => M
export function foldMapWithIndex<F extends URIS3, I>(
F: FoldableWithIndex3<F, I>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => <R, E>(fa: Kind3<F, R, E, A>) => M
export function foldMapWithIndex<F extends URIS3, I, E>(
F: FoldableWithIndex3C<F, I, E>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => <R>(fa: Kind3<F, R, E, A>) => M
export function foldMapWithIndex<F extends URIS2, I>(
F: FoldableWithIndex2<F, I>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => <E>(fa: Kind2<F, E, A>) => M
export function foldMapWithIndex<F extends URIS2, I, E>(
F: FoldableWithIndex2C<F, I, E>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => (fa: Kind2<F, E, A>) => M
export function foldMapWithIndex<F extends URIS, I>(
F: FoldableWithIndex1<F, I>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => (fa: Kind<F, A>) => M
export function foldMapWithIndex<F, I>(
F: FoldableWithIndex<F, I>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => (fa: HKT<F, A>) => M
export function foldMapWithIndex<F, I>(
F: FoldableWithIndex<F, I>
): <M>(M: Monoid<M>) => <A>(f: (i: I, a: A) => M) => (fa: HKT<F, A>) => M {
return (M) => {
const foldMapWithIndexM = F.foldMapWithIndex(M)
return (f) => (fa) => foldMapWithIndexM(fa, f)
}
}
/**
* Returns a pipeable `reduceRightWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function reduceRightWithIndex<F extends URIS4, I>(
F: FoldableWithIndex4<F, I>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => B
export function reduceRightWithIndex<F extends URIS3, I>(
F: FoldableWithIndex3<F, I>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => <R, E>(fa: Kind3<F, R, E, A>) => B
export function reduceRightWithIndex<F extends URIS3, I, E>(
F: FoldableWithIndex3C<F, I, E>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => <R>(fa: Kind3<F, R, E, A>) => B
export function reduceRightWithIndex<F extends URIS2, I>(
F: FoldableWithIndex2<F, I>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => <E>(fa: Kind2<F, E, A>) => B
export function reduceRightWithIndex<F extends URIS2, I, E>(
F: FoldableWithIndex2C<F, I, E>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => (fa: Kind2<F, E, A>) => B
export function reduceRightWithIndex<F extends URIS, I>(
F: FoldableWithIndex1<F, I>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => (fa: Kind<F, A>) => B
export function reduceRightWithIndex<F, I>(
F: FoldableWithIndex<F, I>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => (fa: HKT<F, A>) => B
export function reduceRightWithIndex<F, I>(
F: FoldableWithIndex<F, I>
): <A, B>(b: B, f: (i: I, a: A, b: B) => B) => (fa: HKT<F, A>) => B {
return (b, f) => (fa) => F.reduceRightWithIndex(fa, b, f)
}
/**
* Returns a pipeable `alt`
*
* @category pipeable helper
* @since 2.13.0
*/
export function alt<F extends URIS4>(
F: Alt4<F>
): <S, R, E, A>(that: LazyArg<Kind4<F, S, R, E, A>>) => (fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, A>
export function alt<F extends URIS3>(
F: Alt3<F>
): <R, E, A>(that: LazyArg<Kind3<F, R, E, A>>) => (fa: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
export function alt<F extends URIS3, E>(
F: Alt3C<F, E>
): <R, A>(that: LazyArg<Kind3<F, R, E, A>>) => (fa: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
export function alt<F extends URIS2>(
F: Alt2<F>
): <E, A>(that: LazyArg<Kind2<F, E, A>>) => (fa: Kind2<F, E, A>) => Kind2<F, E, A>
export function alt<F extends URIS2, E>(
F: Alt2C<F, E>
): <A>(that: LazyArg<Kind2<F, E, A>>) => (fa: Kind2<F, E, A>) => Kind2<F, E, A>
export function alt<F extends URIS>(F: Alt1<F>): <A>(that: LazyArg<Kind<F, A>>) => (fa: Kind<F, A>) => Kind<F, A>
export function alt<F>(F: Alt<F>): <A>(that: LazyArg<HKT<F, A>>) => (fa: HKT<F, A>) => HKT<F, A>
export function alt<F>(F: Alt<F>): <A>(that: LazyArg<HKT<F, A>>) => (fa: HKT<F, A>) => HKT<F, A> {
return (that) => (fa) => F.alt(fa, that)
}
/**
* Returns a pipeable `filter`
*
* @category pipeable helper
* @since 2.13.0
*/
export function filter<F extends URIS4>(
F: Filterable4<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
<A>(predicate: Predicate<A>): <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, A>
}
export function filter<F extends URIS3>(
F: Filterable3<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
<A>(predicate: Predicate<A>): <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
}
export function filter<F extends URIS3, E>(
F: Filterable3C<F, E>
): {
<A, B extends A>(refinement: Refinement<A, B>): <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
<A>(predicate: Predicate<A>): <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
}
export function filter<F extends URIS2>(
F: Filterable2<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
<A>(predicate: Predicate<A>): <E>(fa: Kind2<F, E, A>) => Kind2<F, E, A>
}
export function filter<F extends URIS2, E>(
F: Filterable2C<F, E>
): {
<A, B extends A>(refinement: Refinement<A, B>): (fa: Kind2<F, E, A>) => Kind2<F, E, B>
<A>(predicate: Predicate<A>): (fa: Kind2<F, E, A>) => Kind2<F, E, A>
}
export function filter<F extends URIS>(
F: Filterable1<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): (fa: Kind<F, A>) => Kind<F, B>
<A>(predicate: Predicate<A>): (fa: Kind<F, A>) => Kind<F, A>
}
export function filter<F>(F: Filterable<F>): {
<A, B extends A>(refinement: Refinement<A, B>): (fa: HKT<F, A>) => HKT<F, B>
<A>(predicate: Predicate<A>): (fa: HKT<F, A>) => HKT<F, A>
}
export function filter<F>(F: Filterable<F>): <A>(predicate: Predicate<A>) => (fa: HKT<F, A>) => HKT<F, A> {
return (predicate) => (fa) => F.filter(fa, predicate)
}
/**
* Returns a pipeable `filterMap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function filterMap<F extends URIS4>(
F: Filterable4<F>
): <A, B>(f: (a: A) => Option<B>) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function filterMap<F extends URIS3>(
F: Filterable3<F>
): <A, B>(f: (a: A) => Option<B>) => <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function filterMap<F extends URIS3, E>(
F: Filterable3C<F, E>
): <A, B>(f: (a: A) => Option<B>) => <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function filterMap<F extends URIS2>(
F: Filterable2<F>
): <A, B>(f: (a: A) => Option<B>) => <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function filterMap<F extends URIS2, E>(
F: Filterable2C<F, E>
): <A, B>(f: (a: A) => Option<B>) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function filterMap<F extends URIS>(
F: Filterable1<F>
): <A, B>(f: (a: A) => Option<B>) => (fa: Kind<F, A>) => Kind<F, B>
export function filterMap<F>(F: Filterable<F>): <A, B>(f: (a: A) => Option<B>) => (fa: HKT<F, A>) => HKT<F, B>
export function filterMap<F>(F: Filterable<F>): <A, B>(f: (a: A) => Option<B>) => (fa: HKT<F, A>) => HKT<F, B> {
return (f) => (fa) => F.filterMap(fa, f)
}
/**
* Returns a pipeable `partition`
*
* @category pipeable helper
* @since 2.13.0
*/
export function partition<F extends URIS4>(
F: Filterable4<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): <S, R, E>(
fa: Kind4<F, S, R, E, A>
) => Separated<Kind4<F, S, R, E, A>, Kind4<F, S, R, E, B>>
<A>(predicate: Predicate<A>): <S, R, E>(
fa: Kind4<F, S, R, E, A>
) => Separated<Kind4<F, S, R, E, A>, Kind4<F, S, R, E, A>>
}
export function partition<F extends URIS3>(
F: Filterable3<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): <R, E>(
fa: Kind3<F, R, E, A>
) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, B>>
<A>(predicate: Predicate<A>): <R, E>(fa: Kind3<F, R, E, A>) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, A>>
}
export function partition<F extends URIS3, E>(
F: Filterable3C<F, E>
): {
<A, B extends A>(refinement: Refinement<A, B>): <R>(
fa: Kind3<F, R, E, A>
) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, B>>
<A>(predicate: Predicate<A>): <R>(fa: Kind3<F, R, E, A>) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, A>>
}
export function partition<F extends URIS2>(
F: Filterable2<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): <E>(fa: Kind2<F, E, A>) => Separated<Kind2<F, E, A>, Kind2<F, E, B>>
<A>(predicate: Predicate<A>): <E>(fa: Kind2<F, E, A>) => Separated<Kind2<F, E, A>, Kind2<F, E, A>>
}
export function partition<F extends URIS2, E>(
F: Filterable2C<F, E>
): {
<A, B extends A>(refinement: Refinement<A, B>): (fa: Kind2<F, E, A>) => Separated<Kind2<F, E, A>, Kind2<F, E, B>>
<A>(predicate: Predicate<A>): (fa: Kind2<F, E, A>) => Separated<Kind2<F, E, A>, Kind2<F, E, A>>
}
export function partition<F extends URIS>(
F: Filterable1<F>
): {
<A, B extends A>(refinement: Refinement<A, B>): (fa: Kind<F, A>) => Separated<Kind<F, A>, Kind<F, B>>
<A>(predicate: Predicate<A>): (fa: Kind<F, A>) => Separated<Kind<F, A>, Kind<F, A>>
}
export function partition<F>(F: Filterable<F>): {
<A, B extends A>(refinement: Refinement<A, B>): (fa: HKT<F, A>) => Separated<HKT<F, A>, HKT<F, B>>
<A>(predicate: Predicate<A>): (fa: HKT<F, A>) => Separated<HKT<F, A>, HKT<F, A>>
}
export function partition<F>(
F: Filterable<F>
): <A>(predicate: Predicate<A>) => (fa: HKT<F, A>) => Separated<HKT<F, A>, HKT<F, A>> {
return (f) => (fa) => F.partition(fa, f)
}
/**
* Returns a pipeable `partitionMap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function partitionMap<F extends URIS4>(
F: Filterable4<F>
): <A, B, C>(
f: (a: A) => Either<B, C>
) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Separated<Kind4<F, S, R, E, B>, Kind4<F, S, R, E, C>>
export function partitionMap<F extends URIS3>(
F: Filterable3<F>
): <A, B, C>(
f: (a: A) => Either<B, C>
) => <R, E>(fa: Kind3<F, R, E, A>) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
export function partitionMap<F extends URIS3, E>(
F: Filterable3C<F, E>
): <A, B, C>(f: (a: A) => Either<B, C>) => <R>(fa: Kind3<F, R, E, A>) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
export function partitionMap<F extends URIS2>(
F: Filterable2<F>
): <A, B, C>(f: (a: A) => Either<B, C>) => <E>(fa: Kind2<F, E, A>) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
export function partitionMap<F extends URIS2, E>(
F: Filterable2C<F, E>
): <A, B, C>(f: (a: A) => Either<B, C>) => (fa: Kind2<F, E, A>) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
export function partitionMap<F extends URIS>(
F: Filterable1<F>
): <A, B, C>(f: (a: A) => Either<B, C>) => (fa: Kind<F, A>) => Separated<Kind<F, B>, Kind<F, C>>
export function partitionMap<F>(
F: Filterable<F>
): <A, B, C>(f: (a: A) => Either<B, C>) => (fa: HKT<F, A>) => Separated<HKT<F, B>, HKT<F, C>>
export function partitionMap<F>(
F: Filterable<F>
): <A, B, C>(f: (a: A) => Either<B, C>) => (fa: HKT<F, A>) => Separated<HKT<F, B>, HKT<F, C>> {
return (f) => (fa) => F.partitionMap(fa, f)
}
/**
* Returns a pipeable `filterWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function filterWithIndex<F extends URIS4, I>(
F: FilterableWithIndex4<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <S, R, E>(
fa: Kind4<F, S, R, E, A>
) => Kind4<F, S, R, E, B>
<A>(predicate: PredicateWithIndex<I, A>): <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, A>
}
export function filterWithIndex<F extends URIS3, I>(
F: FilterableWithIndex3<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
<A>(predicate: PredicateWithIndex<I, A>): <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
}
export function filterWithIndex<F extends URIS3, I, E>(
F: FilterableWithIndex3C<F, I, E>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
<A>(predicate: PredicateWithIndex<I, A>): <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, A>
}
export function filterWithIndex<F extends URIS2, I>(
F: FilterableWithIndex2<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
<A>(predicate: PredicateWithIndex<I, A>): <E>(fa: Kind2<F, E, A>) => Kind2<F, E, A>
}
export function filterWithIndex<F extends URIS2, E, I>(
F: FilterableWithIndex2C<F, I, E>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): (fa: Kind2<F, E, A>) => Kind2<F, E, B>
<A>(predicate: PredicateWithIndex<I, A>): (fa: Kind2<F, E, A>) => Kind2<F, E, A>
}
export function filterWithIndex<F extends URIS, I>(
F: FilterableWithIndex1<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): (fa: Kind<F, A>) => Kind<F, B>
<A>(predicate: PredicateWithIndex<I, A>): (fa: Kind<F, A>) => Kind<F, A>
}
export function filterWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): (fa: HKT<F, A>) => HKT<F, B>
<A>(predicate: PredicateWithIndex<I, A>): (fa: HKT<F, A>) => HKT<F, A>
}
export function filterWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): <A>(predicate: PredicateWithIndex<I, A>) => (fa: HKT<F, A>) => HKT<F, A> {
return (predicate) => (fa) => F.filterWithIndex(fa, predicate)
}
/**
* Returns a pipeable `filterMapWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function filterMapWithIndex<F extends URIS4, I>(
F: FilterableWithIndex4<F, I>
): <A, B>(f: (i: I, a: A) => Option<B>) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Kind4<F, S, R, E, B>
export function filterMapWithIndex<F extends URIS3, I>(
F: FilterableWithIndex3<F, I>
): <A, B>(f: (i: I, a: A) => Option<B>) => <R, E>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function filterMapWithIndex<F extends URIS3, I, E>(
F: FilterableWithIndex3C<F, I, E>
): <A, B>(f: (i: I, a: A) => Option<B>) => <R>(fa: Kind3<F, R, E, A>) => Kind3<F, R, E, B>
export function filterMapWithIndex<F extends URIS2, I>(
F: FilterableWithIndex2<F, I>
): <A, B>(f: (i: I, a: A) => Option<B>) => <E>(fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function filterMapWithIndex<F extends URIS2, I, E>(
F: FilterableWithIndex2C<F, I, E>
): <A, B>(f: (i: I, a: A) => Option<B>) => (fa: Kind2<F, E, A>) => Kind2<F, E, B>
export function filterMapWithIndex<F extends URIS, I>(
F: FilterableWithIndex1<F, I>
): <A, B>(f: (i: I, a: A) => Option<B>) => (fa: Kind<F, A>) => Kind<F, B>
export function filterMapWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): <A, B>(f: (i: I, a: A) => Option<B>) => (fa: HKT<F, A>) => HKT<F, B>
export function filterMapWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): <A, B>(f: (i: I, a: A) => Option<B>) => (fa: HKT<F, A>) => HKT<F, B> {
return (f) => (fa) => F.filterMapWithIndex(fa, f)
}
/**
* Returns a pipeable `partitionWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function partitionWithIndex<F extends URIS4, I>(
F: FilterableWithIndex4<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <S, R, E>(
fa: Kind4<F, S, R, E, A>
) => Separated<Kind4<F, S, R, E, A>, Kind4<F, S, R, E, B>>
<A>(predicate: PredicateWithIndex<I, A>): <S, R, E>(
fa: Kind4<F, S, R, E, A>
) => Separated<Kind4<F, S, R, E, A>, Kind4<F, S, R, E, A>>
}
export function partitionWithIndex<F extends URIS3, I>(
F: FilterableWithIndex3<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <R, E>(
fa: Kind3<F, R, E, A>
) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, B>>
<A>(predicate: PredicateWithIndex<I, A>): <R, E>(
fa: Kind3<F, R, E, A>
) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, A>>
}
export function partitionWithIndex<F extends URIS3, I, E>(
F: FilterableWithIndex3C<F, I, E>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <R>(
fa: Kind3<F, R, E, A>
) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, B>>
<A>(predicate: PredicateWithIndex<I, A>): <R>(
fa: Kind3<F, R, E, A>
) => Separated<Kind3<F, R, E, A>, Kind3<F, R, E, A>>
}
export function partitionWithIndex<F extends URIS2, I>(
F: FilterableWithIndex2<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): <E>(
fa: Kind2<F, E, A>
) => Separated<Kind2<F, E, A>, Kind2<F, E, B>>
<A>(predicate: PredicateWithIndex<I, A>): <E>(fa: Kind2<F, E, A>) => Separated<Kind2<F, E, A>, Kind2<F, E, A>>
}
export function partitionWithIndex<F extends URIS2, I, E>(
F: FilterableWithIndex2C<F, I, E>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): (
fa: Kind2<F, E, A>
) => Separated<Kind2<F, E, A>, Kind2<F, E, B>>
<A>(predicate: PredicateWithIndex<I, A>): (fa: Kind2<F, E, A>) => Separated<Kind2<F, E, A>, Kind2<F, E, A>>
}
export function partitionWithIndex<F extends URIS, I>(
F: FilterableWithIndex1<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): (fa: Kind<F, A>) => Separated<Kind<F, A>, Kind<F, B>>
<A>(predicate: PredicateWithIndex<I, A>): (fa: Kind<F, A>) => Separated<Kind<F, A>, Kind<F, A>>
}
export function partitionWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): {
<A, B extends A>(refinement: RefinementWithIndex<I, A, B>): (fa: HKT<F, A>) => Separated<HKT<F, A>, HKT<F, B>>
<A>(predicate: PredicateWithIndex<I, A>): (fa: HKT<F, A>) => Separated<HKT<F, A>, HKT<F, A>>
}
export function partitionWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): <A>(predicate: PredicateWithIndex<I, A>) => (fa: HKT<F, A>) => Separated<HKT<F, A>, HKT<F, A>> {
return (f) => (fa) => F.partitionWithIndex(fa, f)
}
/**
* Returns a pipeable `partitionMapWithIndex`
*
* @category pipeable helper
* @since 2.13.0
*/
export function partitionMapWithIndex<F extends URIS4, I>(
F: FilterableWithIndex4<F, I>
): <A, B, C>(
f: (i: I, a: A) => Either<B, C>
) => <S, R, E>(fa: Kind4<F, S, R, E, A>) => Separated<Kind4<F, S, R, E, B>, Kind4<F, S, R, E, C>>
export function partitionMapWithIndex<F extends URIS3, I>(
F: FilterableWithIndex3<F, I>
): <A, B, C>(
f: (i: I, a: A) => Either<B, C>
) => <R, E>(fa: Kind3<F, R, E, A>) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
export function partitionMapWithIndex<F extends URIS3, I, E>(
F: FilterableWithIndex3C<F, I, E>
): <A, B, C>(
f: (i: I, a: A) => Either<B, C>
) => <R>(fa: Kind3<F, R, E, A>) => Separated<Kind3<F, R, E, B>, Kind3<F, R, E, C>>
export function partitionMapWithIndex<F extends URIS2, I>(
F: FilterableWithIndex2<F, I>
): <A, B, C>(f: (i: I, a: A) => Either<B, C>) => <E>(fa: Kind2<F, E, A>) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
export function partitionMapWithIndex<F extends URIS2, I, E>(
F: FilterableWithIndex2C<F, I, E>
): <A, B, C>(f: (i: I, a: A) => Either<B, C>) => (fa: Kind2<F, E, A>) => Separated<Kind2<F, E, B>, Kind2<F, E, C>>
export function partitionMapWithIndex<F extends URIS, I>(
F: FilterableWithIndex1<F, I>
): <A, B, C>(f: (i: I, a: A) => Either<B, C>) => (fa: Kind<F, A>) => Separated<Kind<F, B>, Kind<F, C>>
export function partitionMapWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): <A, B, C>(f: (i: I, a: A) => Either<B, C>) => (fa: HKT<F, A>) => Separated<HKT<F, B>, HKT<F, C>>
export function partitionMapWithIndex<F, I>(
F: FilterableWithIndex<F, I>
): <A, B, C>(f: (i: I, a: A) => Either<B, C>) => (fa: HKT<F, A>) => Separated<HKT<F, B>, HKT<F, C>> {
return (f) => (fa) => F.partitionMapWithIndex(fa, f)
}
/**
* Returns a pipeable `promap`
*
* @category pipeable helper
* @since 2.13.0
*/
export function promap<F extends URIS4>(
F: Profunctor4<F>
): <E, A, D, B>(f: (d: D) => E, g: (a: A) => B) => <S, R>(fbc: Kind4<F, S, R, E, A>) => Kind4<F, S, R, D, B>
export function promap<F extends URIS3>(
F: Profunctor3<F>
): <E, A, D, B>(f: (d: D) => E, g: (a: A) => B) => <R>(fbc: Kind3<F, R, E, A>) => Kind3<F, R, D, B>
export function promap<F extends URIS3, E>(
F: Profunctor3C<F, E>
): <A, D, B>(f: (d: D) => E, g: (a: A) => B) => <R>(fbc: Kind3<F, R, E, A>) => Kind3<F, R, D, B>
export function promap<F extends URIS2>(
F: Profunctor2<F>
): <E, A, D, B>(f: (d: D) => E, g: (a: A) => B) => (fbc: Kind2<F, E, A>) => Kind2<F, D, B>
export function promap<F extends URIS2, E>(
F: Profunctor2C<F, E>
): <A, D, B>(f: (d: D) => E, g: (a: A) => B) => (fbc: Kind2<F, E, A>) => Kind2<F, D, B>
export function promap<F>(
F: Profunctor<F>
): <E, A, D, B>(f: (d: D) => E, g: (a: A) => B) => (fbc: HKT2<F, E, A>) => HKT2<F, D, B>
export function promap<F>(
F: Profunctor<F>
): <E, A, D, B>(f: (d: D) => E, g: (a: A) => B) => (fbc: HKT2<F, E, A>) => HKT2<F, D, B> {
return (f, g) => (fbc) => F.promap(fbc, f, g)
}
/**
* Returns a pipeable `compose`
*
* @category pipeable helper
* @since 2.13.0
*/
export function compose<F extends URIS4>(
F: Semigroupoid4<F>
): <S, R, E, A>(ea: Kind4<F, S, R, E, A>) => <B>(ab: Kind4<F, S, R, A, B>) => Kind4<F, S, R, E, B>
export function compose<F extends URIS3>(
F: Semigroupoid3<F>
): <R, E, A>(ea: Kind3<F, R, E, A>) => <B>(ab: Kind3<F, R, A, B>) => Kind3<F, R, E, B>
export function compose<F extends URIS3, E>(
F: Semigroupoid3C<F, E>
): <R, A>(ea: Kind3<F, R, E, A>) => <B>(ab: Kind3<F, R, A, B>) => Kind3<F, R, E, B>
export function compose<F extends URIS2>(
F: Semigroupoid2<F>
): <E, A>(ea: Kind2<F, E, A>) => <B>(ab: Kind2<F, A, B>) => Kind2<F, E, B>
export function compose<F extends URIS2, E>(
F: Semigroupoid2C<F, E>
): <A>(ea: Kind2<F, E, A>) => <B>(ab: Kind2<F, A, B>) => Kind2<F, E, B>
export function compose<F>(F: Semigroupoid<F>): <E, A>(ea: HKT2<F, E, A>) => <B>(ab: HKT2<F, A, B>) => HKT2<F, E, B>
export function compose<F>(F: Semigroupoid<F>): <E, A>(ea: HKT2<F, E, A>) => <B>(ab: HKT2<F, A, B>) => HKT2<F, E, B> {
return (ea) => (ab) => F.compose(ab, ea)
}
// -------------------------------------------------------------------------------------
// deprecated
// -------------------------------------------------------------------------------------
/**
* @category zone of death
* @since 2.0.0
* @deprecated
*/
export interface PipeableFunctor<F> {
readonly map: <A, B>(f: (a: A) => B) => (fa: HKT<F, A>) => HKT<F, B>
}
/**
* @category zone of death
* @since 2.0.0
* @deprecated
*/