@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable prefer-const */
|
|
2
2
|
import type { MutableVector, VectorF } from "@fncts/base/collection/immutable/Vector/definition";
|
|
3
|
-
import type { Eq, Monoid, Ord, Ordering, Traversable
|
|
3
|
+
import type { Eq, Monoid, Ord, Ordering, Traversable } from "@fncts/base/typeclass";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
affixPush,
|
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
updateNode,
|
|
49
49
|
zeroOffset,
|
|
50
50
|
} from "@fncts/base/collection/immutable/Vector/internal";
|
|
51
|
+
import { TraversableWithIndex } from "@fncts/base/typeclass";
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* Appends an element to the end of a Vector and returns the new Vector.
|
|
@@ -1201,27 +1202,22 @@ export function toList<A>(self: Vector<A>): List<A> {
|
|
|
1201
1202
|
}
|
|
1202
1203
|
|
|
1203
1204
|
/**
|
|
1204
|
-
* @tsplus
|
|
1205
|
+
* @tsplus getter fncts.Vector traverseWithIndex
|
|
1205
1206
|
*/
|
|
1206
|
-
export const traverseWithIndex
|
|
1207
|
+
export const traverseWithIndex = TraversableWithIndex.makeTraverseWithIndex<VectorF>()(() => (self) => (G) => (f) => {
|
|
1207
1208
|
return self.foldLeftWithIndex(G.pure(Vector.emptyPushable()), (i, b, a) =>
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
return v;
|
|
1213
|
-
},
|
|
1214
|
-
G,
|
|
1215
|
-
),
|
|
1209
|
+
G.zipWith(b, f(i, a), (v, b) => {
|
|
1210
|
+
push(v, b);
|
|
1211
|
+
return v;
|
|
1212
|
+
}),
|
|
1216
1213
|
);
|
|
1217
|
-
};
|
|
1214
|
+
});
|
|
1218
1215
|
|
|
1219
1216
|
/**
|
|
1220
|
-
* @tsplus
|
|
1217
|
+
* @tsplus getter fncts.Vector traverse
|
|
1221
1218
|
*/
|
|
1222
|
-
export const traverse: Traversable<VectorF>["traverse"] = (self
|
|
1223
|
-
|
|
1224
|
-
};
|
|
1219
|
+
export const traverse: Traversable<VectorF>["traverse"] = (self) => (G) => (f) =>
|
|
1220
|
+
self.traverseWithIndex(G)((_, a) => f(a));
|
|
1225
1221
|
|
|
1226
1222
|
/**
|
|
1227
1223
|
* Returns a new Vector without repeated elements by using the given
|
|
@@ -8,7 +8,13 @@ import { ForwardVectorIterator } from "@fncts/base/collection/immutable/Vector/i
|
|
|
8
8
|
export const VectorTypeId = Symbol.for("fncts.Vector");
|
|
9
9
|
export type VectorTypeId = typeof VectorTypeId;
|
|
10
10
|
|
|
11
|
-
export interface VectorF extends
|
|
11
|
+
export interface VectorF extends HKT {
|
|
12
|
+
type: Vector<this["A"]>;
|
|
13
|
+
variance: {
|
|
14
|
+
A: "+";
|
|
15
|
+
};
|
|
16
|
+
index: number;
|
|
17
|
+
}
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* Represents a Vector of elements.
|
|
@@ -18,10 +24,7 @@ export interface VectorF extends Vector<any> {}
|
|
|
18
24
|
*/
|
|
19
25
|
export class Vector<A> implements Iterable<A> {
|
|
20
26
|
readonly _typeId: VectorTypeId = VectorTypeId;
|
|
21
|
-
readonly
|
|
22
|
-
readonly [HKT.A]!: () => A;
|
|
23
|
-
readonly [HKT.T]!: Vector<HKT._A<this>>;
|
|
24
|
-
readonly [HKT.Ix]!: number;
|
|
27
|
+
readonly _A!: () => A;
|
|
25
28
|
constructor(
|
|
26
29
|
/** @private */
|
|
27
30
|
readonly bits: number,
|
|
@@ -54,10 +57,7 @@ export class Vector<A> implements Iterable<A> {
|
|
|
54
57
|
*/
|
|
55
58
|
export interface MutableVector<A> {
|
|
56
59
|
readonly _typeId: VectorTypeId;
|
|
57
|
-
readonly
|
|
58
|
-
readonly [HKT.A]: () => A;
|
|
59
|
-
readonly [HKT.T]: Vector<HKT._A<this>>;
|
|
60
|
-
readonly [HKT.Ix]: number;
|
|
60
|
+
readonly _A: () => A;
|
|
61
61
|
bits: number;
|
|
62
62
|
offset: number;
|
|
63
63
|
length: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @tsplus type fncts.IterableWeakMap
|
|
3
3
|
*/
|
|
4
|
-
export class IterableWeakMap<K extends object, V> implements Iterable<readonly [K, V]> {
|
|
4
|
+
export class IterableWeakMap<K extends object, V> implements Iterable<readonly [K, V]>, Map<K, V> {
|
|
5
5
|
private weakMap = new WeakMap<K, { value: V; ref: WeakRef<K> }>();
|
|
6
6
|
private refSet = new Set<WeakRef<K>>();
|
|
7
7
|
private finalizationGroup = new FinalizationRegistry<{ ref: WeakRef<K>; set: Set<WeakRef<K>> }>(
|
|
@@ -44,11 +44,48 @@ export class IterableWeakMap<K extends object, V> implements Iterable<readonly [
|
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
has(this: this, key: K): boolean {
|
|
48
|
+
return this.weakMap.has(key);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
clear(): void {
|
|
52
|
+
for (const ref of this.refSet) {
|
|
53
|
+
const key = ref.deref();
|
|
54
|
+
if (!key) continue;
|
|
55
|
+
const entry = this.weakMap.get(key)!;
|
|
56
|
+
this.weakMap.delete(key);
|
|
57
|
+
this.refSet.delete(entry.ref);
|
|
58
|
+
this.finalizationGroup.unregister(entry.ref);
|
|
59
|
+
}
|
|
60
|
+
this.refSet.clear();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: IterableWeakMap<K, V>): void {
|
|
64
|
+
thisArg = thisArg ?? this;
|
|
65
|
+
for (const kv of this) {
|
|
66
|
+
callbackfn(kv[1], kv[0], thisArg);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get size(): number {
|
|
71
|
+
let n = 0;
|
|
72
|
+
for (const ref of this.refSet) {
|
|
73
|
+
const key = ref.deref();
|
|
74
|
+
if (!key) continue;
|
|
75
|
+
n++;
|
|
76
|
+
}
|
|
77
|
+
return n;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[Symbol.iterator](this: this): IterableIterator<[K, V]> {
|
|
48
81
|
return this.entries();
|
|
49
82
|
}
|
|
50
83
|
|
|
51
|
-
|
|
84
|
+
get [Symbol.toStringTag](): string {
|
|
85
|
+
return this.weakMap[Symbol.toStringTag];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
*entries(this: this): IterableIterator<[K, V]> {
|
|
52
89
|
for (const ref of this.refSet) {
|
|
53
90
|
const key = ref.deref();
|
|
54
91
|
if (!key) continue;
|
|
@@ -57,7 +94,15 @@ export class IterableWeakMap<K extends object, V> implements Iterable<readonly [
|
|
|
57
94
|
}
|
|
58
95
|
}
|
|
59
96
|
|
|
60
|
-
|
|
61
|
-
|
|
97
|
+
*keys(this: this): IterableIterator<K> {
|
|
98
|
+
for (const [key] of this) {
|
|
99
|
+
yield key;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
*values(): IterableIterator<V> {
|
|
104
|
+
for (const [, value] of this) {
|
|
105
|
+
yield value;
|
|
106
|
+
}
|
|
62
107
|
}
|
|
63
108
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @tsplus type fncts.IterableWeakSet
|
|
3
3
|
*/
|
|
4
|
-
export class IterableWeakSet<A extends object> implements Iterable<A> {
|
|
4
|
+
export class IterableWeakSet<A extends object> implements Iterable<A>, Set<A> {
|
|
5
5
|
private weakMap = new WeakMap<A, { ref: WeakRef<A> }>();
|
|
6
6
|
private refSet = new Set<WeakRef<A>>();
|
|
7
7
|
private finalizationGroup = new FinalizationRegistry<{ ref: WeakRef<A>; set: Set<WeakRef<A>> }>(
|
|
@@ -12,9 +12,11 @@ export class IterableWeakSet<A extends object> implements Iterable<A> {
|
|
|
12
12
|
set.delete(ref);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
constructor(iterable
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
constructor(iterable?: Iterable<A>) {
|
|
16
|
+
if (iterable) {
|
|
17
|
+
for (const value of iterable) {
|
|
18
|
+
this.add(value);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -35,14 +37,52 @@ export class IterableWeakSet<A extends object> implements Iterable<A> {
|
|
|
35
37
|
|
|
36
38
|
this.weakMap.delete(value);
|
|
37
39
|
this.refSet.delete(entry.ref);
|
|
40
|
+
this.finalizationGroup.unregister(entry.ref);
|
|
38
41
|
return true;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
return this.
|
|
44
|
+
has(this: this, value: A): boolean {
|
|
45
|
+
return this.weakMap.has(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
keys(): IterableIterator<A> {
|
|
49
|
+
return this[Symbol.iterator]();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
values(): IterableIterator<A> {
|
|
53
|
+
return this[Symbol.iterator]();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
forEach(f: (value: A, value2: A, set: Set<A>) => void, thisArg?: Set<A>): void {
|
|
57
|
+
thisArg = thisArg ?? this;
|
|
58
|
+
for (const value of this) {
|
|
59
|
+
f(value, value, thisArg);
|
|
60
|
+
}
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
clear(): void {
|
|
64
|
+
for (const ref of this.refSet) {
|
|
65
|
+
const key = ref.deref();
|
|
66
|
+
if (!key) continue;
|
|
67
|
+
const entry = this.weakMap.get(key)!;
|
|
68
|
+
this.weakMap.delete(key);
|
|
69
|
+
this.refSet.delete(entry.ref);
|
|
70
|
+
this.finalizationGroup.unregister(entry.ref);
|
|
71
|
+
}
|
|
72
|
+
this.refSet.clear();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get size(): number {
|
|
76
|
+
let n = 0;
|
|
77
|
+
for (const ref of this.refSet) {
|
|
78
|
+
const value = ref.deref();
|
|
79
|
+
if (!value) continue;
|
|
80
|
+
n++;
|
|
81
|
+
}
|
|
82
|
+
return n;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
*[Symbol.iterator](this: this): IterableIterator<A> {
|
|
46
86
|
for (const ref of this.refSet) {
|
|
47
87
|
const key = ref.deref();
|
|
48
88
|
if (!key) continue;
|
|
@@ -50,7 +90,15 @@ export class IterableWeakSet<A extends object> implements Iterable<A> {
|
|
|
50
90
|
}
|
|
51
91
|
}
|
|
52
92
|
|
|
53
|
-
|
|
54
|
-
return this.
|
|
93
|
+
get [Symbol.toStringTag]() {
|
|
94
|
+
return this.refSet[Symbol.toStringTag];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
*entries(this: this): IterableIterator<[A, A]> {
|
|
98
|
+
for (const ref of this.refSet) {
|
|
99
|
+
const key = ref.deref();
|
|
100
|
+
if (!key) continue;
|
|
101
|
+
yield [key, key];
|
|
102
|
+
}
|
|
55
103
|
}
|
|
56
104
|
}
|
package/_src/control/Eval/api.ts
CHANGED
|
@@ -38,8 +38,11 @@ export function zipWith_<A, B, C>(self: Eval<A>, fb: Eval<B>, f: (a: A, b: B) =>
|
|
|
38
38
|
return self.flatMap((a) => fb.map((b) => f(a, b)));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* @tsplus fluent fncts.control.Eval zip
|
|
43
|
+
*/
|
|
44
|
+
export function zip_<A, B>(self: Eval<A>, fb: Eval<B>): Eval<Zipped.Make<A, B>> {
|
|
45
|
+
return self.zipWith(fb, (a, b) => Zipped(a, b));
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
export const EvalTypeId = Symbol.for("@fncts.base/control/Eval");
|
|
2
2
|
export type EvalTypeId = typeof EvalTypeId;
|
|
3
3
|
|
|
4
|
-
export interface EvalF extends
|
|
4
|
+
export interface EvalF extends HKT {
|
|
5
|
+
type: Eval<this["A"]>;
|
|
6
|
+
variance: {
|
|
7
|
+
A: "+";
|
|
8
|
+
};
|
|
9
|
+
}
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* @tsplus type fncts.control.Eval
|
|
8
13
|
*/
|
|
9
14
|
export interface Eval<A> {
|
|
10
15
|
readonly _typeId: EvalTypeId;
|
|
11
|
-
|
|
12
|
-
[HKT.A]?: () => A;
|
|
13
|
-
[HKT.T]?: Eval<HKT._A<this>>;
|
|
16
|
+
readonly _A: () => A;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { EvalF } from "@fncts/base/control/Eval/definition";
|
|
2
2
|
import type * as P from "@fncts/base/typeclass";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { map_, zip_, zipWith_ } from "@fncts/base/control/Eval/api";
|
|
5
5
|
import { now } from "@fncts/base/control/Eval/constructors";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @tsplus static fncts.control.EvalOps Functor
|
|
9
9
|
* @tsplus implicit
|
|
10
10
|
*/
|
|
11
|
-
export const Functor
|
|
11
|
+
export const Functor = HKT.instance<P.Functor<EvalF>>({
|
|
12
12
|
map: map_,
|
|
13
|
-
};
|
|
13
|
+
});
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @tsplus static fncts.control.EvalOps Apply
|
|
17
17
|
* @tsplus implicit
|
|
18
18
|
*/
|
|
19
|
-
export const Apply
|
|
19
|
+
export const Apply = HKT.instance<P.Apply<EvalF>>({
|
|
20
20
|
map: map_,
|
|
21
21
|
zip: zip_,
|
|
22
22
|
zipWith: zipWith_,
|
|
23
|
-
};
|
|
23
|
+
});
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @tsplus static fncts.control.EvalOps Applicative
|
|
27
27
|
* @tsplus implicit
|
|
28
28
|
*/
|
|
29
|
-
export const Applicative
|
|
29
|
+
export const Applicative = HKT.instance<P.Applicative<EvalF>>({
|
|
30
30
|
...Apply,
|
|
31
31
|
pure: now,
|
|
32
|
-
};
|
|
32
|
+
});
|
package/_src/control/Z/api.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { identity, tuple } from "../../data/function.js";
|
|
2
|
-
import {
|
|
3
|
-
Chain,
|
|
4
|
-
Defer,
|
|
5
|
-
Environment,
|
|
6
|
-
Fail,
|
|
7
|
-
MapLog,
|
|
8
|
-
Match,
|
|
9
|
-
Modify,
|
|
10
|
-
Provide,
|
|
11
|
-
Succeed,
|
|
12
|
-
SucceedNow,
|
|
13
|
-
Tell,
|
|
14
|
-
} from "./definition.js";
|
|
2
|
+
import { Access, Chain, Defer, Fail, MapLog, Match, Modify, Provide, Succeed, SucceedNow, Tell } from "./definition.js";
|
|
15
3
|
|
|
16
4
|
/**
|
|
17
5
|
* @tsplus getter fncts.control.Z absolve
|
|
@@ -101,9 +89,9 @@ export function flatMap_<W, S1, S2, R, E, A, W1, S3, R1, E1, B>(
|
|
|
101
89
|
*/
|
|
102
90
|
export function contramapEnvironment_<R0, W, S1, S2, R, E, A>(
|
|
103
91
|
ma: Z<W, S1, S2, R, E, A>,
|
|
104
|
-
f: (r0: R0) => R
|
|
92
|
+
f: (r0: Environment<R0>) => Environment<R>,
|
|
105
93
|
): Z<W, S1, S2, R0, E, A> {
|
|
106
|
-
return Z.environmentWithZ((r
|
|
94
|
+
return Z.environmentWithZ((r) => ma.provideEnvironment(f(r)));
|
|
107
95
|
}
|
|
108
96
|
|
|
109
97
|
/**
|
|
@@ -164,24 +152,24 @@ export function either<W, S1, S2, R, E, A>(fa: Z<W, S1, S2, R, E, A>): Z<W, S1,
|
|
|
164
152
|
/**
|
|
165
153
|
* @tsplus static fncts.control.ZOps environment
|
|
166
154
|
*/
|
|
167
|
-
export function environment<R>(): Z<never, unknown, never, R, never, R
|
|
168
|
-
return new
|
|
155
|
+
export function environment<R>(): Z<never, unknown, never, R, never, Environment<R>> {
|
|
156
|
+
return new Access((r) => Z.succeedNow(r));
|
|
169
157
|
}
|
|
170
158
|
|
|
171
159
|
/**
|
|
172
160
|
* @tsplus static fncts.control.ZOps environmentWith
|
|
173
161
|
*/
|
|
174
|
-
export function environmentWith<R0, A>(f: (r: R0) => A): Z<never, unknown, never, R0, never, A> {
|
|
175
|
-
return new
|
|
162
|
+
export function environmentWith<R0, A>(f: (r: Environment<R0>) => A): Z<never, unknown, never, R0, never, A> {
|
|
163
|
+
return new Access((r) => succeed(f(r)));
|
|
176
164
|
}
|
|
177
165
|
|
|
178
166
|
/**
|
|
179
167
|
* @tsplus static fncts.control.ZOps environmentWithZ
|
|
180
168
|
*/
|
|
181
169
|
export function environmentWithZ<R0, W, S1, S2, R, E, A>(
|
|
182
|
-
f: (r: R0) => Z<W, S1, S2, R, E, A>,
|
|
183
|
-
): Z<W, S1, S2, R
|
|
184
|
-
return new
|
|
170
|
+
f: (r: Environment<R0>) => Z<W, S1, S2, R, E, A>,
|
|
171
|
+
): Z<W, S1, S2, R | R0, E, A> {
|
|
172
|
+
return new Access(f);
|
|
185
173
|
}
|
|
186
174
|
|
|
187
175
|
/**
|
|
@@ -454,7 +442,10 @@ export function orElseEither_<W, S1, S2, R, E, A, S3, S4, R1, E1, A1>(
|
|
|
454
442
|
/**
|
|
455
443
|
* @tsplus fluent fncts.control.Z provideEnvironment
|
|
456
444
|
*/
|
|
457
|
-
export function provideEnvironment_<W, S1, S2, R, E, A>(
|
|
445
|
+
export function provideEnvironment_<W, S1, S2, R, E, A>(
|
|
446
|
+
fa: Z<W, S1, S2, R, E, A>,
|
|
447
|
+
r: Environment<R>,
|
|
448
|
+
): Z<W, S1, S2, never, E, A> {
|
|
458
449
|
return new Provide(fa, r);
|
|
459
450
|
}
|
|
460
451
|
|
|
@@ -583,8 +574,8 @@ export function writeAll_<W, S1, S2, R, E, A, W1>(
|
|
|
583
574
|
export function zip_<W, S1, S2, R, E, A, W1, S3, Q, D, B>(
|
|
584
575
|
fa: Z<W, S1, S2, R, E, A>,
|
|
585
576
|
fb: Z<W1, S2, S3, Q, D, B>,
|
|
586
|
-
): Z<W | W1, S1, S3, Q & R, D | E,
|
|
587
|
-
return fa.zipWith(fb,
|
|
577
|
+
): Z<W | W1, S1, S3, Q & R, D | E, Zipped.Make<A, B>> {
|
|
578
|
+
return fa.zipWith(fb, (a, b) => Zipped(a, b));
|
|
588
579
|
}
|
|
589
580
|
|
|
590
581
|
/**
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { hasTypeId } from "../../util/predicates.js";
|
|
2
2
|
|
|
3
|
-
export interface ZF extends
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export interface ZF extends HKT {
|
|
4
|
+
type: Z<this["W"], this["S"], this["S"], this["R"], this["E"], this["A"]>;
|
|
5
|
+
variance: {
|
|
6
|
+
W: "+";
|
|
7
|
+
S: "_";
|
|
8
|
+
R: "-";
|
|
9
|
+
E: "+";
|
|
10
|
+
A: "+";
|
|
11
|
+
};
|
|
12
|
+
}
|
|
6
13
|
|
|
7
14
|
export const ZTypeId = Symbol.for("@principia/base/Z");
|
|
8
15
|
export type ZTypeId = typeof ZTypeId;
|
|
@@ -22,26 +29,12 @@ export type ZTypeId = typeof ZTypeId;
|
|
|
22
29
|
*/
|
|
23
30
|
export abstract class Z<W, S1, S2, R, E, A> {
|
|
24
31
|
readonly _typeId: ZTypeId = ZTypeId;
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly [HKT.A]!: () => A;
|
|
32
|
-
readonly [HKT.T]!: Z<HKT._W<this>, HKT._Q<this>, HKT._S<this>, HKT._R<this>, HKT._E<this>, HKT._A<this>>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ZFixed<W, S, R, E, A> {
|
|
36
|
-
readonly _typeId: ZTypeId;
|
|
37
|
-
readonly [HKT.F]: ZF;
|
|
38
|
-
readonly [HKT.W]: () => W;
|
|
39
|
-
readonly [HKT.Q]: (_: S) => void;
|
|
40
|
-
readonly [HKT.S]: () => S;
|
|
41
|
-
readonly [HKT.R]: (_: R) => void;
|
|
42
|
-
readonly [HKT.E]: () => E;
|
|
43
|
-
readonly [HKT.A]: () => A;
|
|
44
|
-
readonly [HKT.T]: Z<HKT._W<this>, HKT._S<this>, HKT._S<this>, HKT._R<this>, HKT._E<this>, HKT._A<this>>;
|
|
32
|
+
readonly _W!: () => W;
|
|
33
|
+
readonly _S1!: (_: S1) => void;
|
|
34
|
+
readonly _S2!: () => S2;
|
|
35
|
+
readonly _R!: (_: R) => void;
|
|
36
|
+
readonly _E!: () => E;
|
|
37
|
+
readonly _A!: () => A;
|
|
45
38
|
}
|
|
46
39
|
|
|
47
40
|
/**
|
|
@@ -49,7 +42,14 @@ export interface ZFixed<W, S, R, E, A> {
|
|
|
49
42
|
*/
|
|
50
43
|
export function unifyZ<X extends Z<any, any, any, any, any, any>>(
|
|
51
44
|
_: X,
|
|
52
|
-
): Z<
|
|
45
|
+
): Z<
|
|
46
|
+
[X] extends [Z<infer W, any, any, any, any, any>] ? W : never,
|
|
47
|
+
[X] extends [Z<any, infer S1, any, any, any, any>] ? S1 : never,
|
|
48
|
+
[X] extends [Z<any, any, infer S2, any, any, any>] ? S2 : never,
|
|
49
|
+
[X] extends [Z<any, any, any, infer R, any, any>] ? R : never,
|
|
50
|
+
[X] extends [Z<any, any, any, any, infer E, any>] ? E : never,
|
|
51
|
+
[X] extends [Z<any, any, any, any, any, infer A>] ? A : never
|
|
52
|
+
> {
|
|
53
53
|
return _;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -68,7 +68,7 @@ export const enum ZTag {
|
|
|
68
68
|
Modify = "Modify",
|
|
69
69
|
Chain = "Chain",
|
|
70
70
|
Match = "Match",
|
|
71
|
-
|
|
71
|
+
Access = "Access",
|
|
72
72
|
Provide = "Provide",
|
|
73
73
|
Tell = "Tell",
|
|
74
74
|
Listen = "Listen",
|
|
@@ -135,16 +135,16 @@ export class Match<W, S1, S2, S5, R, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C>
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
export class
|
|
139
|
-
readonly _tag = ZTag.
|
|
140
|
-
constructor(readonly asks: (r: R0) => Z<W, S1, S2, R, E, A>) {
|
|
138
|
+
export class Access<W, R0, S1, S2, R, E, A> extends Z<W, S1, S2, R0 | R, E, A> {
|
|
139
|
+
readonly _tag = ZTag.Access;
|
|
140
|
+
constructor(readonly asks: (r: Environment<R0>) => Z<W, S1, S2, R, E, A>) {
|
|
141
141
|
super();
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
export class Provide<W, S1, S2, R, E, A> extends Z<W, S1, S2,
|
|
145
|
+
export class Provide<W, S1, S2, R, E, A> extends Z<W, S1, S2, never, E, A> {
|
|
146
146
|
readonly _tag = ZTag.Provide;
|
|
147
|
-
constructor(readonly ma: Z<W, S1, S2, R, E, A>, readonly env: R) {
|
|
147
|
+
constructor(readonly ma: Z<W, S1, S2, R, E, A>, readonly env: Environment<R>) {
|
|
148
148
|
super();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -169,7 +169,7 @@ export type Concrete =
|
|
|
169
169
|
| Modify<any, any, any>
|
|
170
170
|
| Chain<any, any, any, any, any, any, any, any, any, any, any>
|
|
171
171
|
| Match<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>
|
|
172
|
-
|
|
|
172
|
+
| Access<any, any, any, any, any, any, any>
|
|
173
173
|
| Provide<any, any, any, any, any, any>
|
|
174
174
|
| Defer<any, any, any, any, any, any>
|
|
175
175
|
| Succeed<any>
|
|
@@ -179,6 +179,7 @@ export type Concrete =
|
|
|
179
179
|
/**
|
|
180
180
|
* @tsplus static fncts.control.ZOps concrete
|
|
181
181
|
*/
|
|
182
|
+
// @ts-expect-error
|
|
182
183
|
export function concrete(_: Z<any, any, any, any, any, any>): asserts _ is Concrete {
|
|
183
184
|
//
|
|
184
185
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as P from "../../typeclass.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ZF } from "./definition.js";
|
|
3
3
|
|
|
4
4
|
import { map_, succeedNow, zip_, zipWith_ } from "./api.js";
|
|
5
5
|
|
|
@@ -7,9 +7,9 @@ import { map_, succeedNow, zip_, zipWith_ } from "./api.js";
|
|
|
7
7
|
* @tsplus static fncts.control.ZOps Applicative
|
|
8
8
|
* @tsplus implicit
|
|
9
9
|
*/
|
|
10
|
-
export const Applicative
|
|
10
|
+
export const Applicative = HKT.instance<P.Applicative<ZF>>({
|
|
11
11
|
map: map_,
|
|
12
12
|
zip: zip_,
|
|
13
13
|
zipWith: zipWith_,
|
|
14
14
|
pure: succeedNow,
|
|
15
|
-
};
|
|
15
|
+
});
|
|
@@ -24,13 +24,13 @@ type Frame = MatchFrame | ApplyFrame;
|
|
|
24
24
|
* @tsplus fluent fncts.control.Z unsafeRunAll
|
|
25
25
|
*/
|
|
26
26
|
export function unsafeRunAll_<W, S1, S2, E, A>(
|
|
27
|
-
ma: Z<W, S1, S2,
|
|
27
|
+
ma: Z<W, S1, S2, never, E, A>,
|
|
28
28
|
s: S1,
|
|
29
29
|
): readonly [Conc<W>, Exit<E, readonly [S2, A]>] {
|
|
30
30
|
const stack: Stack<Frame> = Stack();
|
|
31
31
|
let s0 = s as any;
|
|
32
32
|
let result: any = null;
|
|
33
|
-
const environment = Stack<unknown
|
|
33
|
+
const environment = Stack<Environment<unknown>>();
|
|
34
34
|
let failed = false;
|
|
35
35
|
let current = ma as Z<any, any, any, any, any, any> | undefined;
|
|
36
36
|
let log = Conc.empty<W>();
|
|
@@ -141,8 +141,8 @@ export function unsafeRunAll_<W, S1, S2, E, A>(
|
|
|
141
141
|
);
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
|
-
case ZTag.
|
|
145
|
-
current = currZ.asks(environment.peek() ??
|
|
144
|
+
case ZTag.Access: {
|
|
145
|
+
current = currZ.asks(environment.peek() ?? Environment());
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
148
|
case ZTag.Provide: {
|
|
@@ -215,7 +215,7 @@ export function unsafeRunAll_<W, S1, S2, E, A>(
|
|
|
215
215
|
*
|
|
216
216
|
* @tsplus fluent fncts.control.Z unsafeRun
|
|
217
217
|
*/
|
|
218
|
-
export function unsafeRun_<W, S1, S2, A>(ma: Z<W, S1, S2,
|
|
218
|
+
export function unsafeRun_<W, S1, S2, A>(ma: Z<W, S1, S2, never, never, A>, s: S1): readonly [S2, A] {
|
|
219
219
|
return ma.unsafeRunAll(s)[1].match((cause) => {
|
|
220
220
|
// throw cause.squash
|
|
221
221
|
throw new Error();
|
|
@@ -227,7 +227,7 @@ export function unsafeRun_<W, S1, S2, A>(ma: Z<W, S1, S2, unknown, never, A>, s:
|
|
|
227
227
|
*
|
|
228
228
|
* @tsplus getter fncts.control.Z unsafeRunResult
|
|
229
229
|
*/
|
|
230
|
-
export function unsafeRunResult<W, A>(ma: Z<W, unknown, unknown,
|
|
230
|
+
export function unsafeRunResult<W, A>(ma: Z<W, unknown, unknown, never, never, A>): A {
|
|
231
231
|
return unsafeRun_(ma, {})[1];
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -236,7 +236,7 @@ export function unsafeRunResult<W, A>(ma: Z<W, unknown, unknown, unknown, never,
|
|
|
236
236
|
*
|
|
237
237
|
* @tsplus fluent fncts.control.Z unsafeRunReader
|
|
238
238
|
*/
|
|
239
|
-
export function unsafeRunReader_<W, R, A>(ma: Z<W, unknown, never, R, never, A>, r: R): A {
|
|
239
|
+
export function unsafeRunReader_<W, R, A>(ma: Z<W, unknown, never, R, never, A>, r: Environment<R>): A {
|
|
240
240
|
return unsafeRunResult(ma.provideEnvironment(r));
|
|
241
241
|
}
|
|
242
242
|
|
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @tsplus type fncts.ConstF
|
|
3
3
|
*/
|
|
4
|
-
export interface ConstF extends
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export interface ConstF extends HKT {
|
|
5
|
+
type: Const<this["E"], this["A"]>;
|
|
6
|
+
variance: {
|
|
7
|
+
E: "_";
|
|
8
|
+
A: "+";
|
|
9
|
+
};
|
|
10
|
+
}
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @tsplus type fncts.Const
|
|
13
14
|
* @tsplus companion fncts.ConstOps
|
|
14
15
|
*/
|
|
15
16
|
export class Const<E, A> {
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly [HKT.A]!: () => A;
|
|
19
|
-
readonly [HKT.T]!: Const<HKT._E<this>, HKT._A<this>>;
|
|
17
|
+
readonly _E!: () => E;
|
|
18
|
+
readonly _A!: () => A;
|
|
20
19
|
constructor(readonly getConst: E) {}
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
export interface Const1<E, A> {
|
|
24
|
-
readonly [HKT.F]: ConstF;
|
|
25
|
-
readonly [HKT.E]: () => E;
|
|
26
|
-
readonly [HKT.A]: () => A;
|
|
27
|
-
readonly [HKT.T]: Const<E, HKT._A<this>>;
|
|
28
|
-
}
|