@fncts/base 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_cjs/collection/Iterable/api/traverseConc.cjs +16 -21
- package/_cjs/collection/Iterable/api/traverseConc.cjs.map +1 -1
- package/_cjs/collection/compat/Record/instances.cjs +67 -16
- package/_cjs/collection/compat/Record/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/api.cjs +9 -12
- package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/definition.cjs +41 -43
- package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Dictionary/definition.cjs +2 -4
- package/_cjs/collection/immutable/Dictionary/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/api.cjs +26 -29
- package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/definition.cjs +15 -17
- package/_cjs/collection/immutable/HashMap/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +136 -153
- package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/definition.cjs +10 -12
- package/_cjs/collection/immutable/ImmutableArray/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs +11 -9
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs +21 -22
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs +3 -9
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs +8 -2
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/RoseTree/definition.cjs +13 -15
- package/_cjs/collection/immutable/RoseTree/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/api.cjs +8 -12
- package/_cjs/collection/immutable/Vector/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/definition.cjs +11 -13
- package/_cjs/collection/immutable/Vector/definition.cjs.map +1 -1
- package/_cjs/collection/weak/IterableWeakMap.cjs +51 -2
- package/_cjs/collection/weak/IterableWeakMap.cjs.map +1 -1
- package/_cjs/collection/weak/IterableWeakSet.cjs +59 -7
- package/_cjs/collection/weak/IterableWeakSet.cjs.map +1 -1
- package/_cjs/control/Eval/api.cjs +9 -3
- package/_cjs/control/Eval/api.cjs.map +1 -1
- package/_cjs/control/Eval/definition.cjs +0 -7
- package/_cjs/control/Eval/definition.cjs.map +1 -1
- package/_cjs/control/Eval/instance.cjs +6 -0
- package/_cjs/control/Eval/instance.cjs.map +1 -1
- package/_cjs/control/Z/api.cjs +16 -14
- package/_cjs/control/Z/api.cjs.map +1 -1
- package/_cjs/control/Z/definition.cjs +9 -14
- package/_cjs/control/Z/definition.cjs.map +1 -1
- package/_cjs/control/Z/instances.cjs +6 -0
- package/_cjs/control/Z/instances.cjs.map +1 -1
- package/_cjs/control/Z/runtime.cjs +15 -13
- package/_cjs/control/Z/runtime.cjs.map +1 -1
- package/_cjs/data/Const/definition.cjs +0 -7
- package/_cjs/data/Const/definition.cjs.map +1 -1
- package/_cjs/data/Const/instances.cjs +7 -5
- package/_cjs/data/Const/instances.cjs.map +1 -1
- package/_cjs/data/Datum/api.cjs +479 -0
- package/_cjs/data/Datum/api.cjs.map +1 -0
- package/_cjs/data/Datum/definition.cjs +142 -0
- package/_cjs/data/Datum/definition.cjs.map +1 -0
- package/_cjs/data/Datum/instances.cjs +69 -0
- package/_cjs/data/Datum/instances.cjs.map +1 -0
- package/_cjs/data/DatumEither/api.cjs +365 -0
- package/_cjs/data/DatumEither/api.cjs.map +1 -0
- package/_cjs/data/DatumEither/definition.cjs +9 -0
- package/_cjs/data/DatumEither/definition.cjs.map +1 -0
- package/_cjs/data/DecodeError/definition.cjs +3 -3
- package/_cjs/data/DecodeError/definition.cjs.map +1 -1
- package/_cjs/data/Decoder/definition.cjs +3 -10
- package/_cjs/data/Decoder/definition.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +21 -5
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Either/definition.cjs +3 -10
- package/_cjs/data/Either/definition.cjs.map +1 -1
- package/_cjs/data/Either/instances.cjs +25 -23
- package/_cjs/data/Either/instances.cjs.map +1 -1
- package/_cjs/data/EitherT/api.cjs +106 -0
- package/_cjs/data/EitherT/api.cjs.map +1 -0
- package/_cjs/data/EitherT/definition.cjs +9 -0
- package/_cjs/data/EitherT/definition.cjs.map +1 -0
- package/_cjs/data/Environment/api.cjs +15 -14
- package/_cjs/data/Environment/api.cjs.map +1 -1
- package/_cjs/data/Environment/definition.cjs.map +1 -1
- package/_cjs/data/Identity/api.cjs +3 -1
- package/_cjs/data/Identity/api.cjs.map +1 -1
- package/_cjs/data/Identity/definition.cjs +2 -4
- package/_cjs/data/Identity/definition.cjs.map +1 -1
- package/_cjs/data/Identity/instances.cjs +6 -0
- package/_cjs/data/Identity/instances.cjs.map +1 -1
- package/_cjs/data/Intervals.cjs +292 -0
- package/_cjs/data/Intervals.cjs.map +1 -0
- package/_cjs/data/Maybe/api.cjs +3 -1
- package/_cjs/data/Maybe/api.cjs.map +1 -1
- package/_cjs/data/Maybe/definition.cjs +11 -13
- package/_cjs/data/Maybe/definition.cjs.map +1 -1
- package/_cjs/data/Maybe/instances.cjs +13 -11
- package/_cjs/data/Maybe/instances.cjs.map +1 -1
- package/_cjs/data/Newtype.cjs +3 -5
- package/_cjs/data/Newtype.cjs.map +1 -1
- package/_cjs/data/Struct/definition.cjs +2 -4
- package/_cjs/data/Struct/definition.cjs.map +1 -1
- package/_cjs/data/Zipped.cjs +55 -0
- package/_cjs/data/Zipped.cjs.map +1 -0
- package/_cjs/data/function/api.cjs +10 -0
- package/_cjs/data/function/api.cjs.map +1 -1
- package/_cjs/data/object/instances.cjs +9 -1
- package/_cjs/data/object/instances.cjs.map +1 -1
- package/_cjs/optics/Optional/definition.cjs +4 -6
- package/_cjs/optics/Optional/definition.cjs.map +1 -1
- package/_cjs/optics/Traversal/api/compose.cjs +1 -1
- package/_cjs/optics/Traversal/api/compose.cjs.map +1 -1
- package/_cjs/optics/Traversal/api/fromTraversable.cjs +1 -1
- package/_cjs/optics/Traversal/api/fromTraversable.cjs.map +1 -1
- package/_cjs/optics/Traversal/definition.cjs +3 -3
- package/_cjs/optics/Traversal/definition.cjs.map +1 -1
- package/_cjs/typeclass/Alt.cjs +0 -7
- package/_cjs/typeclass/Alt.cjs.map +1 -1
- package/_cjs/typeclass/ApplicativeExcept.cjs +9 -35
- package/_cjs/typeclass/ApplicativeExcept.cjs.map +1 -1
- package/_cjs/typeclass/Apply.cjs +39 -66
- package/_cjs/typeclass/Apply.cjs.map +1 -1
- package/_cjs/typeclass/Chain.cjs +6 -28
- package/_cjs/typeclass/Chain.cjs.map +1 -1
- package/_cjs/typeclass/Fail.cjs +0 -10
- package/_cjs/typeclass/Fail.cjs.map +1 -1
- package/_cjs/typeclass/Filterable.cjs +0 -36
- package/_cjs/typeclass/Filterable.cjs.map +1 -1
- package/_cjs/typeclass/Foldable.cjs +4 -34
- package/_cjs/typeclass/Foldable.cjs.map +1 -1
- package/_cjs/typeclass/FoldableWithIndex.cjs +4 -34
- package/_cjs/typeclass/FoldableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Functor.cjs +3 -18
- package/_cjs/typeclass/Functor.cjs.map +1 -1
- package/_cjs/typeclass/Guard/definition.cjs +3 -10
- package/_cjs/typeclass/Guard/definition.cjs.map +1 -1
- package/_cjs/typeclass/MonadExcept.cjs +2 -10
- package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
- package/_cjs/typeclass/Nil.cjs +0 -10
- package/_cjs/typeclass/Nil.cjs.map +1 -1
- package/_cjs/typeclass/Pointed.cjs +0 -11
- package/_cjs/typeclass/Pointed.cjs.map +1 -1
- package/_cjs/typeclass/Semialign.cjs +18 -46
- package/_cjs/typeclass/Semialign.cjs.map +1 -1
- package/_cjs/typeclass/Semimonoidal.cjs +0 -11
- package/_cjs/typeclass/Semimonoidal.cjs.map +1 -1
- package/_cjs/typeclass/Showable/show.cjs +12 -12
- package/_cjs/typeclass/Showable/show.cjs.map +1 -1
- package/_cjs/typeclass/Traversable.cjs +7 -26
- package/_cjs/typeclass/Traversable.cjs.map +1 -1
- package/_cjs/typeclass/TraversableWithIndex.cjs +3 -7
- package/_cjs/typeclass/TraversableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Witherable.cjs +3 -45
- package/_cjs/typeclass/Witherable.cjs.map +1 -1
- package/_cjs/typeclass/WitherableWithIndex.cjs +8 -44
- package/_cjs/typeclass/WitherableWithIndex.cjs.map +1 -1
- package/_mjs/collection/Iterable/api/traverseConc.mjs +16 -21
- package/_mjs/collection/Iterable/api/traverseConc.mjs.map +1 -1
- package/_mjs/collection/compat/Record/instances.mjs +62 -16
- package/_mjs/collection/compat/Record/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api.mjs +7 -11
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/definition.mjs +41 -42
- package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Dictionary/definition.mjs +2 -3
- package/_mjs/collection/immutable/Dictionary/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/api.mjs +18 -20
- package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/definition.mjs +15 -16
- package/_mjs/collection/immutable/HashMap/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +128 -147
- package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/definition.mjs +10 -11
- package/_mjs/collection/immutable/ImmutableArray/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs +9 -8
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs +18 -19
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs +0 -2
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs +4 -3
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/RoseTree/definition.mjs +13 -14
- package/_mjs/collection/immutable/RoseTree/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/api.mjs +8 -12
- package/_mjs/collection/immutable/Vector/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/definition.mjs +11 -12
- package/_mjs/collection/immutable/Vector/definition.mjs.map +1 -1
- package/_mjs/collection/weak/IterableWeakMap.mjs +51 -2
- package/_mjs/collection/weak/IterableWeakMap.mjs.map +1 -1
- package/_mjs/collection/weak/IterableWeakSet.mjs +59 -7
- package/_mjs/collection/weak/IterableWeakSet.mjs.map +1 -1
- package/_mjs/control/Eval/api.mjs +9 -4
- package/_mjs/control/Eval/api.mjs.map +1 -1
- package/_mjs/control/Eval/definition.mjs +0 -1
- package/_mjs/control/Eval/definition.mjs.map +1 -1
- package/_mjs/control/Eval/instance.mjs +1 -0
- package/_mjs/control/Eval/instance.mjs.map +1 -1
- package/_mjs/control/Z/api.mjs +16 -15
- package/_mjs/control/Z/api.mjs.map +1 -1
- package/_mjs/control/Z/definition.mjs +4 -5
- package/_mjs/control/Z/definition.mjs.map +1 -1
- package/_mjs/control/Z/instances.mjs +1 -0
- package/_mjs/control/Z/instances.mjs.map +1 -1
- package/_mjs/control/Z/runtime.mjs +14 -13
- package/_mjs/control/Z/runtime.mjs.map +1 -1
- package/_mjs/data/Const/definition.mjs +0 -3
- package/_mjs/data/Const/definition.mjs.map +1 -1
- package/_mjs/data/Const/instances.mjs +6 -5
- package/_mjs/data/Const/instances.mjs.map +1 -1
- package/_mjs/data/Datum/api.mjs +403 -0
- package/_mjs/data/Datum/api.mjs.map +1 -0
- package/_mjs/data/Datum/definition.mjs +112 -0
- package/_mjs/data/Datum/definition.mjs.map +1 -0
- package/_mjs/data/Datum/instances.mjs +52 -0
- package/_mjs/data/Datum/instances.mjs.map +1 -0
- package/_mjs/data/DatumEither/api.mjs +290 -0
- package/_mjs/data/DatumEither/api.mjs.map +1 -0
- package/_mjs/data/DatumEither/definition.mjs +2 -0
- package/_mjs/data/DatumEither/definition.mjs.map +1 -0
- package/_mjs/data/DecodeError/definition.mjs +3 -3
- package/_mjs/data/DecodeError/definition.mjs.map +1 -1
- package/_mjs/data/Decoder/definition.mjs +0 -2
- package/_mjs/data/Decoder/definition.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +16 -3
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/definition.mjs +0 -2
- package/_mjs/data/Either/definition.mjs.map +1 -1
- package/_mjs/data/Either/instances.mjs +23 -22
- package/_mjs/data/Either/instances.mjs.map +1 -1
- package/_mjs/data/EitherT/api.mjs +73 -0
- package/_mjs/data/EitherT/api.mjs.map +1 -0
- package/_mjs/data/EitherT/definition.mjs +2 -0
- package/_mjs/data/EitherT/definition.mjs.map +1 -0
- package/_mjs/data/Environment/api.mjs +12 -13
- package/_mjs/data/Environment/api.mjs.map +1 -1
- package/_mjs/data/Environment/definition.mjs.map +1 -1
- package/_mjs/data/Identity/api.mjs +2 -1
- package/_mjs/data/Identity/api.mjs.map +1 -1
- package/_mjs/data/Identity/definition.mjs +2 -3
- package/_mjs/data/Identity/definition.mjs.map +1 -1
- package/_mjs/data/Identity/instances.mjs +1 -0
- package/_mjs/data/Identity/instances.mjs.map +1 -1
- package/_mjs/data/Intervals.mjs +257 -0
- package/_mjs/data/Intervals.mjs.map +1 -0
- package/_mjs/data/Maybe/api.mjs +2 -1
- package/_mjs/data/Maybe/api.mjs.map +1 -1
- package/_mjs/data/Maybe/definition.mjs +8 -10
- package/_mjs/data/Maybe/definition.mjs.map +1 -1
- package/_mjs/data/Maybe/instances.mjs +12 -11
- package/_mjs/data/Maybe/instances.mjs.map +1 -1
- package/_mjs/data/Newtype.mjs +3 -4
- package/_mjs/data/Newtype.mjs.map +1 -1
- package/_mjs/data/Struct/definition.mjs +2 -3
- package/_mjs/data/Struct/definition.mjs.map +1 -1
- package/_mjs/data/Zipped.mjs +37 -0
- package/_mjs/data/Zipped.mjs.map +1 -0
- package/_mjs/data/function/api.mjs +8 -0
- package/_mjs/data/function/api.mjs.map +1 -1
- package/_mjs/data/object/instances.mjs +7 -1
- package/_mjs/data/object/instances.mjs.map +1 -1
- package/_mjs/optics/Optional/definition.mjs +4 -5
- package/_mjs/optics/Optional/definition.mjs.map +1 -1
- package/_mjs/optics/Traversal/api/compose.mjs +1 -1
- package/_mjs/optics/Traversal/api/compose.mjs.map +1 -1
- package/_mjs/optics/Traversal/api/fromTraversable.mjs +1 -1
- package/_mjs/optics/Traversal/api/fromTraversable.mjs.map +1 -1
- package/_mjs/optics/Traversal/definition.mjs +3 -3
- package/_mjs/optics/Traversal/definition.mjs.map +1 -1
- package/_mjs/typeclass/Alt.mjs +0 -5
- package/_mjs/typeclass/Alt.mjs.map +1 -1
- package/_mjs/typeclass/ApplicativeExcept.mjs +7 -32
- package/_mjs/typeclass/ApplicativeExcept.mjs.map +1 -1
- package/_mjs/typeclass/Apply.mjs +35 -65
- package/_mjs/typeclass/Apply.mjs.map +1 -1
- package/_mjs/typeclass/Chain.mjs +4 -25
- package/_mjs/typeclass/Chain.mjs.map +1 -1
- package/_mjs/typeclass/Fail.mjs +1 -8
- package/_mjs/typeclass/Fail.mjs.map +1 -1
- package/_mjs/typeclass/Filterable.mjs +0 -28
- package/_mjs/typeclass/Filterable.mjs.map +1 -1
- package/_mjs/typeclass/Foldable.mjs +3 -30
- package/_mjs/typeclass/Foldable.mjs.map +1 -1
- package/_mjs/typeclass/FoldableWithIndex.mjs +3 -30
- package/_mjs/typeclass/FoldableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Functor.mjs +3 -16
- package/_mjs/typeclass/Functor.mjs.map +1 -1
- package/_mjs/typeclass/Guard/definition.mjs +0 -2
- package/_mjs/typeclass/Guard/definition.mjs.map +1 -1
- package/_mjs/typeclass/MonadExcept.mjs +2 -9
- package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
- package/_mjs/typeclass/Nil.mjs +1 -8
- package/_mjs/typeclass/Nil.mjs.map +1 -1
- package/_mjs/typeclass/Pointed.mjs +0 -9
- package/_mjs/typeclass/Pointed.mjs.map +1 -1
- package/_mjs/typeclass/Semialign.mjs +17 -45
- package/_mjs/typeclass/Semialign.mjs.map +1 -1
- package/_mjs/typeclass/Semimonoidal.mjs +0 -9
- package/_mjs/typeclass/Semimonoidal.mjs.map +1 -1
- package/_mjs/typeclass/Showable/show.mjs +12 -12
- package/_mjs/typeclass/Showable/show.mjs.map +1 -1
- package/_mjs/typeclass/Traversable.mjs +6 -25
- package/_mjs/typeclass/Traversable.mjs.map +1 -1
- package/_mjs/typeclass/TraversableWithIndex.mjs +2 -6
- package/_mjs/typeclass/TraversableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Witherable.mjs +3 -40
- package/_mjs/typeclass/Witherable.mjs.map +1 -1
- package/_mjs/typeclass/WitherableWithIndex.mjs +6 -41
- package/_mjs/typeclass/WitherableWithIndex.mjs.map +1 -1
- package/_src/collection/Iterable/api/traverseConc.ts +24 -21
- package/_src/collection/compat/Record/instances.ts +44 -0
- package/_src/collection/immutable/Conc/api.ts +9 -11
- package/_src/collection/immutable/Conc/definition.ts +9 -5
- package/_src/collection/immutable/Dictionary/definition.ts +1 -1
- package/_src/collection/immutable/HashMap/api.ts +20 -17
- package/_src/collection/immutable/HashMap/definition.ts +10 -6
- package/_src/collection/immutable/ImmutableArray/api.ts +56 -113
- package/_src/collection/immutable/ImmutableArray/definition.ts +8 -5
- package/_src/collection/immutable/ImmutableArray/instances.ts +42 -42
- package/_src/collection/immutable/ImmutableNonEmptyArray/api.ts +13 -11
- package/_src/collection/immutable/ImmutableNonEmptyArray/definition.ts +8 -3
- package/_src/collection/immutable/ImmutableNonEmptyArray/instances.ts +24 -25
- package/_src/collection/immutable/RoseTree/definition.ts +7 -4
- package/_src/collection/immutable/Vector/api.ts +12 -16
- package/_src/collection/immutable/Vector/definition.ts +9 -9
- package/_src/collection/weak/IterableWeakMap.ts +50 -5
- package/_src/collection/weak/IterableWeakSet.ts +57 -9
- package/_src/control/Eval/api.ts +5 -2
- package/_src/control/Eval/definition.ts +7 -4
- package/_src/control/Eval/instance.ts +7 -7
- package/_src/control/Z/api.ts +16 -25
- package/_src/control/Z/definition.ts +32 -31
- package/_src/control/Z/instances.ts +3 -3
- package/_src/control/Z/runtime.ts +7 -7
- package/_src/data/Const/definition.ts +9 -17
- package/_src/data/Const/instances.ts +5 -5
- package/_src/data/Datum/api.ts +376 -0
- package/_src/data/Datum/definition.ts +102 -0
- package/_src/data/Datum/instances.ts +34 -0
- package/_src/data/DatumEither/api.ts +348 -0
- package/_src/data/DatumEither/definition.ts +20 -0
- package/_src/data/DecodeError/definition.ts +3 -3
- package/_src/data/Decoder/definition.ts +7 -4
- package/_src/data/Either/api.ts +12 -2
- package/_src/data/Either/definition.ts +9 -14
- package/_src/data/Either/instances.ts +6 -6
- package/_src/data/EitherT/api.ts +239 -0
- package/_src/data/EitherT/definition.ts +23 -0
- package/_src/data/Environment/api.ts +8 -6
- package/_src/data/Environment/definition.ts +2 -2
- package/_src/data/Identity/api.ts +2 -2
- package/_src/data/Identity/definition.ts +2 -2
- package/_src/data/Identity/instances.ts +7 -7
- package/_src/data/Intervals.ts +126 -0
- package/_src/data/Maybe/api.ts +2 -2
- package/_src/data/Maybe/definition.ts +7 -4
- package/_src/data/Maybe/instances.ts +10 -10
- package/_src/data/Newtype.ts +32 -11
- package/_src/data/Struct/definition.ts +1 -1
- package/_src/data/Tag/definition.ts +2 -2
- package/_src/data/Zipped.ts +52 -0
- package/_src/data/function/api.ts +8 -0
- package/_src/data/object/instances.ts +11 -1
- package/_src/optics/Optional/definition.ts +2 -2
- package/_src/optics/Traversal/api/compose.ts +1 -1
- package/_src/optics/Traversal/api/fromTraversable.ts +11 -11
- package/_src/optics/Traversal/definition.ts +13 -12
- package/_src/typeclass/Align.ts +1 -1
- package/_src/typeclass/Alt.ts +24 -54
- package/_src/typeclass/Alternative.ts +1 -1
- package/_src/typeclass/Applicative.ts +6 -1
- package/_src/typeclass/ApplicativeExcept.ts +55 -81
- package/_src/typeclass/Apply.ts +224 -253
- package/_src/typeclass/Chain.ts +71 -98
- package/_src/typeclass/Fail.ts +10 -28
- package/_src/typeclass/Filterable.ts +13 -67
- package/_src/typeclass/FilterableWithIndex.ts +13 -13
- package/_src/typeclass/Foldable.ts +16 -35
- package/_src/typeclass/FoldableWithIndex.ts +14 -37
- package/_src/typeclass/Functor.ts +11 -21
- package/_src/typeclass/FunctorWithIndex.ts +4 -4
- package/_src/typeclass/Guard/definition.ts +1 -3
- package/_src/typeclass/Monad.ts +1 -1
- package/_src/typeclass/MonadExcept.ts +11 -7
- package/_src/typeclass/Nil.ts +10 -27
- package/_src/typeclass/Pointed.ts +11 -30
- package/_src/typeclass/Semialign.ts +285 -253
- package/_src/typeclass/Semimonoidal.ts +23 -54
- package/_src/typeclass/Showable/show.ts +8 -10
- package/_src/typeclass/Traversable.ts +45 -63
- package/_src/typeclass/TraversableWithIndex.ts +37 -34
- package/_src/typeclass/Witherable.ts +28 -115
- package/_src/typeclass/WitherableWithIndex.ts +82 -115
- package/_src/types/extractions.ts +1 -1
- package/collection/Iterable/api/traverseConc.d.ts +4 -6
- package/collection/compat/Record/instances.d.ts +12 -0
- package/collection/immutable/Conc/api.d.ts +4 -6
- package/collection/immutable/Conc/definition.d.ts +9 -6
- package/collection/immutable/Dictionary/definition.d.ts +1 -1
- package/collection/immutable/HashMap/api.d.ts +13 -13
- package/collection/immutable/HashMap/definition.d.ts +10 -7
- package/collection/immutable/ImmutableArray/api.d.ts +16 -18
- package/collection/immutable/ImmutableArray/definition.d.ts +8 -6
- package/collection/immutable/ImmutableArray/instances.d.ts +17 -17
- package/collection/immutable/ImmutableNonEmptyArray/api.d.ts +6 -5
- package/collection/immutable/ImmutableNonEmptyArray/definition.d.ts +7 -3
- package/collection/immutable/ImmutableNonEmptyArray/instances.d.ts +10 -10
- package/collection/immutable/RoseTree/definition.d.ts +7 -5
- package/collection/immutable/Vector/api.d.ts +4 -4
- package/collection/immutable/Vector/definition.d.ts +8 -9
- package/collection/weak/IterableWeakMap.d.ts +9 -3
- package/collection/weak/IterableWeakSet.d.ts +10 -4
- package/control/Eval/api.d.ts +6 -1
- package/control/Eval/definition.d.ts +6 -4
- package/control/Eval/instance.d.ts +3 -3
- package/control/Z/api.d.ts +8 -6
- package/control/Z/definition.d.ts +38 -32
- package/control/Z/instances.d.ts +2 -2
- package/control/Z/runtime.d.ts +5 -4
- package/data/Const/definition.d.ts +8 -16
- package/data/Const/instances.d.ts +4 -3
- package/data/Datum/api.d.ts +188 -0
- package/data/Datum/definition.d.ts +75 -0
- package/data/Datum/instances.d.ts +32 -0
- package/data/DatumEither/api.d.ts +169 -0
- package/data/DatumEither/definition.d.ts +21 -0
- package/data/Decoder/definition.d.ts +6 -4
- package/data/Either/api.d.ts +10 -0
- package/data/Either/definition.d.ts +8 -14
- package/data/Either/instances.d.ts +4 -3
- package/data/EitherT/api.d.ts +60 -0
- package/data/EitherT/definition.d.ts +12 -0
- package/data/Environment/api.d.ts +7 -5
- package/data/Environment/definition.d.ts +3 -3
- package/data/Identity/api.d.ts +2 -1
- package/data/Identity/definition.d.ts +2 -2
- package/data/Identity/instances.d.ts +3 -3
- package/data/Intervals.d.ts +53 -0
- package/data/Maybe/api.d.ts +2 -1
- package/data/Maybe/definition.d.ts +7 -4
- package/data/Maybe/instances.d.ts +6 -6
- package/data/Newtype.d.ts +9 -8
- package/data/Struct/definition.d.ts +1 -1
- package/data/Tag/definition.d.ts +2 -2
- package/data/Zipped.d.ts +24 -0
- package/data/function/api.d.ts +6 -0
- package/data/object/instances.d.ts +6 -1
- package/optics/Traversal/api/fromTraversable.d.ts +1 -1
- package/optics/Traversal/definition.d.ts +2 -4
- package/package.json +2 -2
- package/typeclass/Align.d.ts +1 -1
- package/typeclass/Alt.d.ts +2 -4
- package/typeclass/Alternative.d.ts +1 -1
- package/typeclass/Applicative.d.ts +2 -1
- package/typeclass/ApplicativeExcept.d.ts +5 -13
- package/typeclass/Apply.d.ts +20 -32
- package/typeclass/Chain.d.ts +5 -13
- package/typeclass/Fail.d.ts +2 -7
- package/typeclass/Filterable.d.ts +7 -31
- package/typeclass/FilterableWithIndex.d.ts +7 -7
- package/typeclass/Foldable.d.ts +6 -19
- package/typeclass/FoldableWithIndex.d.ts +6 -19
- package/typeclass/Functor.d.ts +4 -11
- package/typeclass/FunctorWithIndex.d.ts +2 -2
- package/typeclass/Guard/definition.d.ts +1 -4
- package/typeclass/Monad.d.ts +1 -1
- package/typeclass/MonadExcept.d.ts +3 -4
- package/typeclass/Nil.d.ts +2 -7
- package/typeclass/Pointed.d.ts +2 -7
- package/typeclass/Semialign.d.ts +26 -32
- package/typeclass/Semimonoidal.d.ts +3 -8
- package/typeclass/Traversable.d.ts +21 -12
- package/typeclass/TraversableWithIndex.d.ts +19 -6
- package/typeclass/Witherable.d.ts +5 -19
- package/typeclass/WitherableWithIndex.d.ts +33 -19
- package/types/extractions.d.ts +1 -1
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import type { DatumEitherF } from "@fncts/base/data/DatumEither/definition";
|
|
2
|
+
import type * as P from "@fncts/base/typeclass";
|
|
3
|
+
|
|
4
|
+
import * as _ from "@fncts/base/data/Datum/api";
|
|
5
|
+
import { DatumTag } from "@fncts/base/data/Datum/definition";
|
|
6
|
+
import { EitherTag } from "@fncts/base/data/Either";
|
|
7
|
+
|
|
8
|
+
import { EitherT } from "../EitherT/definition.js";
|
|
9
|
+
|
|
10
|
+
const _Initial: DatumEither<never, never> = Datum.initial();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus static fncts.DatumEitherOps initial
|
|
14
|
+
*/
|
|
15
|
+
export function initial<E = never, A = never>(): DatumEither<E, A> {
|
|
16
|
+
return _Initial;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const _Pending: DatumEither<never, never> = Datum.pending();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @tsplus static fncts.DatumEitherOps pending
|
|
23
|
+
*/
|
|
24
|
+
export function pending<E = never, A = never>(): DatumEither<E, A> {
|
|
25
|
+
return _Pending;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @tsplus static fncts.DatumEitherOps refreshLeft
|
|
30
|
+
*/
|
|
31
|
+
export function refreshLeft<E, A = never>(e: E): DatumEither<E, A> {
|
|
32
|
+
return Datum.refresh(Either.left(e));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @tsplus static fncts.DatumEitherOps refreshRight
|
|
37
|
+
*/
|
|
38
|
+
export function refreshRight<E = never, A = never>(a: A): DatumEither<E, A> {
|
|
39
|
+
return Datum.replete(Either.right(a));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @tsplus static fncts.DatumEitherOps repleteLeft
|
|
44
|
+
*/
|
|
45
|
+
export function repleteLeft<E, A = never>(e: E): DatumEither<E, A> {
|
|
46
|
+
return Datum.replete(Either.left(e));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @tsplus static fncts.DatumEitherOps repleteRight
|
|
51
|
+
*/
|
|
52
|
+
export function repleteRight<E = never, A = never>(a: A): DatumEither<E, A> {
|
|
53
|
+
return Datum.replete(Either.right(a));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @tsplus fluent fncts.DatumEither bimap
|
|
58
|
+
*/
|
|
59
|
+
export const bimap: <E, A, E1, B>(self: DatumEither<E, A>, f: (e: E) => E1, g: (a: A) => B) => DatumEither<E1, B> =
|
|
60
|
+
EitherT.bimap(Datum.Functor);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @tsplus fluent fncts.DatumEither exists
|
|
64
|
+
*/
|
|
65
|
+
export function exists<E, A, B extends A>(self: DatumEither<E, A>, p: Refinement<A, B>): self is DatumEither<E, B>;
|
|
66
|
+
export function exists<E, A>(self: DatumEither<E, A>, p: Predicate<A>): boolean;
|
|
67
|
+
export function exists<E, A>(self: DatumEither<E, A>, p: Predicate<A>): boolean {
|
|
68
|
+
return self.match3(
|
|
69
|
+
() => false,
|
|
70
|
+
() => false,
|
|
71
|
+
p,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @tsplus fluent fncts.DatumEither filter
|
|
77
|
+
*/
|
|
78
|
+
export function filter<E, A, B extends A>(self: DatumEither<E, A>, p: Refinement<A, B>): DatumEither<E, B>;
|
|
79
|
+
export function filter<E, A>(self: DatumEither<E, A>, p: Predicate<A>): DatumEither<E, A>;
|
|
80
|
+
export function filter<E, A>(self: DatumEither<E, A>, p: Predicate<A>): DatumEither<E, A> {
|
|
81
|
+
return self.matchAll({
|
|
82
|
+
Initial: () => self,
|
|
83
|
+
Pending: () => self,
|
|
84
|
+
RefreshLeft: () => self,
|
|
85
|
+
RefreshRight: (a) => (p(a) ? self : DatumEither.initial()),
|
|
86
|
+
RepleteLeft: () => self,
|
|
87
|
+
RepleteRight: (a) => (p(a) ? self : DatumEither.initial()),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @tsplus fluent fncts.DatumEither filterMap
|
|
93
|
+
*/
|
|
94
|
+
export function filterMap<E, A, B>(self: DatumEither<E, A>, f: (a: A) => Maybe<B>): DatumEither<E, B> {
|
|
95
|
+
return self.matchAll({
|
|
96
|
+
Initial: () => self.unsafeCoerce(),
|
|
97
|
+
Pending: () => self.unsafeCoerce(),
|
|
98
|
+
RefreshLeft: () => self.unsafeCoerce(),
|
|
99
|
+
RefreshRight: (a) =>
|
|
100
|
+
f(a).match(
|
|
101
|
+
() => DatumEither.initial(),
|
|
102
|
+
(b) => DatumEither.refreshRight(b),
|
|
103
|
+
),
|
|
104
|
+
RepleteLeft: () => self.unsafeCoerce(),
|
|
105
|
+
RepleteRight: (a) =>
|
|
106
|
+
f(a).match(
|
|
107
|
+
() => DatumEither.initial(),
|
|
108
|
+
(b) => DatumEither.repleteRight(b),
|
|
109
|
+
),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @tsplus fluent fncts.DatumEither flatMap
|
|
115
|
+
*/
|
|
116
|
+
export const flatMap: <E, A, E1, B>(
|
|
117
|
+
self: DatumEither<E, A>,
|
|
118
|
+
f: (a: A) => DatumEither<E1, B>,
|
|
119
|
+
) => DatumEither<E | E1, B> = EitherT.flatMap(Datum.Monad);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @tsplus fluent fncts.DatumEither foldLeft
|
|
123
|
+
*/
|
|
124
|
+
export function foldLeft<E, A, B>(self: DatumEither<E, A>, b: B, f: (b: B, a: A) => B): B {
|
|
125
|
+
return self.match3(
|
|
126
|
+
() => b,
|
|
127
|
+
() => b,
|
|
128
|
+
(a) => f(b, a),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @tsplus fluent fncts.DatumEither foldMap
|
|
134
|
+
*/
|
|
135
|
+
export function foldMap<E, A, M>(self: DatumEither<E, A>, f: (a: A) => M, /** @tsplus auto */ M: P.Monoid<M>): M {
|
|
136
|
+
return self.match3(
|
|
137
|
+
() => M.nat,
|
|
138
|
+
() => M.nat,
|
|
139
|
+
f,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @tsplus fluent fncts.DatumEither foldRight
|
|
145
|
+
*/
|
|
146
|
+
export function foldRight<E, A, B>(self: DatumEither<E, A>, b: B, f: (a: A, b: B) => B): B {
|
|
147
|
+
return self.match3(
|
|
148
|
+
() => b,
|
|
149
|
+
() => b,
|
|
150
|
+
(a) => f(a, b),
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @tsplus fluent fncts.DatumEither getOrElse
|
|
156
|
+
*/
|
|
157
|
+
export function getOrElse<E, A, B, C>(self: DatumEither<E, A>, onEmpty: () => B, onLeft: (e: E) => C): A | B | C {
|
|
158
|
+
return self.match3(onEmpty, onLeft, Function.identity);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @tsplus fluent fncts.DatumEither map
|
|
163
|
+
*/
|
|
164
|
+
export const map: <E, A, B>(self: DatumEither<E, A>, f: (a: A) => B) => DatumEither<E, B> = EitherT.map(Datum.Functor);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @tsplus fluent fncts.DatumEither mapLeft
|
|
168
|
+
*/
|
|
169
|
+
export const mapLeft: <E, A, E1>(self: DatumEither<E, A>, f: (e: E) => E1) => DatumEither<E1, A> = EitherT.mapLeft(
|
|
170
|
+
Datum.Functor,
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @tsplus fluent fncts.DatumEither match
|
|
175
|
+
*/
|
|
176
|
+
export function match<E, A, B, C, D, F>(
|
|
177
|
+
self: DatumEither<E, A>,
|
|
178
|
+
onInitial: () => B,
|
|
179
|
+
onPending: () => C,
|
|
180
|
+
onLeft: (e: E, isLoading: boolean) => D,
|
|
181
|
+
onRight: (a: A, isLoading: boolean) => F,
|
|
182
|
+
): B | C | D | F {
|
|
183
|
+
return self.matchAll({
|
|
184
|
+
Initial: onInitial,
|
|
185
|
+
Pending: onPending,
|
|
186
|
+
RefreshLeft: (e) => onLeft(e, true),
|
|
187
|
+
RefreshRight: (a) => onRight(a, true),
|
|
188
|
+
RepleteLeft: (e) => onLeft(e, false),
|
|
189
|
+
RepleteRight: (a) => onRight(a, false),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @tsplus fluent fncts.DatumEither match3
|
|
195
|
+
*/
|
|
196
|
+
export function match3<E, A, B, C, D>(
|
|
197
|
+
self: DatumEither<E, A>,
|
|
198
|
+
onEmpty: (loading: boolean) => B,
|
|
199
|
+
onLeft: (e: E, loading: boolean) => C,
|
|
200
|
+
onRight: (a: A, loading: boolean) => D,
|
|
201
|
+
): B | C | D {
|
|
202
|
+
return self.matchAll({
|
|
203
|
+
Initial: () => onEmpty(false),
|
|
204
|
+
Pending: () => onEmpty(true),
|
|
205
|
+
RefreshLeft: (e) => onLeft(e, true),
|
|
206
|
+
RefreshRight: (a) => onRight(a, true),
|
|
207
|
+
RepleteLeft: (e) => onLeft(e, false),
|
|
208
|
+
RepleteRight: (a) => onRight(a, false),
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @tsplus fluent fncts.DatumEither matchAll
|
|
214
|
+
*/
|
|
215
|
+
export function matchAll<E, A, B, C, D, F, G, H>(
|
|
216
|
+
self: DatumEither<E, A>,
|
|
217
|
+
cases: {
|
|
218
|
+
Initial: () => B;
|
|
219
|
+
Pending: () => C;
|
|
220
|
+
RefreshLeft: (e: E) => D;
|
|
221
|
+
RefreshRight: (a: A) => F;
|
|
222
|
+
RepleteLeft: (e: E) => G;
|
|
223
|
+
RepleteRight: (a: A) => H;
|
|
224
|
+
},
|
|
225
|
+
): B | C | D | F | G | H {
|
|
226
|
+
switch (self._tag) {
|
|
227
|
+
case DatumTag.Initial:
|
|
228
|
+
return cases.Initial();
|
|
229
|
+
case DatumTag.Pending:
|
|
230
|
+
return cases.Pending();
|
|
231
|
+
case DatumTag.Refresh:
|
|
232
|
+
Either.concrete(self.value);
|
|
233
|
+
switch (self.value._tag) {
|
|
234
|
+
case EitherTag.Left:
|
|
235
|
+
return cases.RefreshLeft(self.value.left);
|
|
236
|
+
case EitherTag.Right:
|
|
237
|
+
return cases.RefreshRight(self.value.right);
|
|
238
|
+
}
|
|
239
|
+
case DatumTag.Replete:
|
|
240
|
+
Either.concrete(self.value);
|
|
241
|
+
switch (self.value._tag) {
|
|
242
|
+
case EitherTag.Left:
|
|
243
|
+
return cases.RepleteLeft(self.value.left);
|
|
244
|
+
case EitherTag.Right:
|
|
245
|
+
return cases.RepleteRight(self.value.right);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @tsplus fluent fncts.DatumEither matchEither
|
|
252
|
+
*/
|
|
253
|
+
export const matchEither: <E, A, B, C, D, F>(
|
|
254
|
+
self: DatumEither<E, A>,
|
|
255
|
+
cases: {
|
|
256
|
+
Initial: () => B;
|
|
257
|
+
Pending: () => C;
|
|
258
|
+
Refresh: (value: Either<E, A>) => D;
|
|
259
|
+
Replete: (value: Either<E, A>) => F;
|
|
260
|
+
},
|
|
261
|
+
) => B | C | D | F = _.match;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @tsplus fluent fncts.DatumEither orElse
|
|
265
|
+
*/
|
|
266
|
+
export const orElse: <E, A, E1, B>(
|
|
267
|
+
self: DatumEither<E, A>,
|
|
268
|
+
that: Lazy<DatumEither<E1, B>>,
|
|
269
|
+
) => DatumEither<E | E1, A | B> = EitherT.orElse(Datum.Monad);
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @tsplus fluent fncts.DatumEither partition
|
|
273
|
+
*/
|
|
274
|
+
export function partition<E, A, B extends A>(
|
|
275
|
+
self: DatumEither<E, A>,
|
|
276
|
+
p: Refinement<A, B>,
|
|
277
|
+
): [DatumEither<E, A>, DatumEither<E, B>];
|
|
278
|
+
export function partition<E, A>(self: DatumEither<E, A>, p: Predicate<A>): [DatumEither<E, A>, DatumEither<E, A>];
|
|
279
|
+
export function partition<E, A>(self: DatumEither<E, A>, p: Predicate<A>): [DatumEither<E, A>, DatumEither<E, A>] {
|
|
280
|
+
return [self.filter(p.invert), self.filter(p)];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @tsplus fluent fncts.DatumEither partitionMap
|
|
285
|
+
*/
|
|
286
|
+
export function partitionMap<E, A, B, C>(
|
|
287
|
+
self: DatumEither<E, A>,
|
|
288
|
+
f: (a: A) => Either<B, C>,
|
|
289
|
+
): [DatumEither<E, B>, DatumEither<E, C>] {
|
|
290
|
+
return self.matchAll({
|
|
291
|
+
Initial: () => [self.unsafeCoerce(), self.unsafeCoerce()],
|
|
292
|
+
Pending: () => [self.unsafeCoerce(), self.unsafeCoerce()],
|
|
293
|
+
RefreshLeft: () => [self.unsafeCoerce(), self.unsafeCoerce()],
|
|
294
|
+
RefreshRight: (a) =>
|
|
295
|
+
f(a).match(
|
|
296
|
+
(b) => [DatumEither.refreshRight(b), DatumEither.initial()],
|
|
297
|
+
(c) => [DatumEither.initial(), DatumEither.refreshRight(c)],
|
|
298
|
+
),
|
|
299
|
+
RepleteLeft: () => [self.unsafeCoerce(), self.unsafeCoerce()],
|
|
300
|
+
RepleteRight: (a) =>
|
|
301
|
+
f(a).match(
|
|
302
|
+
(b) => [DatumEither.repleteRight(b), DatumEither.initial()],
|
|
303
|
+
(c) => [DatumEither.initial(), DatumEither.repleteRight(c)],
|
|
304
|
+
),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @tsplus getter fncts.DatumEither toPending
|
|
310
|
+
*/
|
|
311
|
+
export const toPending: <E, A>(self: DatumEither<E, A>) => DatumEither<E, A> = _.toPending;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @tsplus getter fncts.DatumEither toReplete
|
|
315
|
+
*/
|
|
316
|
+
export const toReplete: <E, A>(self: DatumEither<E, A>) => DatumEither<E, A> = _.toReplete;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @tsplus fluent fncts.DatumEither traverse
|
|
320
|
+
*/
|
|
321
|
+
export const traverse: P.Traversable<DatumEitherF>["traverse"] = (self) => (G) => (f) =>
|
|
322
|
+
self.matchAll({
|
|
323
|
+
Initial: () => G.pure(self.unsafeCoerce()),
|
|
324
|
+
Pending: () => G.pure(self.unsafeCoerce()),
|
|
325
|
+
RefreshLeft: () => G.pure(self.unsafeCoerce()),
|
|
326
|
+
RefreshRight: (a) => G.map(f(a), (b) => DatumEither.refreshRight(b)),
|
|
327
|
+
RepleteLeft: () => G.pure(self.unsafeCoerce()),
|
|
328
|
+
RepleteRight: (a) => G.map(f(a), (b) => DatumEither.repleteRight(b)),
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @tsplus fluent fncts.DatumEither zipWith
|
|
333
|
+
*/
|
|
334
|
+
export const zipWith: <E, A, E1, B, C>(
|
|
335
|
+
self: DatumEither<E, A>,
|
|
336
|
+
that: DatumEither<E1, B>,
|
|
337
|
+
f: (a: A, b: B) => C,
|
|
338
|
+
) => DatumEither<E | E1, C> = EitherT.zipWith(Datum.Apply);
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* @tsplus fluent fncts.DatumEither zip
|
|
342
|
+
*/
|
|
343
|
+
export function zip<E, A, E1, B>(
|
|
344
|
+
self: DatumEither<E, A>,
|
|
345
|
+
that: DatumEither<E1, B>,
|
|
346
|
+
): DatumEither<E | E1, Zipped.Make<A, B>> {
|
|
347
|
+
return self.zipWith(that, (a, b) => Zipped(a, b));
|
|
348
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface DatumEitherF extends HKT {
|
|
2
|
+
type: DatumEither<this["E"], this["A"]>;
|
|
3
|
+
variance: {
|
|
4
|
+
E: "+";
|
|
5
|
+
A: "+";
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus type fncts.DatumEither
|
|
11
|
+
* @tsplus no-inherit fncts.Datum
|
|
12
|
+
*/
|
|
13
|
+
export type DatumEither<E, A> = Datum<Either<E, A>>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @tsplus type fncts.DatumEitherOps
|
|
17
|
+
*/
|
|
18
|
+
export interface DatumEitherOps {}
|
|
19
|
+
|
|
20
|
+
export const DatumEither: DatumEitherOps = {};
|
|
@@ -72,7 +72,7 @@ export class CompoundError<E extends DecodeError> extends DecodeError {
|
|
|
72
72
|
}
|
|
73
73
|
render = Eval.defer(
|
|
74
74
|
this.errors
|
|
75
|
-
.traverse((error) => error.render)
|
|
75
|
+
.traverse(Eval.Applicative)((error) => error.render)
|
|
76
76
|
.map((errors) =>
|
|
77
77
|
RoseTree(
|
|
78
78
|
`${this.errors.length} error(s) found while decoding ${startsWithVowel(this.name) ? "an" : "a"} ${this.name}`,
|
|
@@ -89,7 +89,7 @@ export class CompositionError<E extends DecodeError> extends DecodeError {
|
|
|
89
89
|
}
|
|
90
90
|
render = Eval.defer(
|
|
91
91
|
this.errors
|
|
92
|
-
.traverse((error) => error.render)
|
|
92
|
+
.traverse(Eval.Applicative)((error) => error.render)
|
|
93
93
|
.map((errors) =>
|
|
94
94
|
errors.length === 1
|
|
95
95
|
? errors.unsafeGet(1)!
|
|
@@ -221,7 +221,7 @@ export class UnionError extends DecodeError {
|
|
|
221
221
|
}
|
|
222
222
|
render = Eval.defer(
|
|
223
223
|
this.errors
|
|
224
|
-
.traverse((error) => error.render)
|
|
224
|
+
.traverse(Eval.Applicative)((error) => error.render)
|
|
225
225
|
.map((errors) => RoseTree(`${this.errors.length} error(s) found while decoding ${this.label}`, errors)),
|
|
226
226
|
);
|
|
227
227
|
}
|
|
@@ -3,7 +3,12 @@ import type { DecodeError } from "@fncts/base/data/DecodeError";
|
|
|
3
3
|
export const DecoderTypeId = Symbol.for("fncts.Decoder");
|
|
4
4
|
export type DecoderTypeId = typeof DecoderTypeId;
|
|
5
5
|
|
|
6
|
-
export interface DecoderF extends
|
|
6
|
+
export interface DecoderF extends HKT {
|
|
7
|
+
type: Decoder<this["A"]>;
|
|
8
|
+
variance: {
|
|
9
|
+
A: "+";
|
|
10
|
+
};
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* @tsplus type fncts.Decoder
|
|
@@ -11,9 +16,7 @@ export interface DecoderF extends Decoder<any> {}
|
|
|
11
16
|
*/
|
|
12
17
|
export class Decoder<A> {
|
|
13
18
|
readonly _typeId: DecoderTypeId = DecoderTypeId;
|
|
14
|
-
readonly
|
|
15
|
-
readonly [HKT.A]!: () => A;
|
|
16
|
-
readonly [HKT.T]!: Decoder<HKT._A<this>>;
|
|
19
|
+
readonly _A!: () => A;
|
|
17
20
|
constructor(readonly decode: (input: unknown) => These<DecodeError, A>, readonly label: string) {}
|
|
18
21
|
}
|
|
19
22
|
|
package/_src/data/Either/api.ts
CHANGED
|
@@ -179,12 +179,15 @@ export function swap<E, A>(self: Either<E, A>): Either<A, E> {
|
|
|
179
179
|
/**
|
|
180
180
|
* @tsplus fluent fncts.Either traverse
|
|
181
181
|
*/
|
|
182
|
-
export const traverse_: P.Traversable<EitherF>["traverse"] = (self
|
|
182
|
+
export const traverse_: P.Traversable<EitherF>["traverse"] = (self) => (A) => (f) =>
|
|
183
183
|
self.match(
|
|
184
184
|
(e) => A.pure(Left(e)),
|
|
185
|
-
(a) => f(a)
|
|
185
|
+
(a) => A.map(f(a), (b) => Right(b)),
|
|
186
186
|
);
|
|
187
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @tsplus fluent fncts.Either zipWith
|
|
190
|
+
*/
|
|
188
191
|
export function zipWith_<E1, A, E2, B, C>(
|
|
189
192
|
self: Either<E1, A>,
|
|
190
193
|
fb: Either<E2, B>,
|
|
@@ -195,6 +198,13 @@ export function zipWith_<E1, A, E2, B, C>(
|
|
|
195
198
|
return self._tag === EitherTag.Left ? self : fb._tag === EitherTag.Left ? fb : Right(f(self.right, fb.right));
|
|
196
199
|
}
|
|
197
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @tsplus fluent fncts.Either zip
|
|
203
|
+
*/
|
|
204
|
+
export function zip<E, A, E1, B>(self: Either<E, A>, that: Either<E1, B>): Either<E | E1, Zipped.Make<A, B>> {
|
|
205
|
+
return self.zipWith(that, (a, b) => Zipped(a, b));
|
|
206
|
+
}
|
|
207
|
+
|
|
198
208
|
/**
|
|
199
209
|
* @tsplus fluent fncts.Either filterMap
|
|
200
210
|
*/
|
|
@@ -6,8 +6,13 @@ export const enum EitherTag {
|
|
|
6
6
|
export const EitherTypeId = Symbol.for("fncts.base.data.Either");
|
|
7
7
|
export type EitherTypeId = typeof EitherTypeId;
|
|
8
8
|
|
|
9
|
-
export interface EitherF extends
|
|
10
|
-
|
|
9
|
+
export interface EitherF extends HKT {
|
|
10
|
+
type: Either<this["E"], this["A"]>;
|
|
11
|
+
variance: {
|
|
12
|
+
E: "+";
|
|
13
|
+
A: "+";
|
|
14
|
+
};
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* @tsplus type fncts.Either
|
|
@@ -15,18 +20,8 @@ export interface Either1F<E> extends Either1<E, any> {}
|
|
|
15
20
|
*/
|
|
16
21
|
export class Either<E, A> {
|
|
17
22
|
readonly _typeId: EitherTypeId = EitherTypeId;
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly [HKT.A]!: () => A;
|
|
21
|
-
readonly [HKT.T]!: Either<HKT._E<this>, HKT._A<this>>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface Either1<E, A> {
|
|
25
|
-
readonly _typeId: EitherTypeId;
|
|
26
|
-
readonly [HKT.F]: EitherF;
|
|
27
|
-
readonly [HKT.E]: () => E;
|
|
28
|
-
readonly [HKT.A]: () => A;
|
|
29
|
-
readonly [HKT.T]: Either<E, HKT._A<this>>;
|
|
23
|
+
readonly _E!: () => E;
|
|
24
|
+
readonly _A!: () => A;
|
|
30
25
|
}
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EitherF } from "@fncts/base/data/Either/definition.js";
|
|
2
2
|
|
|
3
3
|
import { map_ } from "@fncts/base/data/Either/api";
|
|
4
4
|
import { concrete, Either, EitherTag, Right } from "@fncts/base/data/Either/definition";
|
|
@@ -9,9 +9,9 @@ import * as P from "../../typeclass.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* @tsplus implicit
|
|
11
11
|
*/
|
|
12
|
-
export const Functor
|
|
12
|
+
export const Functor = HKT.instance<P.Functor<EitherF>>({
|
|
13
13
|
map: map_,
|
|
14
|
-
};
|
|
14
|
+
});
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @tsplus static fncts.EitherOps getEq
|
|
@@ -47,8 +47,8 @@ export function deriveEq<A extends Either<any, any>>(
|
|
|
47
47
|
/**
|
|
48
48
|
* @tsplus static fncts.EitherOps getFilterable
|
|
49
49
|
*/
|
|
50
|
-
export function getFilerable<E>(/** @tsplus auto */ ME: P.Monoid<E>): P.Filterable<
|
|
51
|
-
return <P.Filterable<
|
|
50
|
+
export function getFilerable<E>(/** @tsplus auto */ ME: P.Monoid<E>): P.Filterable<EitherF, HKT.Fix<"E", E>> {
|
|
51
|
+
return HKT.instance<P.Filterable<EitherF, HKT.Fix<"E", E>>>({
|
|
52
52
|
...Functor,
|
|
53
53
|
partitionMap: (fa, f) => {
|
|
54
54
|
concrete(fa);
|
|
@@ -90,7 +90,7 @@ export function getFilerable<E>(/** @tsplus auto */ ME: P.Monoid<E>): P.Filterab
|
|
|
90
90
|
}
|
|
91
91
|
return p(fa.right) ? [Either.left(ME.nat), fa] : [fa, Either.left(ME.nat)];
|
|
92
92
|
},
|
|
93
|
-
};
|
|
93
|
+
});
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|