@fncts/base 0.0.1 → 0.0.4
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 +21 -15
- package/_cjs/collection/Iterable/api/traverseConc.cjs.map +1 -1
- package/_cjs/collection/Iterable/api.cjs +23 -37
- package/_cjs/collection/Iterable/api.cjs.map +1 -1
- package/_cjs/collection/Iterable.cjs +3 -3
- package/_cjs/collection/compat/Array/api.cjs +1 -1
- package/_cjs/collection/compat/Array/api.cjs.map +1 -1
- package/_cjs/collection/compat/Array.cjs +2 -2
- package/_cjs/collection/immutable/Conc/api.cjs +41 -53
- package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/constructors.cjs +1 -1
- package/_cjs/collection/immutable/Conc/definition.cjs +49 -39
- package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc.cjs +6 -6
- package/_cjs/collection/immutable/Dictionary/definition.cjs +4 -2
- package/_cjs/collection/immutable/Dictionary/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/api.cjs +35 -108
- package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/definition.cjs +19 -15
- package/_cjs/collection/immutable/HashMap/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap.cjs +2 -2
- package/_cjs/collection/immutable/HashSet/api.cjs +10 -10
- package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashSet.cjs +2 -2
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +153 -248
- package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/definition.cjs +12 -10
- package/_cjs/collection/immutable/ImmutableArray/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs +153 -157
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray.cjs +4 -4
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs +118 -181
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs +3 -0
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs +45 -81
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray.cjs +5 -5
- package/_cjs/collection/immutable/List/api.cjs +4 -7
- package/_cjs/collection/immutable/List/api.cjs.map +1 -1
- package/_cjs/collection/immutable/List/constructors.cjs +1 -1
- package/_cjs/collection/immutable/List.cjs +5 -5
- package/_cjs/collection/immutable/Queue.cjs +4 -4
- package/_cjs/collection/immutable/RoseTree/api.cjs +485 -0
- package/_cjs/collection/immutable/RoseTree/api.cjs.map +1 -0
- package/_cjs/collection/immutable/RoseTree/definition.cjs +58 -0
- package/_cjs/collection/immutable/RoseTree/definition.cjs.map +1 -0
- package/_cjs/collection/immutable/RoseTree.cjs +32 -0
- package/_cjs/collection/immutable/RoseTree.cjs.map +1 -0
- package/_cjs/collection/immutable/SortedMap/api.cjs +65 -65
- package/_cjs/collection/immutable/SortedMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/SortedMap.cjs +5 -5
- package/_cjs/collection/immutable/Vector/api.cjs +70 -15
- package/_cjs/collection/immutable/Vector/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/definition.cjs +13 -11
- package/_cjs/collection/immutable/Vector/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector.cjs +2 -2
- package/_cjs/collection/mutable/HashMap.cjs +5 -5
- package/_cjs/collection/mutable/HashMap.cjs.map +1 -1
- package/_cjs/collection/mutable/HashSet.cjs +4 -4
- package/_cjs/collection/mutable/HashSet.cjs.map +1 -1
- package/_cjs/control/Eval/api.cjs +7 -1
- package/_cjs/control/Eval/api.cjs.map +1 -1
- package/_cjs/control/Eval/definition.cjs +7 -0
- package/_cjs/control/Eval/definition.cjs.map +1 -1
- package/_cjs/control/Eval/instance.cjs +14 -25
- package/_cjs/control/Eval/instance.cjs.map +1 -1
- package/_cjs/control/Eval.cjs +5 -5
- package/_cjs/control/Z/api.cjs +2 -2
- package/_cjs/control/Z/definition.cjs +10 -4
- package/_cjs/control/Z/definition.cjs.map +1 -1
- package/_cjs/control/Z/instances.cjs +7 -14
- package/_cjs/control/Z/instances.cjs.map +1 -1
- package/_cjs/control/Z/runtime.cjs +2 -2
- package/_cjs/control/Z.cjs +4 -4
- package/_cjs/data/Branded/definition.cjs +29 -0
- package/_cjs/data/Branded/definition.cjs.map +1 -0
- package/_cjs/data/Branded/derivations.cjs +58 -0
- package/_cjs/data/Branded/derivations.cjs.map +1 -0
- package/_cjs/data/Branded.cjs +32 -0
- package/_cjs/data/Branded.cjs.map +1 -0
- package/_cjs/data/Cause/api/fold.cjs +2 -0
- package/_cjs/data/Cause/api/fold.cjs.map +1 -1
- package/_cjs/data/Cause/api/unified.cjs +2 -2
- package/_cjs/data/Cause/api.cjs +30 -7
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/Cause/definition.cjs +3 -3
- package/_cjs/data/Cause.cjs +2 -2
- package/_cjs/data/Const/api.cjs +3 -7
- package/_cjs/data/Const/api.cjs.map +1 -1
- package/_cjs/data/Const/definition.cjs +19 -1
- package/_cjs/data/Const/definition.cjs.map +1 -1
- package/_cjs/data/Const/instances.cjs +9 -20
- package/_cjs/data/Const/instances.cjs.map +1 -1
- package/_cjs/data/Const.cjs +3 -3
- package/_cjs/data/DecodeError/definition.cjs +308 -0
- package/_cjs/data/DecodeError/definition.cjs.map +1 -0
- package/_cjs/data/DecodeError.cjs +19 -0
- package/_cjs/data/DecodeError.cjs.map +1 -0
- package/_cjs/data/Decoder/api.cjs +217 -0
- package/_cjs/data/Decoder/api.cjs.map +1 -0
- package/_cjs/data/Decoder/definition.cjs +41 -0
- package/_cjs/data/Decoder/definition.cjs.map +1 -0
- package/_cjs/data/Decoder.cjs +32 -0
- package/_cjs/data/Decoder.cjs.map +1 -0
- package/_cjs/data/Duration/api.cjs +22 -9
- package/_cjs/data/Duration/api.cjs.map +1 -1
- package/_cjs/data/Duration/definition.cjs +1 -1
- package/_cjs/data/Duration.cjs +2 -2
- package/_cjs/data/Either/api/align.cjs +1 -1
- package/_cjs/data/Either/api/alignWith.cjs +2 -0
- package/_cjs/data/Either/api/alignWith.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +110 -47
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Either/constructors.cjs +1 -1
- package/_cjs/data/Either/definition.cjs +39 -10
- package/_cjs/data/Either/definition.cjs.map +1 -1
- package/_cjs/data/Either/destructors.cjs +2 -0
- package/_cjs/data/Either/destructors.cjs.map +1 -1
- package/_cjs/data/Either/instances.cjs +123 -40
- package/_cjs/data/Either/instances.cjs.map +1 -1
- package/_cjs/data/Either.cjs +5 -5
- package/_cjs/data/Environment/api.cjs +29 -8
- package/_cjs/data/Environment/api.cjs.map +1 -1
- package/_cjs/data/Environment.cjs +2 -2
- package/_cjs/data/Exit/api.cjs +1 -1
- package/_cjs/data/Exit/constructors.cjs +1 -1
- package/_cjs/data/Exit/definition.cjs +2 -2
- package/_cjs/data/Exit.cjs +3 -3
- package/_cjs/data/FiberId/api.cjs +1 -1
- package/_cjs/data/FiberId/constructors.cjs +2 -2
- package/_cjs/data/FiberId/definition.cjs +1 -1
- package/_cjs/data/FiberId.cjs +3 -3
- package/_cjs/data/Identity/api.cjs +35 -6
- package/_cjs/data/Identity/api.cjs.map +1 -1
- package/_cjs/data/Identity/definition.cjs +10 -1
- package/_cjs/data/Identity/definition.cjs.map +1 -1
- package/_cjs/data/Identity/instances.cjs +12 -26
- package/_cjs/data/Identity/instances.cjs.map +1 -1
- package/_cjs/data/Identity.cjs +3 -3
- package/_cjs/data/Interval.cjs +154 -0
- package/_cjs/data/Interval.cjs.map +1 -0
- package/_cjs/data/Maybe/api.cjs +31 -44
- package/_cjs/data/Maybe/api.cjs.map +1 -1
- package/_cjs/data/Maybe/definition.cjs +46 -19
- package/_cjs/data/Maybe/definition.cjs.map +1 -1
- package/_cjs/data/Maybe/destructors.cjs +1 -0
- package/_cjs/data/Maybe/destructors.cjs.map +1 -1
- package/_cjs/data/Maybe/instances.cjs +62 -42
- package/_cjs/data/Maybe/instances.cjs.map +1 -1
- package/_cjs/data/Maybe.cjs +5 -5
- package/_cjs/data/Newtype.cjs +5 -3
- package/_cjs/data/Newtype.cjs.map +1 -1
- package/_cjs/data/Patch/api.cjs +1 -1
- package/_cjs/data/Patch/api.cjs.map +1 -1
- package/_cjs/data/Patch.cjs +2 -2
- package/_cjs/data/Predicate.cjs +2 -2
- package/_cjs/data/Refinement/api.cjs +0 -4
- package/_cjs/data/Refinement/api.cjs.map +1 -1
- package/_cjs/data/Refinement.cjs +2 -2
- package/_cjs/data/Struct/api.cjs +1 -1
- package/_cjs/data/Struct/definition.cjs +4 -2
- package/_cjs/data/Struct/definition.cjs.map +1 -1
- package/_cjs/data/Tag.cjs +2 -2
- package/_cjs/data/These/api.cjs +299 -0
- package/_cjs/data/These/api.cjs.map +1 -0
- package/_cjs/data/These/constructors.cjs +25 -5
- package/_cjs/data/These/constructors.cjs.map +1 -1
- package/_cjs/data/These/definition.cjs +16 -0
- package/_cjs/data/These/definition.cjs.map +1 -1
- package/_cjs/data/These/destructors.cjs +70 -0
- package/_cjs/data/These/destructors.cjs.map +1 -1
- package/_cjs/data/These/instances.cjs +54 -0
- package/_cjs/data/These/instances.cjs.map +1 -0
- package/_cjs/data/These.cjs +16 -3
- package/_cjs/data/These.cjs.map +1 -1
- package/_cjs/data/Trace.cjs +3 -3
- package/_cjs/data/TraceElement.cjs +1 -1
- package/_cjs/data/bigint/definition.cjs +6 -0
- package/_cjs/data/bigint/definition.cjs.map +1 -0
- package/_cjs/data/bigint/instances.cjs +24 -0
- package/_cjs/data/bigint/instances.cjs.map +1 -0
- package/_cjs/data/bigint.cjs +32 -0
- package/_cjs/data/bigint.cjs.map +1 -0
- package/_cjs/data/boolean/definition.cjs +6 -0
- package/_cjs/data/boolean/definition.cjs.map +1 -0
- package/_cjs/data/boolean/instances.cjs +24 -0
- package/_cjs/data/boolean/instances.cjs.map +1 -0
- package/_cjs/data/boolean.cjs +32 -0
- package/_cjs/data/boolean.cjs.map +1 -0
- package/_cjs/data/exceptions/InterruptedException.cjs +1 -1
- package/_cjs/data/exceptions.cjs +7 -7
- package/_cjs/data/function.cjs +3 -3
- package/_cjs/data/number/instances.cjs +19 -6
- package/_cjs/data/number/instances.cjs.map +1 -1
- package/_cjs/data/number.cjs +3 -3
- package/_cjs/data/object/instances.cjs +24 -0
- package/_cjs/data/object/instances.cjs.map +1 -0
- package/_cjs/data/object.cjs +1 -1
- package/_cjs/data/string/instances.cjs +25 -10
- package/_cjs/data/string/instances.cjs.map +1 -1
- package/_cjs/data/string.cjs +3 -3
- package/_cjs/internal/AtomicBoolean.cjs +1 -1
- package/_cjs/internal/AtomicNumber.cjs +1 -1
- package/_cjs/internal/Stack.cjs +4 -0
- package/_cjs/internal/Stack.cjs.map +1 -1
- package/_cjs/json/EitherJson.cjs +33 -0
- package/_cjs/json/EitherJson.cjs.map +1 -0
- package/_cjs/json/MaybeJson.cjs +31 -0
- package/_cjs/json/MaybeJson.cjs.map +1 -0
- package/_cjs/json/TheseJson.cjs +37 -0
- package/_cjs/json/TheseJson.cjs.map +1 -0
- package/_cjs/optics/At.cjs +2 -2
- package/_cjs/optics/Fold.cjs +1 -1
- package/_cjs/optics/Getter.cjs +1 -1
- package/_cjs/optics/Index.cjs +2 -2
- package/_cjs/optics/Iso.cjs +2 -2
- package/_cjs/optics/Lens.cjs +2 -2
- package/_cjs/optics/Optional/definition.cjs +6 -4
- package/_cjs/optics/Optional/definition.cjs.map +1 -1
- package/_cjs/optics/Optional.cjs +2 -2
- package/_cjs/optics/Prism.cjs +4 -4
- package/_cjs/optics/Setter.cjs +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 +4 -4
- package/_cjs/optics/Traversal/api/fromTraversable.cjs.map +1 -1
- package/_cjs/optics/Traversal/definition.cjs +17 -12
- package/_cjs/optics/Traversal/definition.cjs.map +1 -1
- package/_cjs/optics/Traversal.cjs +3 -3
- package/_cjs/typeclass/Align.cjs +0 -20
- package/_cjs/typeclass/Align.cjs.map +1 -1
- package/_cjs/typeclass/Alt.cjs +5 -15
- package/_cjs/typeclass/Alt.cjs.map +1 -1
- package/_cjs/typeclass/Alternative.cjs +0 -23
- package/_cjs/typeclass/Alternative.cjs.map +1 -1
- package/_cjs/typeclass/Applicative.cjs +0 -22
- package/_cjs/typeclass/Applicative.cjs.map +1 -1
- package/_cjs/typeclass/ApplicativeExcept.cjs +40 -34
- package/_cjs/typeclass/ApplicativeExcept.cjs.map +1 -1
- package/_cjs/typeclass/Apply.cjs +93 -49
- package/_cjs/typeclass/Apply.cjs.map +1 -1
- package/_cjs/typeclass/Chain.cjs +40 -17
- package/_cjs/typeclass/Chain.cjs.map +1 -1
- package/_cjs/typeclass/Closure.cjs +1 -4
- package/_cjs/typeclass/Closure.cjs.map +1 -1
- package/_cjs/typeclass/Eq/definition.cjs +18 -0
- package/_cjs/typeclass/Eq/definition.cjs.map +1 -0
- package/_cjs/typeclass/Eq/derivations.cjs +59 -0
- package/_cjs/typeclass/Eq/derivations.cjs.map +1 -0
- package/_cjs/typeclass/Eq.cjs +11 -13
- package/_cjs/typeclass/Eq.cjs.map +1 -1
- package/_cjs/typeclass/Equatable.cjs +3 -3
- package/_cjs/typeclass/Fail.cjs +6 -12
- package/_cjs/typeclass/Fail.cjs.map +1 -1
- package/_cjs/typeclass/Filterable.cjs +31 -18
- package/_cjs/typeclass/Filterable.cjs.map +1 -1
- package/_cjs/typeclass/FilterableWithIndex.cjs +0 -26
- package/_cjs/typeclass/FilterableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Foldable.cjs +33 -19
- package/_cjs/typeclass/Foldable.cjs.map +1 -1
- package/_cjs/typeclass/FoldableWithIndex.cjs +33 -21
- package/_cjs/typeclass/FoldableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Functor.cjs +19 -16
- package/_cjs/typeclass/Functor.cjs.map +1 -1
- package/_cjs/typeclass/FunctorWithIndex.cjs +0 -21
- package/_cjs/typeclass/FunctorWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Guard/api.cjs +40 -0
- package/_cjs/typeclass/Guard/api.cjs.map +1 -0
- package/_cjs/typeclass/Guard/definition.cjs +40 -0
- package/_cjs/typeclass/Guard/definition.cjs.map +1 -0
- package/_cjs/typeclass/Guard/derivations.cjs +85 -0
- package/_cjs/typeclass/Guard/derivations.cjs.map +1 -0
- package/_cjs/typeclass/Guard.cjs +32 -0
- package/_cjs/typeclass/Guard.cjs.map +1 -0
- package/_cjs/typeclass/HashEq.cjs +3 -3
- package/_cjs/typeclass/HashEq.cjs.map +1 -1
- package/_cjs/typeclass/Hashable.cjs +2 -2
- package/_cjs/typeclass/Monad.cjs +0 -22
- package/_cjs/typeclass/Monad.cjs.map +1 -1
- package/_cjs/typeclass/MonadExcept.cjs +12 -19
- package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
- package/_cjs/typeclass/Monoid.cjs +56 -2
- package/_cjs/typeclass/Monoid.cjs.map +1 -1
- package/_cjs/typeclass/Nil.cjs +10 -0
- package/_cjs/typeclass/Nil.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api/contramap.cjs +2 -4
- package/_cjs/typeclass/Ord/api/contramap.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api/max.cjs +1 -1
- package/_cjs/typeclass/Ord/api/max.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api/min.cjs +1 -1
- package/_cjs/typeclass/Ord/api/min.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api.cjs +3 -3
- package/_cjs/typeclass/Ord/definition.cjs +2 -3
- package/_cjs/typeclass/Ord/definition.cjs.map +1 -1
- package/_cjs/typeclass/Ord/instances.cjs +7 -7
- package/_cjs/typeclass/Ord/instances.cjs.map +1 -1
- package/_cjs/typeclass/Ord.cjs +3 -3
- package/_cjs/typeclass/Pointed.cjs +6 -11
- package/_cjs/typeclass/Pointed.cjs.map +1 -1
- package/_cjs/typeclass/Semialign.cjs +77 -94
- package/_cjs/typeclass/Semialign.cjs.map +1 -1
- package/_cjs/typeclass/Semigroup/api.cjs +2 -2
- package/_cjs/typeclass/Semigroup/api.cjs.map +1 -1
- package/_cjs/typeclass/Semigroup/definition.cjs.map +1 -1
- package/_cjs/typeclass/Semigroup/derivations.cjs +63 -0
- package/_cjs/typeclass/Semigroup/derivations.cjs.map +1 -0
- package/_cjs/typeclass/Semigroup.cjs +2 -2
- package/_cjs/typeclass/Semimonoidal.cjs +9 -13
- package/_cjs/typeclass/Semimonoidal.cjs.map +1 -1
- package/_cjs/typeclass/Showable/show.cjs +11 -11
- package/_cjs/typeclass/Showable/show.cjs.map +1 -1
- package/_cjs/typeclass/Showable.cjs +2 -2
- package/_cjs/typeclass/Traversable.cjs +26 -34
- package/_cjs/typeclass/Traversable.cjs.map +1 -1
- package/_cjs/typeclass/TraversableWithIndex.cjs +7 -38
- package/_cjs/typeclass/TraversableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Witherable.cjs +41 -42
- package/_cjs/typeclass/Witherable.cjs.map +1 -1
- package/_cjs/typeclass/WitherableWithIndex.cjs +41 -50
- package/_cjs/typeclass/WitherableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/builtin.cjs +1 -1
- package/_cjs/typeclass.cjs +49 -36
- package/_cjs/typeclass.cjs.map +1 -1
- package/_cjs/types.cjs +3 -3
- package/_cjs/util/predicates.cjs +5 -0
- package/_cjs/util/predicates.cjs.map +1 -1
- package/_mjs/collection/Iterable/api/traverseConc.mjs +20 -15
- package/_mjs/collection/Iterable/api/traverseConc.mjs.map +1 -1
- package/_mjs/collection/Iterable/api.mjs +21 -31
- package/_mjs/collection/Iterable/api.mjs.map +1 -1
- package/_mjs/collection/compat/Array/api.mjs +1 -1
- package/_mjs/collection/compat/Array/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api.mjs +35 -36
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/definition.mjs +48 -39
- package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Dictionary/definition.mjs +3 -2
- package/_mjs/collection/immutable/Dictionary/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/api.mjs +26 -66
- package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/definition.mjs +18 -15
- package/_mjs/collection/immutable/HashMap/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/api.mjs +5 -5
- package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +135 -177
- package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/definition.mjs +11 -10
- package/_mjs/collection/immutable/ImmutableArray/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs +151 -138
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs +108 -142
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs +2 -0
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs +46 -67
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/List/api.mjs +4 -5
- package/_mjs/collection/immutable/List/api.mjs.map +1 -1
- package/_mjs/collection/immutable/RoseTree/api.mjs +447 -0
- package/_mjs/collection/immutable/RoseTree/api.mjs.map +1 -0
- package/_mjs/collection/immutable/RoseTree/definition.mjs +35 -0
- package/_mjs/collection/immutable/RoseTree/definition.mjs.map +1 -0
- package/_mjs/collection/immutable/RoseTree.mjs +4 -0
- package/_mjs/collection/immutable/RoseTree.mjs.map +1 -0
- package/_mjs/collection/immutable/SortedMap/api.mjs +65 -65
- package/_mjs/collection/immutable/SortedMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/api.mjs +59 -15
- package/_mjs/collection/immutable/Vector/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/definition.mjs +12 -11
- package/_mjs/collection/immutable/Vector/definition.mjs.map +1 -1
- package/_mjs/collection/mutable/HashMap.mjs +5 -5
- package/_mjs/collection/mutable/HashMap.mjs.map +1 -1
- package/_mjs/collection/mutable/HashSet.mjs +4 -4
- package/_mjs/collection/mutable/HashSet.mjs.map +1 -1
- package/_mjs/control/Eval/api.mjs +5 -2
- package/_mjs/control/Eval/api.mjs.map +1 -1
- package/_mjs/control/Eval/definition.mjs +1 -0
- package/_mjs/control/Eval/definition.mjs.map +1 -1
- package/_mjs/control/Eval/instance.mjs +15 -18
- package/_mjs/control/Eval/instance.mjs.map +1 -1
- package/_mjs/control/Z/definition.mjs +2 -0
- package/_mjs/control/Z/definition.mjs.map +1 -1
- package/_mjs/control/Z/instances.mjs +7 -8
- package/_mjs/control/Z/instances.mjs.map +1 -1
- package/_mjs/data/Branded/definition.mjs +18 -0
- package/_mjs/data/Branded/definition.mjs.map +1 -0
- package/_mjs/data/Branded/derivations.mjs +39 -0
- package/_mjs/data/Branded/derivations.mjs.map +1 -0
- package/_mjs/data/Branded.mjs +4 -0
- package/_mjs/data/Branded.mjs.map +1 -0
- package/_mjs/data/Cause/api/fold.mjs +2 -0
- package/_mjs/data/Cause/api/fold.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +20 -0
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/Const/api.mjs +3 -3
- package/_mjs/data/Const/api.mjs.map +1 -1
- package/_mjs/data/Const/definition.mjs +13 -1
- package/_mjs/data/Const/definition.mjs.map +1 -1
- package/_mjs/data/Const/instances.mjs +7 -15
- package/_mjs/data/Const/instances.mjs.map +1 -1
- package/_mjs/data/DecodeError/definition.mjs +226 -0
- package/_mjs/data/DecodeError/definition.mjs.map +1 -0
- package/_mjs/data/DecodeError.mjs +3 -0
- package/_mjs/data/DecodeError.mjs.map +1 -0
- package/_mjs/data/Decoder/api.mjs +179 -0
- package/_mjs/data/Decoder/api.mjs.map +1 -0
- package/_mjs/data/Decoder/definition.mjs +24 -0
- package/_mjs/data/Decoder/definition.mjs.map +1 -0
- package/_mjs/data/Decoder.mjs +4 -0
- package/_mjs/data/Decoder.mjs.map +1 -0
- package/_mjs/data/Duration/api.mjs +17 -8
- package/_mjs/data/Duration/api.mjs.map +1 -1
- package/_mjs/data/Either/api/alignWith.mjs +2 -0
- package/_mjs/data/Either/api/alignWith.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +91 -21
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/definition.mjs +25 -5
- package/_mjs/data/Either/definition.mjs.map +1 -1
- package/_mjs/data/Either/destructors.mjs +2 -0
- package/_mjs/data/Either/destructors.mjs.map +1 -1
- package/_mjs/data/Either/instances.mjs +109 -39
- package/_mjs/data/Either/instances.mjs.map +1 -1
- package/_mjs/data/Environment/api.mjs +23 -7
- package/_mjs/data/Environment/api.mjs.map +1 -1
- package/_mjs/data/Identity/api.mjs +24 -5
- package/_mjs/data/Identity/api.mjs.map +1 -1
- package/_mjs/data/Identity/definition.mjs +3 -1
- package/_mjs/data/Identity/definition.mjs.map +1 -1
- package/_mjs/data/Identity/instances.mjs +12 -18
- package/_mjs/data/Identity/instances.mjs.map +1 -1
- package/_mjs/data/Interval.mjs +114 -0
- package/_mjs/data/Interval.mjs.map +1 -0
- package/_mjs/data/Maybe/api.mjs +30 -35
- package/_mjs/data/Maybe/api.mjs.map +1 -1
- package/_mjs/data/Maybe/definition.mjs +37 -14
- package/_mjs/data/Maybe/definition.mjs.map +1 -1
- package/_mjs/data/Maybe/destructors.mjs +1 -0
- package/_mjs/data/Maybe/destructors.mjs.map +1 -1
- package/_mjs/data/Maybe/instances.mjs +56 -39
- package/_mjs/data/Maybe/instances.mjs.map +1 -1
- package/_mjs/data/Newtype.mjs +4 -3
- package/_mjs/data/Newtype.mjs.map +1 -1
- package/_mjs/data/Patch/api.mjs +1 -1
- package/_mjs/data/Patch/api.mjs.map +1 -1
- package/_mjs/data/Refinement/api.mjs +0 -4
- package/_mjs/data/Refinement/api.mjs.map +1 -1
- package/_mjs/data/Struct/definition.mjs +3 -2
- package/_mjs/data/Struct/definition.mjs.map +1 -1
- package/_mjs/data/These/api.mjs +262 -0
- package/_mjs/data/These/api.mjs.map +1 -0
- package/_mjs/data/These/constructors.mjs +14 -2
- package/_mjs/data/These/constructors.mjs.map +1 -1
- package/_mjs/data/These/definition.mjs +8 -0
- package/_mjs/data/These/definition.mjs.map +1 -1
- package/_mjs/data/These/destructors.mjs +53 -0
- package/_mjs/data/These/destructors.mjs.map +1 -1
- package/_mjs/data/These/instances.mjs +36 -0
- package/_mjs/data/These/instances.mjs.map +1 -0
- package/_mjs/data/These.mjs +1 -0
- package/_mjs/data/These.mjs.map +1 -1
- package/_mjs/data/bigint/definition.mjs +2 -0
- package/_mjs/data/bigint/definition.mjs.map +1 -0
- package/_mjs/data/bigint/instances.mjs +10 -0
- package/_mjs/data/bigint/instances.mjs.map +1 -0
- package/_mjs/data/bigint.mjs +4 -0
- package/_mjs/data/bigint.mjs.map +1 -0
- package/_mjs/data/boolean/definition.mjs +2 -0
- package/_mjs/data/boolean/definition.mjs.map +1 -0
- package/_mjs/data/boolean/instances.mjs +10 -0
- package/_mjs/data/boolean/instances.mjs.map +1 -0
- package/_mjs/data/boolean.mjs +4 -0
- package/_mjs/data/boolean.mjs.map +1 -0
- package/_mjs/data/number/instances.mjs +14 -4
- package/_mjs/data/number/instances.mjs.map +1 -1
- package/_mjs/data/object/instances.mjs +10 -0
- package/_mjs/data/object/instances.mjs.map +1 -0
- package/_mjs/data/string/instances.mjs +20 -8
- package/_mjs/data/string/instances.mjs.map +1 -1
- package/_mjs/internal/Stack.mjs +4 -0
- package/_mjs/internal/Stack.mjs.map +1 -1
- package/_mjs/json/EitherJson.mjs +18 -0
- package/_mjs/json/EitherJson.mjs.map +1 -0
- package/_mjs/json/MaybeJson.mjs +16 -0
- package/_mjs/json/MaybeJson.mjs.map +1 -0
- package/_mjs/json/TheseJson.mjs +22 -0
- package/_mjs/json/TheseJson.mjs.map +1 -0
- package/_mjs/optics/Optional/definition.mjs +5 -4
- 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 +5 -4
- package/_mjs/optics/Traversal/api/fromTraversable.mjs.map +1 -1
- package/_mjs/optics/Traversal/definition.mjs +14 -12
- package/_mjs/optics/Traversal/definition.mjs.map +1 -1
- package/_mjs/typeclass/Align.mjs +0 -11
- package/_mjs/typeclass/Align.mjs.map +1 -1
- package/_mjs/typeclass/Alt.mjs +4 -7
- package/_mjs/typeclass/Alt.mjs.map +1 -1
- package/_mjs/typeclass/Alternative.mjs +0 -13
- package/_mjs/typeclass/Alternative.mjs.map +1 -1
- package/_mjs/typeclass/Applicative.mjs +0 -12
- package/_mjs/typeclass/Applicative.mjs.map +1 -1
- package/_mjs/typeclass/ApplicativeExcept.mjs +32 -24
- package/_mjs/typeclass/ApplicativeExcept.mjs.map +1 -1
- package/_mjs/typeclass/Apply.mjs +85 -42
- package/_mjs/typeclass/Apply.mjs.map +1 -1
- package/_mjs/typeclass/Chain.mjs +33 -12
- package/_mjs/typeclass/Chain.mjs.map +1 -1
- package/_mjs/typeclass/Closure.mjs +1 -4
- package/_mjs/typeclass/Closure.mjs.map +1 -1
- package/_mjs/typeclass/Eq/definition.mjs +9 -0
- package/_mjs/typeclass/Eq/definition.mjs.map +1 -0
- package/_mjs/typeclass/Eq/derivations.mjs +46 -0
- package/_mjs/typeclass/Eq/derivations.mjs.map +1 -0
- package/_mjs/typeclass/Eq.mjs +1 -11
- package/_mjs/typeclass/Eq.mjs.map +1 -1
- package/_mjs/typeclass/Fail.mjs +5 -7
- package/_mjs/typeclass/Fail.mjs.map +1 -1
- package/_mjs/typeclass/Filterable.mjs +27 -13
- package/_mjs/typeclass/Filterable.mjs.map +1 -1
- package/_mjs/typeclass/FilterableWithIndex.mjs +0 -16
- package/_mjs/typeclass/FilterableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Foldable.mjs +29 -12
- package/_mjs/typeclass/Foldable.mjs.map +1 -1
- package/_mjs/typeclass/FoldableWithIndex.mjs +29 -13
- package/_mjs/typeclass/FoldableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Functor.mjs +16 -9
- package/_mjs/typeclass/Functor.mjs.map +1 -1
- package/_mjs/typeclass/FunctorWithIndex.mjs +0 -12
- package/_mjs/typeclass/FunctorWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Guard/api.mjs +23 -0
- package/_mjs/typeclass/Guard/api.mjs.map +1 -0
- package/_mjs/typeclass/Guard/definition.mjs +23 -0
- package/_mjs/typeclass/Guard/definition.mjs.map +1 -0
- package/_mjs/typeclass/Guard/derivations.mjs +67 -0
- package/_mjs/typeclass/Guard/derivations.mjs.map +1 -0
- package/_mjs/typeclass/Guard.mjs +4 -0
- package/_mjs/typeclass/Guard.mjs.map +1 -0
- package/_mjs/typeclass/HashEq.mjs +3 -3
- package/_mjs/typeclass/HashEq.mjs.map +1 -1
- package/_mjs/typeclass/Monad.mjs +0 -12
- package/_mjs/typeclass/Monad.mjs.map +1 -1
- package/_mjs/typeclass/MonadExcept.mjs +9 -13
- package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
- package/_mjs/typeclass/Monoid.mjs +50 -1
- package/_mjs/typeclass/Monoid.mjs.map +1 -1
- package/_mjs/typeclass/Nil.mjs +8 -1
- package/_mjs/typeclass/Nil.mjs.map +1 -1
- package/_mjs/typeclass/Ord/api/contramap.mjs +2 -4
- package/_mjs/typeclass/Ord/api/contramap.mjs.map +1 -1
- package/_mjs/typeclass/Ord/api/max.mjs +1 -1
- package/_mjs/typeclass/Ord/api/max.mjs.map +1 -1
- package/_mjs/typeclass/Ord/api/min.mjs +1 -1
- package/_mjs/typeclass/Ord/api/min.mjs.map +1 -1
- package/_mjs/typeclass/Ord/definition.mjs +2 -3
- package/_mjs/typeclass/Ord/definition.mjs.map +1 -1
- package/_mjs/typeclass/Ord/instances.mjs +7 -7
- package/_mjs/typeclass/Ord/instances.mjs.map +1 -1
- package/_mjs/typeclass/Pointed.mjs +5 -4
- package/_mjs/typeclass/Pointed.mjs.map +1 -1
- package/_mjs/typeclass/Semialign.mjs +67 -74
- package/_mjs/typeclass/Semialign.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/api.mjs +2 -2
- package/_mjs/typeclass/Semigroup/api.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/definition.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/derivations.mjs +50 -0
- package/_mjs/typeclass/Semigroup/derivations.mjs.map +1 -0
- package/_mjs/typeclass/Semigroup.mjs +1 -1
- package/_mjs/typeclass/Semimonoidal.mjs +8 -6
- package/_mjs/typeclass/Semimonoidal.mjs.map +1 -1
- package/_mjs/typeclass/Showable/show.mjs +11 -11
- package/_mjs/typeclass/Showable/show.mjs.map +1 -1
- package/_mjs/typeclass/Traversable.mjs +25 -24
- package/_mjs/typeclass/Traversable.mjs.map +1 -1
- package/_mjs/typeclass/TraversableWithIndex.mjs +6 -24
- package/_mjs/typeclass/TraversableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Witherable.mjs +39 -32
- package/_mjs/typeclass/Witherable.mjs.map +1 -1
- package/_mjs/typeclass/WitherableWithIndex.mjs +39 -37
- package/_mjs/typeclass/WitherableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass.mjs +1 -0
- package/_mjs/typeclass.mjs.map +1 -1
- package/_mjs/util/predicates.mjs +3 -0
- package/_mjs/util/predicates.mjs.map +1 -1
- package/_src/collection/Iterable/api/traverseConc.ts +21 -29
- package/_src/collection/Iterable/api.ts +20 -34
- package/_src/collection/compat/Array/api.ts +1 -1
- package/_src/collection/immutable/Conc/api.ts +26 -46
- package/_src/collection/immutable/Conc/definition.ts +19 -8
- package/_src/collection/immutable/Dictionary/definition.ts +1 -1
- package/_src/collection/immutable/HashMap/api.ts +24 -81
- package/_src/collection/immutable/HashMap/definition.ts +7 -9
- package/_src/collection/immutable/HashMap/internal.ts +1 -1
- package/_src/collection/immutable/HashSet/api.ts +4 -4
- package/_src/collection/immutable/ImmutableArray/api.ts +180 -219
- package/_src/collection/immutable/ImmutableArray/definition.ts +6 -8
- package/_src/collection/immutable/ImmutableArray/instances.ts +156 -134
- package/_src/collection/immutable/ImmutableNonEmptyArray/api.ts +87 -158
- package/_src/collection/immutable/ImmutableNonEmptyArray/definition.ts +4 -8
- package/_src/collection/immutable/ImmutableNonEmptyArray/instances.ts +39 -49
- package/_src/collection/immutable/List/api.ts +2 -6
- package/_src/collection/immutable/RoseTree/api.ts +278 -0
- package/_src/collection/immutable/RoseTree/definition.ts +29 -0
- package/_src/collection/immutable/RoseTree.ts +4 -0
- package/_src/collection/immutable/SortedMap/api.ts +56 -53
- package/_src/collection/immutable/Vector/api.ts +57 -17
- package/_src/collection/immutable/Vector/definition.ts +10 -0
- package/_src/collection/mutable/HashMap.ts +5 -5
- package/_src/collection/mutable/HashSet.ts +4 -4
- package/_src/control/Eval/api.ts +5 -1
- package/_src/control/Eval/definition.ts +5 -8
- package/_src/control/Eval/instance.ts +16 -15
- package/_src/control/Z/definition.ts +26 -19
- package/_src/control/Z/instances.ts +9 -8
- package/_src/data/Branded/definition.ts +47 -0
- package/_src/data/Branded/derivations.ts +57 -0
- package/_src/data/Branded.ts +4 -0
- package/_src/data/Cause/api/fold.ts +1 -0
- package/_src/data/Cause/api.ts +18 -0
- package/_src/data/Const/api.ts +3 -3
- package/_src/data/Const/definition.ts +22 -5
- package/_src/data/Const/instances.ts +12 -21
- package/_src/data/DecodeError/definition.ts +227 -0
- package/_src/data/DecodeError.ts +3 -0
- package/_src/data/Decoder/api.ts +198 -0
- package/_src/data/Decoder/definition.ts +25 -0
- package/_src/data/Decoder.ts +4 -0
- package/_src/data/Duration/api.ts +21 -14
- package/_src/data/Either/api/alignWith.ts +2 -0
- package/_src/data/Either/api.ts +85 -30
- package/_src/data/Either/definition.ts +41 -19
- package/_src/data/Either/destructors.ts +1 -0
- package/_src/data/Either/instances.ts +102 -51
- package/_src/data/Environment/api.ts +19 -4
- package/_src/data/Identity/api.ts +19 -4
- package/_src/data/Identity/definition.ts +7 -3
- package/_src/data/Identity/instances.ts +15 -8
- package/_src/data/Interval.ts +103 -0
- package/_src/data/Maybe/api.ts +21 -31
- package/_src/data/Maybe/definition.ts +31 -19
- package/_src/data/Maybe/destructors.ts +1 -0
- package/_src/data/Maybe/instances.ts +61 -34
- package/_src/data/Newtype.ts +11 -32
- package/_src/data/Patch/api.ts +1 -1
- package/_src/data/Refinement/api.ts +4 -2
- package/_src/data/Struct/definition.ts +1 -1
- package/_src/data/These/api.ts +184 -0
- package/_src/data/These/constructors.ts +10 -0
- package/_src/data/These/definition.ts +7 -0
- package/_src/data/These/destructors.ts +45 -0
- package/_src/data/These/instances.ts +43 -0
- package/_src/data/These.ts +1 -0
- package/_src/data/bigint/definition.ts +13 -0
- package/_src/data/bigint/instances.ts +8 -0
- package/_src/data/bigint.ts +4 -0
- package/_src/data/boolean/definition.ts +13 -0
- package/_src/data/boolean/instances.ts +8 -0
- package/_src/data/boolean.ts +4 -0
- package/_src/data/number/instances.ts +13 -3
- package/_src/data/object/instances.ts +7 -0
- package/_src/data/string/instances.ts +17 -5
- package/_src/internal/Stack.ts +4 -0
- package/_src/json/EitherJson.ts +28 -0
- package/_src/json/MaybeJson.ts +27 -0
- package/_src/json/TheseJson.ts +31 -0
- package/_src/optics/Optional/definition.ts +2 -2
- package/_src/optics/Traversal/api/compose.ts +1 -1
- package/_src/optics/Traversal/api/fromTraversable.ts +15 -41
- package/_src/optics/Traversal/definition.ts +21 -23
- package/_src/typeclass/Align.ts +4 -18
- package/_src/typeclass/Alt.ts +59 -90
- package/_src/typeclass/Alternative.ts +4 -20
- package/_src/typeclass/Applicative.ts +3 -23
- package/_src/typeclass/ApplicativeExcept.ts +94 -193
- package/_src/typeclass/Apply.ts +319 -509
- package/_src/typeclass/Chain.ts +127 -199
- package/_src/typeclass/Closure.ts +4 -20
- package/_src/typeclass/Eq/definition.ts +20 -0
- package/_src/typeclass/Eq/derivations.ts +61 -0
- package/_src/typeclass/Eq.ts +2 -36
- package/_src/typeclass/Fail.ts +28 -27
- package/_src/typeclass/Filterable.ts +70 -117
- package/_src/typeclass/FilterableWithIndex.ts +27 -131
- package/_src/typeclass/Foldable.ts +35 -52
- package/_src/typeclass/FoldableWithIndex.ts +40 -75
- package/_src/typeclass/Functor.ts +21 -59
- package/_src/typeclass/FunctorWithIndex.ts +6 -34
- package/_src/typeclass/Guard/api.ts +32 -0
- package/_src/typeclass/Guard/definition.ts +23 -0
- package/_src/typeclass/Guard/derivations.ts +80 -0
- package/_src/typeclass/Guard.ts +5 -0
- package/_src/typeclass/HashEq.ts +3 -4
- package/_src/typeclass/Monad.ts +3 -18
- package/_src/typeclass/MonadExcept.ts +9 -32
- package/_src/typeclass/Monoid.ts +60 -2
- package/_src/typeclass/Nil.ts +26 -17
- package/_src/typeclass/Ord/api/contramap.ts +2 -4
- package/_src/typeclass/Ord/api/max.ts +1 -1
- package/_src/typeclass/Ord/api/min.ts +1 -1
- package/_src/typeclass/Ord/definition.ts +3 -19
- package/_src/typeclass/Ord/instances.ts +6 -6
- package/_src/typeclass/Pointed.ts +29 -25
- package/_src/typeclass/Semialign.ts +308 -444
- package/_src/typeclass/Semigroup/api.ts +2 -2
- package/_src/typeclass/Semigroup/definition.ts +2 -6
- package/_src/typeclass/Semigroup/derivations.ts +64 -0
- package/_src/typeclass/Semigroup.ts +1 -1
- package/_src/typeclass/Semimonoidal.ts +55 -84
- package/_src/typeclass/Showable/show.ts +6 -8
- package/_src/typeclass/Traversable.ts +67 -157
- package/_src/typeclass/TraversableWithIndex.ts +37 -127
- package/_src/typeclass/Witherable.ts +120 -279
- package/_src/typeclass/WitherableWithIndex.ts +129 -337
- package/_src/typeclass.ts +2 -0
- package/_src/util/predicates.ts +4 -0
- package/collection/Iterable/api/traverseConc.d.ts +6 -4
- package/collection/Iterable/api.d.ts +5 -13
- package/collection/immutable/Conc/api.d.ts +15 -23
- package/collection/immutable/Conc/definition.d.ts +10 -7
- package/collection/immutable/Dictionary/definition.d.ts +1 -1
- package/collection/immutable/HashMap/api.d.ts +15 -27
- package/collection/immutable/HashMap/definition.d.ts +6 -9
- package/collection/immutable/HashMap/internal.d.ts +1 -1
- package/collection/immutable/ImmutableArray/api.d.ts +42 -94
- package/collection/immutable/ImmutableArray/definition.d.ts +6 -8
- package/collection/immutable/ImmutableArray/instances.d.ts +86 -17
- package/collection/immutable/ImmutableNonEmptyArray/api.d.ts +26 -47
- package/collection/immutable/ImmutableNonEmptyArray/definition.d.ts +4 -8
- package/collection/immutable/ImmutableNonEmptyArray/instances.d.ts +1 -1
- package/collection/immutable/List/api.d.ts +1 -2
- package/collection/immutable/RoseTree/api.d.ts +63 -0
- package/collection/immutable/RoseTree/definition.d.ts +23 -0
- package/collection/immutable/RoseTree.d.ts +2 -0
- package/collection/immutable/SortedMap/api.d.ts +2 -1
- package/collection/immutable/Vector/api.d.ts +31 -8
- package/collection/immutable/Vector/definition.d.ts +10 -0
- package/control/Eval/api.d.ts +1 -0
- package/control/Eval/definition.d.ts +5 -8
- package/control/Eval/instance.d.ts +4 -1
- package/control/Z/definition.d.ts +23 -18
- package/control/Z/instances.d.ts +4 -3
- package/data/Branded/definition.d.ts +36 -0
- package/data/Branded/derivations.d.ts +24 -0
- package/data/Branded.d.ts +2 -0
- package/data/Cause/api.d.ts +7 -1
- package/data/Const/api.d.ts +1 -1
- package/data/Const/definition.d.ts +23 -7
- package/data/Const/instances.d.ts +4 -12
- package/data/DecodeError/definition.d.ts +141 -0
- package/data/DecodeError.d.ts +1 -0
- package/data/Decoder/api.d.ts +65 -0
- package/data/Decoder/definition.d.ts +24 -0
- package/data/Decoder.d.ts +2 -0
- package/data/Duration/api.d.ts +12 -8
- package/data/Either/api.d.ts +29 -17
- package/data/Either/definition.d.ts +31 -14
- package/data/Either/instances.d.ts +26 -11
- package/data/Environment/api.d.ts +5 -0
- package/data/Identity/api.d.ts +11 -0
- package/data/Identity/definition.d.ts +7 -2
- package/data/Identity/instances.d.ts +5 -9
- package/data/Interval.d.ts +71 -0
- package/data/Maybe/api.d.ts +3 -17
- package/data/Maybe/definition.d.ts +20 -14
- package/data/Maybe/instances.d.ts +14 -8
- package/data/Newtype.d.ts +8 -9
- package/data/Refinement/api.d.ts +2 -0
- package/data/Struct/definition.d.ts +1 -1
- package/data/These/api.d.ts +73 -0
- package/data/These/constructors.d.ts +7 -1
- package/data/These/definition.d.ts +5 -0
- package/data/These/destructors.d.ts +27 -1
- package/data/These/instances.d.ts +13 -0
- package/data/These.d.ts +1 -0
- package/data/bigint/definition.d.ts +13 -0
- package/data/bigint/instances.d.ts +7 -0
- package/data/bigint.d.ts +2 -0
- package/data/boolean/definition.d.ts +13 -0
- package/data/boolean/instances.d.ts +7 -0
- package/data/boolean.d.ts +2 -0
- package/data/number/instances.d.ts +8 -0
- package/data/object/instances.d.ts +7 -0
- package/data/string/instances.d.ts +10 -0
- package/internal/Stack.d.ts +1 -0
- package/json/EitherJson.d.ts +24 -0
- package/json/MaybeJson.d.ts +23 -0
- package/json/TheseJson.d.ts +26 -0
- package/optics/Traversal/api/fromTraversable.d.ts +1 -1
- package/optics/Traversal/definition.d.ts +4 -9
- package/package.json +4 -4
- package/typeclass/Align.d.ts +3 -10
- package/typeclass/Alt.d.ts +6 -19
- package/typeclass/Alternative.d.ts +4 -12
- package/typeclass/Applicative.d.ts +3 -12
- package/typeclass/ApplicativeExcept.d.ts +14 -39
- package/typeclass/Apply.d.ts +41 -72
- package/typeclass/Chain.d.ts +18 -28
- package/typeclass/Closure.d.ts +2 -12
- package/typeclass/Eq/definition.d.ts +17 -0
- package/typeclass/Eq/derivations.d.ts +24 -0
- package/typeclass/Eq.d.ts +2 -27
- package/typeclass/Fail.d.ts +4 -10
- package/typeclass/Filterable.d.ts +30 -51
- package/typeclass/FilterableWithIndex.d.ts +10 -53
- package/typeclass/Foldable.d.ts +19 -31
- package/typeclass/FoldableWithIndex.d.ts +20 -33
- package/typeclass/Functor.d.ts +11 -22
- package/typeclass/FunctorWithIndex.d.ts +3 -19
- package/typeclass/Guard/api.d.ts +20 -0
- package/typeclass/Guard/definition.d.ts +22 -0
- package/typeclass/Guard/derivations.d.ts +36 -0
- package/typeclass/Guard.d.ts +2 -0
- package/typeclass/HashEq.d.ts +1 -2
- package/typeclass/Monad.d.ts +3 -11
- package/typeclass/MonadExcept.d.ts +6 -17
- package/typeclass/Monoid.d.ts +24 -2
- package/typeclass/Nil.d.ts +7 -8
- package/typeclass/Ord/definition.d.ts +2 -14
- package/typeclass/Pointed.d.ts +4 -10
- package/typeclass/Semialign.d.ts +51 -63
- package/typeclass/Semigroup/definition.d.ts +3 -5
- package/typeclass/Semigroup/derivations.d.ts +25 -0
- package/typeclass/Semimonoidal.d.ts +5 -14
- package/typeclass/Traversable.d.ts +17 -57
- package/typeclass/TraversableWithIndex.d.ts +9 -52
- package/typeclass/Witherable.d.ts +22 -82
- package/typeclass/WitherableWithIndex.d.ts +26 -98
- package/typeclass.d.ts +1 -0
- package/util/predicates.d.ts +1 -0
@@ -1,11 +1,28 @@
|
|
1
1
|
/**
|
2
|
-
* @tsplus type fncts.
|
2
|
+
* @tsplus type fncts.ConstF
|
3
3
|
*/
|
4
|
-
export
|
4
|
+
export interface ConstF extends Const<any, any> {}
|
5
5
|
|
6
6
|
/**
|
7
|
-
* @tsplus type fncts.
|
7
|
+
* @tsplus type fncts.ConstF
|
8
|
+
*/
|
9
|
+
export interface Const1F<E> extends Const1<E, any> {}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @tsplus type fncts.Const
|
13
|
+
* @tsplus companion fncts.ConstOps
|
8
14
|
*/
|
9
|
-
export
|
15
|
+
export class Const<E, A> {
|
16
|
+
readonly [HKT.F]!: ConstF;
|
17
|
+
readonly [HKT.E]!: () => E;
|
18
|
+
readonly [HKT.A]!: () => A;
|
19
|
+
readonly [HKT.T]!: Const<HKT._E<this>, HKT._A<this>>;
|
20
|
+
constructor(readonly getConst: E) {}
|
21
|
+
}
|
10
22
|
|
11
|
-
export
|
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
|
+
}
|
@@ -1,34 +1,25 @@
|
|
1
|
-
import * as P from "../../typeclass.js";
|
2
|
-
import {
|
1
|
+
import type * as P from "../../typeclass.js";
|
2
|
+
import type { Const1F,ConstF } from "@fncts/base/data/Const/definition";
|
3
3
|
|
4
|
-
|
5
|
-
readonly type: Const<this["E"], this["A"]>;
|
6
|
-
readonly variance: {
|
7
|
-
E: "_";
|
8
|
-
A: "_";
|
9
|
-
};
|
10
|
-
}
|
4
|
+
import { Const } from "@fncts/base/data/Const/definition";
|
11
5
|
|
12
6
|
/**
|
13
7
|
* @tsplus static fncts.ConstOps getApply
|
14
8
|
*/
|
15
|
-
export function getApply<E>(S: P.Semigroup<E>): P.Apply<
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
ap_,
|
22
|
-
zipWith_,
|
23
|
-
});
|
9
|
+
export function getApply<E>(S: P.Semigroup<E>): P.Apply<Const1F<E>> {
|
10
|
+
return {
|
11
|
+
map: (fa, f) => fa.map(f),
|
12
|
+
zip: (self, that) => Const(S.combine(self.getConst, that.getConst)),
|
13
|
+
zipWith: (self, that, _f) => Const(S.combine(self.getConst, that.getConst)),
|
14
|
+
};
|
24
15
|
}
|
25
16
|
|
26
17
|
/**
|
27
18
|
* @tsplus static fncts.ConstOps getApplicative
|
28
19
|
*/
|
29
|
-
export function getApplicative<E>(M: P.Monoid<E>): P.Applicative<
|
30
|
-
return
|
20
|
+
export function getApplicative<E>(M: P.Monoid<E>): P.Applicative<Const1F<E>> {
|
21
|
+
return {
|
31
22
|
...getApply(M),
|
32
23
|
pure: <A>() => Const<E, A>(M.nat),
|
33
|
-
}
|
24
|
+
};
|
34
25
|
}
|
@@ -0,0 +1,227 @@
|
|
1
|
+
import { show } from "@fncts/base/typeclass/Showable";
|
2
|
+
|
3
|
+
export const DecodeErrorTypeId = Symbol.for("fncts.DecodeError");
|
4
|
+
export type DecodeErrorTypeId = typeof DecodeErrorTypeId;
|
5
|
+
|
6
|
+
export abstract class DecodeError {
|
7
|
+
readonly _typeId: DecodeErrorTypeId = DecodeErrorTypeId;
|
8
|
+
abstract render: Eval<RoseTree<string>>;
|
9
|
+
}
|
10
|
+
|
11
|
+
export class RequiredKeyError extends DecodeError {
|
12
|
+
readonly _tag = "RequiredKey";
|
13
|
+
constructor(readonly key: string, readonly error: DecodeError) {
|
14
|
+
super();
|
15
|
+
}
|
16
|
+
render = Eval.defer(this.error.render.map((error) => RoseTree(`on required key ${this.key}`, Vector(error))));
|
17
|
+
}
|
18
|
+
|
19
|
+
export class OptionalKeyError extends DecodeError {
|
20
|
+
readonly _tag = "OptionalKey";
|
21
|
+
constructor(readonly key: PropertyKey, readonly error: DecodeError) {
|
22
|
+
super();
|
23
|
+
}
|
24
|
+
render = Eval.defer(this.error.render.map((error) => RoseTree(`on optional key ${show(this.key)}`, Vector(error))));
|
25
|
+
}
|
26
|
+
|
27
|
+
export class RequiredIndexError<I, E extends DecodeError> extends DecodeError {
|
28
|
+
readonly _tag = "RequiredIndex";
|
29
|
+
constructor(readonly index: I, readonly error: E) {
|
30
|
+
super();
|
31
|
+
}
|
32
|
+
render = Eval.defer(this.error.render.map((error) => RoseTree(`on required index ${this.index}`, Vector(error))));
|
33
|
+
}
|
34
|
+
|
35
|
+
export class OptionalIndexError<I, E extends DecodeError> extends DecodeError {
|
36
|
+
readonly _tag = "RequiredIndex";
|
37
|
+
constructor(readonly index: I, readonly error: E) {
|
38
|
+
super();
|
39
|
+
}
|
40
|
+
render = Eval.defer(this.error.render.map((error) => RoseTree(`on optional index ${this.index}`, Vector(error))));
|
41
|
+
}
|
42
|
+
|
43
|
+
export class LazyError<E extends DecodeError> extends DecodeError {
|
44
|
+
readonly _tag = "Lazy";
|
45
|
+
constructor(readonly error: E) {
|
46
|
+
super();
|
47
|
+
}
|
48
|
+
render = Eval.defer(this.error.render.map((error) => RoseTree("while decoding a lazy decoder", Vector(error))));
|
49
|
+
}
|
50
|
+
|
51
|
+
export class MemberError extends DecodeError {
|
52
|
+
readonly _tag = "Member";
|
53
|
+
constructor(readonly label: string, readonly error: DecodeError) {
|
54
|
+
super();
|
55
|
+
}
|
56
|
+
render = Eval.defer(this.error.render.map((error) => RoseTree(`on member ${this.label}`, Vector(error))));
|
57
|
+
}
|
58
|
+
|
59
|
+
const vowels = ["a", "e", "i", "o", "u", "y"];
|
60
|
+
|
61
|
+
function startsWithVowel(s: string): boolean {
|
62
|
+
for (let i = 0; i < vowels.length; i++) {
|
63
|
+
if (s.startsWith(vowels[i]!)) return true;
|
64
|
+
}
|
65
|
+
return false;
|
66
|
+
}
|
67
|
+
|
68
|
+
export class CompoundError<E extends DecodeError> extends DecodeError {
|
69
|
+
readonly _tag = "Compound";
|
70
|
+
constructor(readonly name: string, readonly errors: Vector<E>) {
|
71
|
+
super();
|
72
|
+
}
|
73
|
+
render = Eval.defer(
|
74
|
+
this.errors
|
75
|
+
.traverse((error) => error.render)
|
76
|
+
.map((errors) =>
|
77
|
+
RoseTree(
|
78
|
+
`${this.errors.length} error(s) found while decoding ${startsWithVowel(this.name) ? "an" : "a"} ${this.name}`,
|
79
|
+
errors,
|
80
|
+
),
|
81
|
+
),
|
82
|
+
);
|
83
|
+
}
|
84
|
+
|
85
|
+
export class CompositionError<E extends DecodeError> extends DecodeError {
|
86
|
+
readonly _tag = "Composition";
|
87
|
+
constructor(readonly errors: Vector<E>) {
|
88
|
+
super();
|
89
|
+
}
|
90
|
+
render = Eval.defer(
|
91
|
+
this.errors
|
92
|
+
.traverse((error) => error.render)
|
93
|
+
.map((errors) =>
|
94
|
+
errors.length === 1
|
95
|
+
? errors.unsafeGet(1)!
|
96
|
+
: RoseTree(`${errors.length} errors found while decoding a composition`, errors),
|
97
|
+
),
|
98
|
+
);
|
99
|
+
}
|
100
|
+
|
101
|
+
export class StringError extends DecodeError {
|
102
|
+
readonly _tag = "String";
|
103
|
+
constructor(readonly actual: unknown) {
|
104
|
+
super();
|
105
|
+
}
|
106
|
+
render = Eval(RoseTree(cannotDecode(this.actual, "a string")));
|
107
|
+
}
|
108
|
+
|
109
|
+
export class NumberError extends DecodeError {
|
110
|
+
readonly _tag = "Number";
|
111
|
+
constructor(readonly actual: unknown) {
|
112
|
+
super();
|
113
|
+
}
|
114
|
+
render = Eval(RoseTree(cannotDecode(this.actual, "a number")));
|
115
|
+
}
|
116
|
+
|
117
|
+
export class NaNError extends DecodeError {
|
118
|
+
readonly _tag = "NaN";
|
119
|
+
render = Eval.now(RoseTree("value is NaN"));
|
120
|
+
}
|
121
|
+
|
122
|
+
export class InfinityError extends DecodeError {
|
123
|
+
readonly _tag = "Infinity";
|
124
|
+
render = Eval(RoseTree("value is Infinity"));
|
125
|
+
}
|
126
|
+
|
127
|
+
export class BooleanError extends DecodeError {
|
128
|
+
readonly _tag = "Boolean";
|
129
|
+
constructor(readonly actual: unknown) {
|
130
|
+
super();
|
131
|
+
}
|
132
|
+
render = Eval(RoseTree(cannotDecode(this.actual, "a boolean")));
|
133
|
+
}
|
134
|
+
|
135
|
+
export class PrimitiveError extends DecodeError {
|
136
|
+
readonly _tag = "Primitive";
|
137
|
+
constructor(readonly actual: unknown, readonly name: string) {
|
138
|
+
super();
|
139
|
+
}
|
140
|
+
render = Eval(RoseTree(cannotDecode(this.actual, this.name)));
|
141
|
+
}
|
142
|
+
|
143
|
+
export class LiteralError<A extends string | number | boolean> extends DecodeError {
|
144
|
+
readonly _tag = "Literal";
|
145
|
+
constructor(readonly actual: unknown, readonly literals: Vector<A>) {
|
146
|
+
super();
|
147
|
+
}
|
148
|
+
render = Eval(
|
149
|
+
RoseTree(cannotDecode(this.actual, `one of ${this.literals.map((literal) => show(literal)).join(", ")}`)),
|
150
|
+
);
|
151
|
+
}
|
152
|
+
|
153
|
+
export class UnexpectedKeysError extends DecodeError {
|
154
|
+
readonly _tag = "UnexpectedKeys";
|
155
|
+
constructor(readonly keys: Vector<string>) {
|
156
|
+
super();
|
157
|
+
}
|
158
|
+
render = Eval(
|
159
|
+
RoseTree(
|
160
|
+
`${this.keys.length} error(s) found while checking keys`,
|
161
|
+
this.keys.map((key) => RoseTree(`unexpected key ${show(key)}`)),
|
162
|
+
),
|
163
|
+
);
|
164
|
+
}
|
165
|
+
|
166
|
+
export class UnexpectedIndicesError extends DecodeError {
|
167
|
+
readonly _tag = "UnexpectedIndices";
|
168
|
+
constructor(readonly indices: Vector<number>) {
|
169
|
+
super();
|
170
|
+
}
|
171
|
+
render = Eval(
|
172
|
+
RoseTree(
|
173
|
+
`${this.indices.length} error(s) found while checking indices`,
|
174
|
+
this.indices.map((index) => RoseTree(`unexpected index ${show(index)}`)),
|
175
|
+
),
|
176
|
+
);
|
177
|
+
}
|
178
|
+
|
179
|
+
export class MissingKeyError extends DecodeError {
|
180
|
+
readonly _tag = "MissingKeys";
|
181
|
+
constructor(readonly key: PropertyKey) {
|
182
|
+
super();
|
183
|
+
}
|
184
|
+
render = Eval(RoseTree(`missing required key ${show(this.key)}`));
|
185
|
+
}
|
186
|
+
|
187
|
+
export class MissingIndicesError extends DecodeError {
|
188
|
+
readonly _tag = "MissingIndices";
|
189
|
+
constructor(readonly keys: Vector<PropertyKey>) {
|
190
|
+
super();
|
191
|
+
}
|
192
|
+
render = Eval(
|
193
|
+
RoseTree(
|
194
|
+
`${this.keys.length} error(s) found while checking indices`,
|
195
|
+
this.keys.map((key) => RoseTree(`missing required index ${show(key)}`)),
|
196
|
+
),
|
197
|
+
);
|
198
|
+
}
|
199
|
+
|
200
|
+
function cannotDecode(u: unknown, expected: string): string {
|
201
|
+
return `cannot decode ${show(u)}, expected ${expected}`;
|
202
|
+
}
|
203
|
+
|
204
|
+
export class BrandedError extends DecodeError {
|
205
|
+
readonly _tag = "BrandedError";
|
206
|
+
constructor(readonly name: string, readonly brands: Vector<string>) {
|
207
|
+
super();
|
208
|
+
}
|
209
|
+
render = Eval(
|
210
|
+
RoseTree(
|
211
|
+
`${this.brands.length} brand(s) failed to be validated while decoding ${this.name}`,
|
212
|
+
this.brands.map((brand) => RoseTree(brand)),
|
213
|
+
),
|
214
|
+
);
|
215
|
+
}
|
216
|
+
|
217
|
+
export class UnionError extends DecodeError {
|
218
|
+
readonly _tag = "UnionError";
|
219
|
+
constructor(readonly label: string, readonly errors: Vector<DecodeError>) {
|
220
|
+
super();
|
221
|
+
}
|
222
|
+
render = Eval.defer(
|
223
|
+
this.errors
|
224
|
+
.traverse((error) => error.render)
|
225
|
+
.map((errors) => RoseTree(`${this.errors.length} error(s) found while decoding ${this.label}`, errors)),
|
226
|
+
);
|
227
|
+
}
|
@@ -0,0 +1,198 @@
|
|
1
|
+
import type { DecodeError } from "@fncts/base/data/DecodeError";
|
2
|
+
import type { Check } from "@fncts/typelevel/Check";
|
3
|
+
import type { OptionalKeys, RequiredKeys } from "@fncts/typelevel/Object";
|
4
|
+
|
5
|
+
import {
|
6
|
+
CompoundError,
|
7
|
+
LiteralError,
|
8
|
+
MemberError,
|
9
|
+
MissingKeyError,
|
10
|
+
OptionalKeyError,
|
11
|
+
PrimitiveError,
|
12
|
+
RequiredKeyError,
|
13
|
+
UnionError,
|
14
|
+
} from "@fncts/base/data/DecodeError";
|
15
|
+
import { Decoder } from "@fncts/base/data/Decoder/definition";
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @tsplus fluent fncts.Decoder __call
|
19
|
+
*/
|
20
|
+
export function decode<I, E, A>(self: Decoder<A>, input: unknown): These<DecodeError, A> {
|
21
|
+
return self.decode(input);
|
22
|
+
}
|
23
|
+
|
24
|
+
export function fromGuard<A>(guard: Guard<A>, onFalse: (i: unknown) => DecodeError, label: string): Decoder<A> {
|
25
|
+
return Decoder((a) => (guard.is(a) ? These.right(a) : These.left(onFalse(a))), label);
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @tsplus implicit
|
30
|
+
*/
|
31
|
+
export const string: Decoder<string> = fromGuard(String.Guard, (u) => new PrimitiveError(u, "string"), "string");
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @tsplus implicit
|
35
|
+
*/
|
36
|
+
export const number: Decoder<number> = fromGuard(Number.Guard, (u) => new PrimitiveError(u, "number"), "number");
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @tsplus implicit
|
40
|
+
*/
|
41
|
+
export const boolean: Decoder<boolean> = fromGuard(Boolean.Guard, (u) => new PrimitiveError(u, "boolean"), "boolean");
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @tsplus implicit
|
45
|
+
*/
|
46
|
+
export const record: Decoder<{}> = fromGuard(Object.Guard, (u) => new PrimitiveError(u, "{}"), "{}");
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @tsplus derive fncts.Decoder lazy
|
50
|
+
*/
|
51
|
+
export function deriveLazy<A>(f: (_: Decoder<A>) => Decoder<A>): Decoder<A> {
|
52
|
+
let cached: Decoder<A> | undefined;
|
53
|
+
const decoder: Decoder<A> = Decoder((u) => {
|
54
|
+
if (!cached) {
|
55
|
+
cached = f(decoder);
|
56
|
+
}
|
57
|
+
return cached.decode(u);
|
58
|
+
}, "[Recursive]");
|
59
|
+
return decoder;
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @tsplus derive fncts.Decoder<_> 20
|
64
|
+
*/
|
65
|
+
export function deriveLiteral<A extends string | number | boolean>(
|
66
|
+
...[value]: Check<Check.IsLiteral<A> & Check.Not<Check.IsUnion<A>>> extends Check.True ? [value: A] : never
|
67
|
+
): Decoder<A> {
|
68
|
+
return Decoder(
|
69
|
+
(u) => (u === value ? These.right(u as A) : These.left(new LiteralError(u, Vector(value)))),
|
70
|
+
value.toString(),
|
71
|
+
);
|
72
|
+
}
|
73
|
+
|
74
|
+
/**
|
75
|
+
* @tsplus derive fncts.Decoder<|> 30
|
76
|
+
*/
|
77
|
+
export function deriveUnion<A extends ReadonlyArray<unknown>>(
|
78
|
+
...elements: {
|
79
|
+
[K in keyof A]: Decoder<A[K]>;
|
80
|
+
}
|
81
|
+
): Decoder<A[number]> {
|
82
|
+
const label = elements.map((decoder) => decoder.label).join(" | ");
|
83
|
+
return Decoder((u) => {
|
84
|
+
const errors: Array<MemberError> = [];
|
85
|
+
for (const decoder of elements) {
|
86
|
+
const result = decoder.decode(u);
|
87
|
+
if (result.isLeft()) {
|
88
|
+
errors.push(new MemberError(decoder.label, result.left));
|
89
|
+
} else {
|
90
|
+
return These.rightOrBoth(result.leftMaybe, result.right);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
return These.left(new UnionError(label, Vector.from(errors)));
|
94
|
+
}, label);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* @tsplus derive fncts.Decoder<_> 10
|
99
|
+
*/
|
100
|
+
export function deriveStruct<A extends Record<string, any>>(
|
101
|
+
...[requiredFields, optionalFields]: Check<Check.IsStruct<A>> extends Check.True
|
102
|
+
? [
|
103
|
+
...[
|
104
|
+
requiredFields: {
|
105
|
+
[k in RequiredKeys<A>]: Decoder<A[k]>;
|
106
|
+
},
|
107
|
+
],
|
108
|
+
...([OptionalKeys<A>] extends [never]
|
109
|
+
? []
|
110
|
+
: [
|
111
|
+
optionalFields: {
|
112
|
+
[k in OptionalKeys<A>]: Decoder<NonNullable<A[k]>>;
|
113
|
+
},
|
114
|
+
]),
|
115
|
+
]
|
116
|
+
: never
|
117
|
+
): Decoder<A> {
|
118
|
+
let label = "{";
|
119
|
+
let first = true;
|
120
|
+
for (const k in requiredFields) {
|
121
|
+
if (first) {
|
122
|
+
label += ` ${k}: ${(requiredFields[k] as Decoder<any>).label}`;
|
123
|
+
} else {
|
124
|
+
label += `, ${k}: ${(requiredFields[k] as Decoder<any>).label}`;
|
125
|
+
}
|
126
|
+
first = false;
|
127
|
+
}
|
128
|
+
if (optionalFields) {
|
129
|
+
for (const k in optionalFields) {
|
130
|
+
if (first) {
|
131
|
+
label += ` ${k}?: ${(optionalFields[k] as Decoder<any>).label}`;
|
132
|
+
} else {
|
133
|
+
label += `, ${k}?: ${(optionalFields[k] as Decoder<any>).label}`;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
if (label.length > 1) {
|
138
|
+
label += " ";
|
139
|
+
}
|
140
|
+
label += "}";
|
141
|
+
|
142
|
+
return Decoder((u) => {
|
143
|
+
const recordResult = record.decode(u);
|
144
|
+
if (recordResult.isLeft()) {
|
145
|
+
return recordResult;
|
146
|
+
}
|
147
|
+
const input = recordResult.right;
|
148
|
+
let errored = false;
|
149
|
+
const errors: Array<RequiredKeyError | OptionalKeyError> = [];
|
150
|
+
const decoded = {} as A;
|
151
|
+
for (const key in requiredFields) {
|
152
|
+
if (!(key in input)) {
|
153
|
+
errors.push(new RequiredKeyError(key, new MissingKeyError(key)));
|
154
|
+
errored = true;
|
155
|
+
} else {
|
156
|
+
const res = (requiredFields[key] as Decoder<any>).decode(input[key]);
|
157
|
+
res.match2(
|
158
|
+
(e) => {
|
159
|
+
errored = true;
|
160
|
+
errors.push(new RequiredKeyError(key, e));
|
161
|
+
},
|
162
|
+
(warning, a) => {
|
163
|
+
decoded[key as keyof A] = a;
|
164
|
+
if (warning.isJust()) {
|
165
|
+
errors.push(new RequiredKeyError(key, warning.value));
|
166
|
+
}
|
167
|
+
},
|
168
|
+
);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
if (optionalFields) {
|
172
|
+
for (const key in optionalFields) {
|
173
|
+
if (key in input && typeof input[key as string] !== "undefined") {
|
174
|
+
const res = (optionalFields[key] as Decoder<any>).decode(input[key as string]);
|
175
|
+
res.match2(
|
176
|
+
(e) => {
|
177
|
+
errored = true;
|
178
|
+
errors.push(new OptionalKeyError(key, e));
|
179
|
+
},
|
180
|
+
(warning, a) => {
|
181
|
+
decoded[key as keyof A] = a;
|
182
|
+
if (warning.isJust()) {
|
183
|
+
errors.push(new RequiredKeyError(key, warning.value));
|
184
|
+
}
|
185
|
+
},
|
186
|
+
);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
if (errored) {
|
191
|
+
return These.left(new CompoundError("struct", Vector.from(errors)));
|
192
|
+
}
|
193
|
+
if (errors.length !== 0) {
|
194
|
+
return These.both(new CompoundError("struct", Vector.from(errors)), decoded);
|
195
|
+
}
|
196
|
+
return These.right(decoded);
|
197
|
+
}, label);
|
198
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { DecodeError } from "@fncts/base/data/DecodeError";
|
2
|
+
|
3
|
+
export const DecoderTypeId = Symbol.for("fncts.Decoder");
|
4
|
+
export type DecoderTypeId = typeof DecoderTypeId;
|
5
|
+
|
6
|
+
export interface DecoderF extends Decoder<any> {}
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @tsplus type fncts.Decoder
|
10
|
+
* @tsplus companion fncts.DecoderOps
|
11
|
+
*/
|
12
|
+
export class Decoder<A> {
|
13
|
+
readonly _typeId: DecoderTypeId = DecoderTypeId;
|
14
|
+
readonly [HKT.F]!: DecoderF;
|
15
|
+
readonly [HKT.A]!: () => A;
|
16
|
+
readonly [HKT.T]!: Decoder<HKT._A<this>>;
|
17
|
+
constructor(readonly decode: (input: unknown) => These<DecodeError, A>, readonly label: string) {}
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @tsplus static fncts.DecoderOps __call
|
22
|
+
*/
|
23
|
+
export function makeDecoder<A>(decode: (input: unknown) => These<DecodeError, A>, label: string): Decoder<A> {
|
24
|
+
return new Decoder(decode, label);
|
25
|
+
}
|
@@ -4,54 +4,54 @@ import type { IsInt } from "@fncts/base/types";
|
|
4
4
|
* @tsplus getter fncts.Number milliseconds
|
5
5
|
* @tsplus static fncts.DurationOps milliseconds
|
6
6
|
*/
|
7
|
-
export function milliseconds
|
8
|
-
return new Duration(self);
|
7
|
+
export function milliseconds(self: number): Duration {
|
8
|
+
return new Duration(Math.round(self));
|
9
9
|
}
|
10
10
|
|
11
11
|
/**
|
12
12
|
* @tsplus getter fncts.Number seconds
|
13
13
|
* @tsplus static fncts.DurationOps seconds
|
14
14
|
*/
|
15
|
-
export function seconds
|
16
|
-
return new Duration(self * 1000);
|
15
|
+
export function seconds(self: number): Duration {
|
16
|
+
return new Duration(Math.round(self * 1000));
|
17
17
|
}
|
18
18
|
|
19
19
|
/**
|
20
20
|
* @tsplus getter fncts.Number minutes
|
21
21
|
* @tsplus static fncts.DurationOps minutes
|
22
22
|
*/
|
23
|
-
export function minutes
|
24
|
-
return new Duration(self * 60_000);
|
23
|
+
export function minutes(self: number): Duration {
|
24
|
+
return new Duration(Math.round(self * 60_000));
|
25
25
|
}
|
26
26
|
|
27
27
|
/**
|
28
28
|
* @tsplus getter fncts.Number hours
|
29
29
|
* @tsplus static fncts.DurationOps hours
|
30
30
|
*/
|
31
|
-
export function hours
|
32
|
-
return new Duration(self * 3_600_000);
|
31
|
+
export function hours(self: number): Duration {
|
32
|
+
return new Duration(Math.round(self * 3_600_000));
|
33
33
|
}
|
34
34
|
|
35
35
|
/**
|
36
36
|
* @tsplus getter fncts.Number days
|
37
37
|
* @tsplus static fncts.DurationOps days
|
38
38
|
*/
|
39
|
-
export function days
|
40
|
-
return new Duration(self * 86_400_000);
|
39
|
+
export function days(self: number): Duration {
|
40
|
+
return new Duration(Math.round(self * 86_400_000));
|
41
41
|
}
|
42
42
|
|
43
43
|
/**
|
44
44
|
* @tsplus operator fncts.Duration *
|
45
45
|
*/
|
46
|
-
export function mult
|
47
|
-
return new Duration(self.milliseconds * multiplicand);
|
46
|
+
export function mult(self: Duration, multiplicand: number) {
|
47
|
+
return new Duration(self.milliseconds * Math.round(multiplicand));
|
48
48
|
}
|
49
49
|
|
50
50
|
/**
|
51
51
|
* @tsplus operator fncts.Duration *
|
52
52
|
*/
|
53
|
-
export function multInverted
|
54
|
-
return new Duration(self.milliseconds * multiplicand);
|
53
|
+
export function multInverted(multiplicand: number, self: Duration) {
|
54
|
+
return new Duration(Math.round(self.milliseconds) * multiplicand);
|
55
55
|
}
|
56
56
|
|
57
57
|
/**
|
@@ -67,3 +67,10 @@ export function sum(self: Duration, that: Duration): Duration {
|
|
67
67
|
export function difference(self: Duration, that: Duration): Duration {
|
68
68
|
return new Duration(self.milliseconds - that.milliseconds);
|
69
69
|
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* @tsplus static fncts.DurationOps fromInterval
|
73
|
+
*/
|
74
|
+
export function fromInterval(start: number, end: number): Duration {
|
75
|
+
return Duration.milliseconds(Math.round(end) - Math.round(start));
|
76
|
+
}
|