@fncts/base 0.0.13 → 0.0.16
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/compat/Array/api.cjs +10 -10
- package/_cjs/collection/compat/Array/derivations.cjs +96 -0
- package/_cjs/collection/compat/Array/derivations.cjs.map +1 -0
- package/_cjs/collection/compat/Array.cjs +13 -0
- package/_cjs/collection/compat/Array.cjs.map +1 -1
- package/_cjs/collection/compat.cjs +6 -0
- package/_cjs/collection/compat.cjs.map +1 -0
- package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/derivations.cjs +45 -0
- package/_cjs/collection/immutable/Conc/derivations.cjs.map +1 -0
- package/_cjs/collection/immutable/Conc.cjs +13 -0
- package/_cjs/collection/immutable/Conc.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +6 -6
- package/_cjs/collection/immutable/ImmutableArray/constructors.cjs +2 -2
- package/_cjs/collection/immutable/ImmutableArray/definition.cjs +9 -4
- package/_cjs/collection/immutable/ImmutableArray/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/derivations.cjs +41 -0
- package/_cjs/collection/immutable/ImmutableArray/derivations.cjs.map +1 -0
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray.cjs +13 -0
- package/_cjs/collection/immutable/ImmutableArray.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/constructors.cjs +2 -2
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/derivations.cjs +62 -0
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/derivations.cjs.map +1 -0
- package/_cjs/collection/immutable/ImmutableNonEmptyArray.cjs +13 -0
- package/_cjs/collection/immutable/ImmutableNonEmptyArray.cjs.map +1 -1
- package/_cjs/collection/immutable/List/definition.cjs +2 -2
- package/_cjs/collection/immutable/Vector/internal.cjs +1 -1
- package/_cjs/collection/immutable.cjs +6 -0
- package/_cjs/collection/immutable.cjs.map +1 -0
- package/_cjs/collection/mutable/HashMap.cjs +4 -0
- package/_cjs/collection/mutable/HashMap.cjs.map +1 -1
- package/_cjs/collection/mutable.cjs +6 -0
- package/_cjs/collection/mutable.cjs.map +1 -0
- package/_cjs/collection/weak.cjs +6 -0
- package/_cjs/collection/weak.cjs.map +1 -0
- package/_cjs/collection.cjs +6 -0
- package/_cjs/collection.cjs.map +1 -0
- package/_cjs/control/Eval/definition.cjs +1 -1
- package/_cjs/control/Eval/definition.cjs.map +1 -1
- package/_cjs/control/Z/api.cjs +9 -9
- package/_cjs/control/Z/api.cjs.map +1 -1
- package/_cjs/control/Z/definition.cjs +0 -1
- package/_cjs/control/Z/definition.cjs.map +1 -1
- package/_cjs/control/Z/runtime.cjs +2 -0
- package/_cjs/control/Z/runtime.cjs.map +1 -1
- package/_cjs/control.cjs +6 -0
- package/_cjs/control.cjs.map +1 -0
- package/_cjs/data/Cause/api/isEmpty.cjs +2 -0
- package/_cjs/data/Cause/api/isEmpty.cjs.map +1 -1
- package/_cjs/data/Cause/api/linearize.cjs +2 -0
- package/_cjs/data/Cause/api/linearize.cjs.map +1 -1
- package/_cjs/data/Cause/api.cjs +2 -0
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/Const/instances.cjs +4 -3
- package/_cjs/data/Const/instances.cjs.map +1 -1
- package/_cjs/data/DecodeError/definition.cjs +13 -1
- package/_cjs/data/DecodeError/definition.cjs.map +1 -1
- package/_cjs/data/DecodeError/instances.cjs +6 -0
- package/_cjs/data/DecodeError/instances.cjs.map +1 -0
- package/_cjs/data/DecodeError.cjs +13 -0
- package/_cjs/data/DecodeError.cjs.map +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/definition.cjs +1 -1
- package/_cjs/data/Either/definition.cjs.map +1 -1
- package/_cjs/data/Environment/api.cjs +15 -25
- package/_cjs/data/Environment/api.cjs.map +1 -1
- package/_cjs/data/Environment/definition.cjs +1 -2
- package/_cjs/data/Environment/definition.cjs.map +1 -1
- package/_cjs/data/Intervals.cjs +2 -2
- package/_cjs/data/Intervals.cjs.map +1 -1
- package/_cjs/data/Patch/api.cjs +5 -3
- package/_cjs/data/Patch/api.cjs.map +1 -1
- package/_cjs/data/Struct/api.cjs +2 -0
- package/_cjs/data/Struct/api.cjs.map +1 -1
- package/_cjs/data/Tag/constructors.cjs +2 -2
- package/_cjs/data/Tag/constructors.cjs.map +1 -1
- package/_cjs/data/Tag/definition.cjs +3 -3
- package/_cjs/data/Tag/definition.cjs.map +1 -1
- package/_cjs/data/These/definition.cjs +1 -1
- package/_cjs/data/These/definition.cjs.map +1 -1
- package/_cjs/data/string/api.cjs +1 -1
- package/_cjs/data.cjs +6 -0
- package/_cjs/data.cjs.map +1 -0
- package/_cjs/global.cjs +6 -0
- package/_cjs/global.cjs.map +1 -0
- package/_cjs/index.cjs +6 -0
- package/_cjs/index.cjs.map +1 -0
- package/_cjs/json.cjs +6 -0
- package/_cjs/json.cjs.map +1 -0
- package/_cjs/optics/At/definition.cjs +2 -0
- package/_cjs/optics/At/definition.cjs.map +1 -1
- package/_cjs/optics/Iso/definition.cjs +4 -0
- package/_cjs/optics/Iso/definition.cjs.map +1 -1
- package/_cjs/optics/Lens/definition.cjs +4 -0
- package/_cjs/optics/Lens/definition.cjs.map +1 -1
- package/_cjs/optics/Optional/definition.cjs +2 -0
- package/_cjs/optics/Optional/definition.cjs.map +1 -1
- package/_cjs/optics/Prism/definition.cjs +2 -0
- package/_cjs/optics/Prism/definition.cjs.map +1 -1
- package/_cjs/optics/Traversal/definition.cjs +4 -0
- package/_cjs/optics/Traversal/definition.cjs.map +1 -1
- package/_cjs/optics.cjs +6 -0
- package/_cjs/optics.cjs.map +1 -0
- package/_cjs/typeclass/HashEq.cjs +2 -0
- package/_cjs/typeclass/HashEq.cjs.map +1 -1
- package/_cjs/typeclass/Monoid.cjs +2 -0
- package/_cjs/typeclass/Monoid.cjs.map +1 -1
- package/_cjs/typeclass/Ord/definition.cjs +2 -0
- package/_cjs/typeclass/Ord/definition.cjs.map +1 -1
- package/_cjs/typeclass/Ord/instances.cjs +4 -3
- package/_cjs/typeclass/Ord/instances.cjs.map +1 -1
- package/_cjs/typeclass/Showable/show.cjs.map +1 -1
- package/_cjs/util.cjs +6 -0
- package/_cjs/util.cjs.map +1 -0
- package/_mjs/collection/compat/Array/api.mjs +10 -10
- package/_mjs/collection/compat/Array/derivations.mjs +70 -0
- package/_mjs/collection/compat/Array/derivations.mjs.map +1 -0
- package/_mjs/collection/compat/Array.mjs +1 -0
- package/_mjs/collection/compat/Array.mjs.map +1 -1
- package/_mjs/collection/compat.mjs +2 -0
- package/_mjs/collection/compat.mjs.map +1 -0
- package/_mjs/collection/immutable/Conc/api.mjs +1 -0
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/derivations.mjs +27 -0
- package/_mjs/collection/immutable/Conc/derivations.mjs.map +1 -0
- package/_mjs/collection/immutable/Conc.mjs +2 -1
- package/_mjs/collection/immutable/Conc.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/api.mjs +1 -0
- package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +6 -6
- package/_mjs/collection/immutable/ImmutableArray/constructors.mjs +2 -2
- package/_mjs/collection/immutable/ImmutableArray/definition.mjs +7 -2
- package/_mjs/collection/immutable/ImmutableArray/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/derivations.mjs +25 -0
- package/_mjs/collection/immutable/ImmutableArray/derivations.mjs.map +1 -0
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray.mjs +1 -0
- package/_mjs/collection/immutable/ImmutableArray.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs +1 -0
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/constructors.mjs +2 -2
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/derivations.mjs +39 -0
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/derivations.mjs.map +1 -0
- package/_mjs/collection/immutable/ImmutableNonEmptyArray.mjs +1 -0
- package/_mjs/collection/immutable/ImmutableNonEmptyArray.mjs.map +1 -1
- package/_mjs/collection/immutable/List/definition.mjs +2 -2
- package/_mjs/collection/immutable/SortedMap/api.mjs +1 -0
- package/_mjs/collection/immutable/SortedMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/internal.mjs +1 -1
- package/_mjs/collection/immutable.mjs +2 -0
- package/_mjs/collection/immutable.mjs.map +1 -0
- package/_mjs/collection/mutable/HashMap.mjs +4 -0
- package/_mjs/collection/mutable/HashMap.mjs.map +1 -1
- package/_mjs/collection/mutable.mjs +2 -0
- package/_mjs/collection/mutable.mjs.map +1 -0
- package/_mjs/collection/weak.mjs +2 -0
- package/_mjs/collection/weak.mjs.map +1 -0
- package/_mjs/collection.mjs +2 -0
- package/_mjs/collection.mjs.map +1 -0
- package/_mjs/control/Eval/definition.mjs +1 -1
- package/_mjs/control/Eval/definition.mjs.map +1 -1
- package/_mjs/control/Eval/run.mjs +1 -0
- package/_mjs/control/Eval/run.mjs.map +1 -1
- package/_mjs/control/Z/api.mjs +9 -9
- package/_mjs/control/Z/api.mjs.map +1 -1
- package/_mjs/control/Z/definition.mjs +0 -1
- package/_mjs/control/Z/definition.mjs.map +1 -1
- package/_mjs/control/Z/runtime.mjs +1 -0
- package/_mjs/control/Z/runtime.mjs.map +1 -1
- package/_mjs/control.mjs +2 -0
- package/_mjs/control.mjs.map +1 -0
- package/_mjs/data/Branded/derivations.mjs +1 -0
- package/_mjs/data/Branded/derivations.mjs.map +1 -1
- package/_mjs/data/Cause/api/isEmpty.mjs +1 -0
- package/_mjs/data/Cause/api/isEmpty.mjs.map +1 -1
- package/_mjs/data/Cause/api/linearize.mjs +1 -0
- package/_mjs/data/Cause/api/linearize.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +2 -1
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/Const/instances.mjs +1 -0
- package/_mjs/data/Const/instances.mjs.map +1 -1
- package/_mjs/data/Datum/api.mjs +1 -0
- package/_mjs/data/Datum/api.mjs.map +1 -1
- package/_mjs/data/DecodeError/definition.mjs +9 -0
- package/_mjs/data/DecodeError/definition.mjs.map +1 -1
- package/_mjs/data/DecodeError/instances.mjs +2 -0
- package/_mjs/data/DecodeError/instances.mjs.map +1 -0
- package/_mjs/data/DecodeError.mjs +1 -0
- package/_mjs/data/DecodeError.mjs.map +1 -1
- package/_mjs/data/Decoder/api.mjs +1 -0
- package/_mjs/data/Decoder/api.mjs.map +1 -1
- package/_mjs/data/Either/api/alignWith.mjs +1 -0
- package/_mjs/data/Either/api/alignWith.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +1 -1
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/definition.mjs +1 -1
- package/_mjs/data/Either/definition.mjs.map +1 -1
- package/_mjs/data/Either/instances.mjs +1 -1
- package/_mjs/data/Either/instances.mjs.map +1 -1
- package/_mjs/data/Environment/api.mjs +12 -21
- package/_mjs/data/Environment/api.mjs.map +1 -1
- package/_mjs/data/Environment/definition.mjs +1 -2
- package/_mjs/data/Environment/definition.mjs.map +1 -1
- package/_mjs/data/Intervals.mjs +2 -2
- package/_mjs/data/Intervals.mjs.map +1 -1
- package/_mjs/data/Patch/api.mjs +4 -3
- package/_mjs/data/Patch/api.mjs.map +1 -1
- package/_mjs/data/Struct/api.mjs +1 -0
- package/_mjs/data/Struct/api.mjs.map +1 -1
- package/_mjs/data/Tag/constructors.mjs +2 -2
- package/_mjs/data/Tag/constructors.mjs.map +1 -1
- package/_mjs/data/Tag/definition.mjs +3 -3
- package/_mjs/data/Tag/definition.mjs.map +1 -1
- package/_mjs/data/These/definition.mjs +1 -1
- package/_mjs/data/These/definition.mjs.map +1 -1
- package/_mjs/data/string/api.mjs +1 -1
- package/_mjs/data.mjs +2 -0
- package/_mjs/data.mjs.map +1 -0
- package/_mjs/global.mjs +2 -0
- package/_mjs/global.mjs.map +1 -0
- package/_mjs/index.mjs +2 -0
- package/_mjs/index.mjs.map +1 -0
- package/_mjs/json.mjs +2 -0
- package/_mjs/json.mjs.map +1 -0
- package/_mjs/optics/At/api.mjs +1 -0
- package/_mjs/optics/At/api.mjs.map +1 -1
- package/_mjs/optics/At/definition.mjs +1 -0
- package/_mjs/optics/At/definition.mjs.map +1 -1
- package/_mjs/optics/Index/api.mjs +1 -0
- package/_mjs/optics/Index/api.mjs.map +1 -1
- package/_mjs/optics/Iso/api.mjs +1 -0
- package/_mjs/optics/Iso/api.mjs.map +1 -1
- package/_mjs/optics/Iso/definition.mjs +2 -0
- package/_mjs/optics/Iso/definition.mjs.map +1 -1
- package/_mjs/optics/Lens/api.mjs +1 -0
- package/_mjs/optics/Lens/api.mjs.map +1 -1
- package/_mjs/optics/Lens/definition.mjs +2 -0
- package/_mjs/optics/Lens/definition.mjs.map +1 -1
- package/_mjs/optics/Optional/api/compose.mjs +1 -0
- package/_mjs/optics/Optional/api/compose.mjs.map +1 -1
- package/_mjs/optics/Optional/definition.mjs +1 -0
- package/_mjs/optics/Optional/definition.mjs.map +1 -1
- package/_mjs/optics/Prism/api/compose.mjs +1 -0
- package/_mjs/optics/Prism/api/compose.mjs.map +1 -1
- package/_mjs/optics/Prism/api/fromNullable.mjs +1 -0
- package/_mjs/optics/Prism/api/fromNullable.mjs.map +1 -1
- package/_mjs/optics/Prism/api/just.mjs +1 -0
- package/_mjs/optics/Prism/api/just.mjs.map +1 -1
- package/_mjs/optics/Prism/definition.mjs +1 -0
- package/_mjs/optics/Prism/definition.mjs.map +1 -1
- package/_mjs/optics/Traversal/api/compose.mjs +1 -0
- package/_mjs/optics/Traversal/api/compose.mjs.map +1 -1
- package/_mjs/optics/Traversal/api/fromTraversable.mjs +1 -0
- package/_mjs/optics/Traversal/api/fromTraversable.mjs.map +1 -1
- package/_mjs/optics/Traversal/definition.mjs +2 -0
- package/_mjs/optics/Traversal/definition.mjs.map +1 -1
- package/_mjs/optics.mjs +2 -0
- package/_mjs/optics.mjs.map +1 -0
- package/_mjs/typeclass/Eq/derivations.mjs +1 -0
- package/_mjs/typeclass/Eq/derivations.mjs.map +1 -1
- package/_mjs/typeclass/Guard/api.mjs +1 -0
- package/_mjs/typeclass/Guard/api.mjs.map +1 -1
- package/_mjs/typeclass/HashEq.mjs +1 -0
- package/_mjs/typeclass/HashEq.mjs.map +1 -1
- package/_mjs/typeclass/Monoid.mjs +1 -0
- package/_mjs/typeclass/Monoid.mjs.map +1 -1
- package/_mjs/typeclass/Ord/definition.mjs +1 -0
- package/_mjs/typeclass/Ord/definition.mjs.map +1 -1
- package/_mjs/typeclass/Ord/instances.mjs +3 -0
- package/_mjs/typeclass/Ord/instances.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/api.mjs +1 -0
- package/_mjs/typeclass/Semigroup/api.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/derivations.mjs +1 -0
- package/_mjs/typeclass/Semigroup/derivations.mjs.map +1 -1
- package/_mjs/typeclass/Showable/show.mjs.map +1 -1
- package/_mjs/util.mjs +2 -0
- package/_mjs/util.mjs.map +1 -0
- package/_src/collection/compat/Array/api.ts +10 -10
- package/_src/collection/compat/Array/definition.ts +3 -3
- package/_src/collection/compat/Array/derivations.ts +85 -0
- package/_src/collection/compat/Array.ts +1 -0
- package/_src/collection/compat/Record/instances.ts +0 -1
- package/_src/collection/compat.ts +4 -0
- package/_src/collection/immutable/Conc/definition.ts +11 -10
- package/_src/collection/immutable/Conc/derivations.ts +28 -0
- package/_src/collection/immutable/Conc.ts +1 -0
- package/_src/collection/immutable/ImmutableArray/api.ts +6 -6
- package/_src/collection/immutable/ImmutableArray/constructors.ts +2 -2
- package/_src/collection/immutable/ImmutableArray/definition.ts +3 -0
- package/_src/collection/immutable/ImmutableArray/derivations.ts +28 -0
- package/_src/collection/immutable/ImmutableArray/instances.ts +5 -0
- package/_src/collection/immutable/ImmutableArray.ts +1 -0
- package/_src/collection/immutable/ImmutableNonEmptyArray/constructors.ts +2 -2
- package/_src/collection/immutable/ImmutableNonEmptyArray/definition.ts +2 -2
- package/_src/collection/immutable/ImmutableNonEmptyArray/derivations.ts +44 -0
- package/_src/collection/immutable/ImmutableNonEmptyArray.ts +1 -0
- package/_src/collection/immutable/List/definition.ts +2 -2
- package/_src/collection/immutable/Vector/definition.ts +1 -1
- package/_src/collection/immutable/Vector/internal.ts +1 -1
- package/_src/collection/immutable.ts +12 -0
- package/_src/collection/mutable/HashMap.ts +4 -0
- package/_src/collection/mutable.ts +6 -0
- package/_src/collection/weak.ts +4 -0
- package/_src/collection.ts +7 -0
- package/_src/control/Eval/definition.ts +1 -1
- package/_src/control/Z/api.ts +24 -27
- package/_src/control/Z/definition.ts +6 -7
- package/_src/control/Z/runtime.ts +4 -4
- package/_src/control.ts +5 -0
- package/_src/data/DecodeError/definition.ts +8 -0
- package/_src/data/DecodeError/instances.ts +0 -0
- package/_src/data/DecodeError.ts +1 -0
- package/_src/data/Either/definition.ts +1 -1
- package/_src/data/Environment/api.ts +8 -14
- package/_src/data/Environment/definition.ts +1 -2
- package/_src/data/Maybe/definition.ts +2 -2
- package/_src/data/Patch/api.ts +4 -4
- package/_src/data/Tag/constructors.ts +2 -2
- package/_src/data/Tag/definition.ts +3 -2
- package/_src/data/These/definition.ts +1 -1
- package/_src/data/string/api.ts +1 -1
- package/_src/data.ts +35 -0
- package/_src/global.ts +252 -0
- package/_src/index.ts +8 -0
- package/_src/json.ts +5 -0
- package/_src/optics.ts +12 -0
- package/_src/typeclass/Showable/show.ts +2 -2
- package/_src/util.ts +8 -0
- package/collection/compat/Array/api.d.ts +10 -10
- package/collection/compat/Array/definition.d.ts +3 -3
- package/collection/compat/Array/derivations.d.ts +24 -0
- package/collection/compat/Array.d.ts +1 -0
- package/collection/compat.d.ts +2 -0
- package/collection/immutable/Conc/definition.d.ts +17 -16
- package/collection/immutable/Conc/derivations.d.ts +14 -0
- package/collection/immutable/Conc.d.ts +1 -0
- package/collection/immutable/ImmutableArray/api.d.ts +6 -6
- package/collection/immutable/ImmutableArray/constructors.d.ts +2 -2
- package/collection/immutable/ImmutableArray/definition.d.ts +4 -0
- package/collection/immutable/ImmutableArray/derivations.d.ts +14 -0
- package/collection/immutable/ImmutableArray.d.ts +1 -0
- package/collection/immutable/ImmutableNonEmptyArray/constructors.d.ts +2 -2
- package/collection/immutable/ImmutableNonEmptyArray/definition.d.ts +2 -2
- package/collection/immutable/ImmutableNonEmptyArray/derivations.d.ts +14 -0
- package/collection/immutable/ImmutableNonEmptyArray.d.ts +1 -0
- package/collection/immutable/List/definition.d.ts +2 -2
- package/collection/immutable/Vector/definition.d.ts +1 -1
- package/collection/immutable/Vector/internal.d.ts +1 -1
- package/collection/immutable.d.ts +10 -0
- package/collection/mutable/HashMap.d.ts +1 -0
- package/collection/mutable.d.ts +4 -0
- package/collection/weak.d.ts +2 -0
- package/collection.d.ts +5 -0
- package/control/Z/api.d.ts +24 -24
- package/control/Z/definition.d.ts +6 -6
- package/control/Z/runtime.d.ts +4 -4
- package/control.d.ts +3 -0
- package/data/DecodeError/definition.d.ts +6 -0
- package/data/DecodeError/instances.d.ts +1 -0
- package/data/DecodeError.d.ts +1 -0
- package/data/Environment/definition.d.ts +2 -3
- package/data/Maybe/definition.d.ts +4 -2
- package/data/Tag/constructors.d.ts +1 -1
- package/data/Tag/definition.d.ts +2 -1
- package/data/string/api.d.ts +1 -1
- package/data.d.ts +33 -0
- package/global.d.ts +237 -0
- package/index.d.ts +8 -0
- package/json.d.ts +3 -0
- package/optics.d.ts +10 -0
- package/package.json +6 -2
- package/typeclass/Showable/show.d.ts +1 -1
- package/util.d.ts +6 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Check } from "@fncts/typelevel/Check";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus derive fncts.Guard[fncts.ImmutableArray]<_> 10
|
|
5
|
+
*/
|
|
6
|
+
export function deriveGuard<A extends ImmutableArray<any>>(
|
|
7
|
+
...[element]: [A] extends [ImmutableArray<infer A>] ? [element: Guard<A>] : never
|
|
8
|
+
): Guard<A> {
|
|
9
|
+
return Guard((u): u is A => {
|
|
10
|
+
if (ImmutableArray.is(u)) {
|
|
11
|
+
return u._array.every(element.is);
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @tsplus derive fncts.Decoder[fncts.ImmutableArray]<_> 10
|
|
19
|
+
*/
|
|
20
|
+
export function deriveDecoder<A extends ImmutableArray<any>>(
|
|
21
|
+
...[array, elem]: [A] extends [ImmutableArray<infer _A>]
|
|
22
|
+
? Check<Check.IsEqual<A, ImmutableArray<_A>>> extends Check.True
|
|
23
|
+
? [array: Decoder<Array<_A>>, elem: Decoder<_A>]
|
|
24
|
+
: never
|
|
25
|
+
: never
|
|
26
|
+
): Decoder<A> {
|
|
27
|
+
return Decoder((u) => array.decode(u).map((as) => new ImmutableArray(as) as A), `ImmutableArray<${elem.label}>`);
|
|
28
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ImmutableArrayF } from "@fncts/base/collection/immutable/ImmutableArray/definition";
|
|
2
|
+
import type { DecodeError } from "@fncts/base/data/DecodeError";
|
|
2
3
|
import type * as P from "@fncts/base/typeclass";
|
|
4
|
+
import type { Check } from "@fncts/typelevel/Check";
|
|
3
5
|
|
|
4
6
|
import {
|
|
5
7
|
alignWith_,
|
|
@@ -29,6 +31,9 @@ import {
|
|
|
29
31
|
witherWithIndex,
|
|
30
32
|
} from "@fncts/base/collection/immutable/ImmutableArray/api";
|
|
31
33
|
import { empty } from "@fncts/base/collection/immutable/ImmutableArray/constructors";
|
|
34
|
+
import { isImmutableArray } from "@fncts/base/collection/immutable/ImmutableArray/definition";
|
|
35
|
+
import { CompoundError, OptionalIndexError, PrimitiveError } from "@fncts/base/data/DecodeError";
|
|
36
|
+
import { Decoder } from "@fncts/base/data/Decoder";
|
|
32
37
|
|
|
33
38
|
/**
|
|
34
39
|
* @tsplus implicit
|
|
@@ -7,8 +7,8 @@ export function allocWithHead<A>(head: A, length: number): Array<A> & { 0: A } {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @tsplus getter fncts.
|
|
11
|
-
* @tsplus getter fncts.
|
|
10
|
+
* @tsplus getter fncts.ReadonlyArray unsafeAsNonEmptyArray
|
|
11
|
+
* @tsplus getter fncts.Array unsafeAsNonEmptyArray
|
|
12
12
|
*/
|
|
13
13
|
export function unsafeAsNonEmptyArray<A>(self: ReadonlyArray<A>): ImmutableNonEmptyArray<A> {
|
|
14
14
|
if (self.length === 0) {
|
|
@@ -20,14 +20,14 @@ export class ImmutableNonEmptyArray<A> extends ImmutableArray<A> {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @tsplus type fncts.
|
|
23
|
+
* @tsplus type fncts.NonEmptyArray
|
|
24
24
|
*/
|
|
25
25
|
export interface NonEmptyArray<T> extends Array<T> {
|
|
26
26
|
0: T;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* @tsplus type fncts.
|
|
30
|
+
* @tsplus type fncts.ReadonlyNonEmptyArray
|
|
31
31
|
*/
|
|
32
32
|
export interface ReadonlyNonEmptyArray<T> extends ReadonlyArray<T> {
|
|
33
33
|
readonly 0: T;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Check } from "@fncts/typelevel/Check";
|
|
2
|
+
|
|
3
|
+
import { CompoundError, EmptyError } from "@fncts/base/data/DecodeError";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @tsplus derive fncts.Guard[fncts.ImmutableNonEmptyArray]<_> 10
|
|
7
|
+
*/
|
|
8
|
+
export function deriveGuard<A extends ImmutableNonEmptyArray<any>>(
|
|
9
|
+
...[elem]: [A] extends [ImmutableNonEmptyArray<infer _A>] ? [elem: Guard<_A>] : never
|
|
10
|
+
): Guard<A> {
|
|
11
|
+
return Guard((u): u is A => {
|
|
12
|
+
if (ImmutableNonEmptyArray.is(u)) {
|
|
13
|
+
return u.every(elem.is);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @tsplus derive fncts.Decoder[fncts.ImmutableNonEmptyArray]<_> 10
|
|
21
|
+
*/
|
|
22
|
+
export function deriveDecoder<A extends ImmutableNonEmptyArray<any>>(
|
|
23
|
+
...[array, elem]: [A] extends [ImmutableNonEmptyArray<infer _A>]
|
|
24
|
+
? Check<Check.IsEqual<A, ImmutableNonEmptyArray<_A>>> extends Check.True
|
|
25
|
+
? [array: Decoder<Array<_A>>, elem: Decoder<_A>]
|
|
26
|
+
: never
|
|
27
|
+
: never
|
|
28
|
+
): Decoder<A> {
|
|
29
|
+
return Decoder(
|
|
30
|
+
(u) =>
|
|
31
|
+
array.decode(u).match2(These.left, (warn, as) => {
|
|
32
|
+
if (as.isNonEmpty()) {
|
|
33
|
+
return These.right(new ImmutableNonEmptyArray(as) as A);
|
|
34
|
+
} else {
|
|
35
|
+
const err = new EmptyError(as);
|
|
36
|
+
return warn.match(
|
|
37
|
+
() => These.left(err),
|
|
38
|
+
(err0) => These.left(new CompoundError(`ImmutableNonEmptyArray<${elem.label}>`, Vector(err0, err))),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
`ImmutableNonEmptyArray<${elem.label}>`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export * from "./ImmutableNonEmptyArray/api.js";
|
|
3
3
|
export * from "./ImmutableNonEmptyArray/constructors.js";
|
|
4
4
|
export * from "./ImmutableNonEmptyArray/definition.js";
|
|
5
|
+
export * from "./ImmutableNonEmptyArray/derivations.js";
|
|
5
6
|
export * from "./ImmutableNonEmptyArray/destructors.js";
|
|
6
7
|
export * from "./ImmutableNonEmptyArray/instances.js";
|
|
7
8
|
// codegen:end
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* @tsplus type fncts.
|
|
16
|
+
* @tsplus type fncts.List.Cons
|
|
17
17
|
* @tsplus companion fncts.ConsOps
|
|
18
18
|
*/
|
|
19
19
|
export class Cons<A> implements Iterable<A> {
|
|
@@ -48,7 +48,7 @@ export class Cons<A> implements Iterable<A> {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* @tsplus type fncts.
|
|
51
|
+
* @tsplus type fncts.List.Nil
|
|
52
52
|
* @tsplus companion fncts.NilOps
|
|
53
53
|
*/
|
|
54
54
|
export class Nil<A> implements Iterable<A> {
|
|
@@ -357,7 +357,7 @@ export function decrementDepth(bits: number): number {
|
|
|
357
357
|
/**
|
|
358
358
|
* Appends the value to the Vector by _mutating_ the Vector and its content.
|
|
359
359
|
*
|
|
360
|
-
* @tsplus fluent fncts.
|
|
360
|
+
* @tsplus fluent fncts.MutableVector push
|
|
361
361
|
*/
|
|
362
362
|
export function push<A>(l: MutableVector<A>, value: A): MutableVector<A> {
|
|
363
363
|
const suffixSize = getSuffixSize(l);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// codegen:start { preset: type-barrel, include: ./immutable/*.ts }
|
|
2
|
+
export type {} from "./immutable/Conc.js";
|
|
3
|
+
export type {} from "./immutable/HashMap.js";
|
|
4
|
+
export type {} from "./immutable/HashSet.js";
|
|
5
|
+
export type {} from "./immutable/ImmutableArray.js";
|
|
6
|
+
export type {} from "./immutable/ImmutableNonEmptyArray.js";
|
|
7
|
+
export type {} from "./immutable/List.js";
|
|
8
|
+
export type {} from "./immutable/Queue.js";
|
|
9
|
+
export type {} from "./immutable/RoseTree.js";
|
|
10
|
+
export type {} from "./immutable/SortedMap.js";
|
|
11
|
+
export type {} from "./immutable/Vector.js";
|
|
12
|
+
// codegen:end
|
|
@@ -56,6 +56,10 @@ export class HashMap<K, V> implements Iterable<readonly [K, V]> {
|
|
|
56
56
|
return this.findNode(key) !== undefined;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
unsafeGet(key: K): V | undefined {
|
|
60
|
+
return this.findNode(key)?.value;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
get(key: K): Maybe<V> {
|
|
60
64
|
const n = this.findNode(key);
|
|
61
65
|
return n ? Just(n.value) : Nothing();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// codegen:start { preset: type-barrel, include: ./mutable/*.ts }
|
|
2
|
+
export type {} from "./mutable/HashMap.js";
|
|
3
|
+
export type {} from "./mutable/HashSet.js";
|
|
4
|
+
export type {} from "./mutable/internal.js";
|
|
5
|
+
export type {} from "./mutable/ListBuffer.js";
|
|
6
|
+
// codegen:end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// codegen:start { preset: type-barrel, include: ./collection/*.ts }
|
|
2
|
+
export type {} from "./collection/compat.js";
|
|
3
|
+
export type {} from "./collection/immutable.js";
|
|
4
|
+
export type {} from "./collection/Iterable.js";
|
|
5
|
+
export type {} from "./collection/mutable.js";
|
|
6
|
+
export type {} from "./collection/weak.js";
|
|
7
|
+
// codegen:end
|
package/_src/control/Z/api.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function bimap_<W, S1, S2, R, E, A, G, B>(
|
|
|
60
60
|
export function catchAll_<W, S1, S2, R, E, A, S3, R1, E1, B>(
|
|
61
61
|
fa: Z<W, S1, S2, R, E, A>,
|
|
62
62
|
onFailure: (e: E) => Z<W, S1, S3, R1, E1, B>,
|
|
63
|
-
): Z<W, S1, S3, R
|
|
63
|
+
): Z<W, S1, S3, R | R1, E1, A | B> {
|
|
64
64
|
return fa.matchZ(onFailure, Z.succeedNow);
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -70,7 +70,7 @@ export function catchAll_<W, S1, S2, R, E, A, S3, R1, E1, B>(
|
|
|
70
70
|
export function catchJust_<W, S1, S2, R, E, A, S3, R1, E1, B>(
|
|
71
71
|
fa: Z<W, S1, S2, R, E, A>,
|
|
72
72
|
f: (e: E) => Maybe<Z<W, S1, S3, R1, E1, B>>,
|
|
73
|
-
): Z<W, S1, S2 | S3, R
|
|
73
|
+
): Z<W, S1, S2 | S3, R | R1, E | E1, A | B> {
|
|
74
74
|
return fa.catchAll((e) => f(e).getOrElse(fa));
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -184,31 +184,28 @@ export function erase<W, S1, S2, R, E, A>(wa: Z<W, S1, S2, R, E, A>): Z<never, S
|
|
|
184
184
|
/**
|
|
185
185
|
* @tsplus static fncts.control.ZOps fail
|
|
186
186
|
*/
|
|
187
|
-
export function fail<E>(e: Lazy<E>, __tsplusTrace?: string): Z<never, unknown, never,
|
|
187
|
+
export function fail<E>(e: Lazy<E>, __tsplusTrace?: string): Z<never, unknown, never, never, E, never> {
|
|
188
188
|
return Z.failCause(Cause.fail(e()));
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
192
|
* @tsplus static fncts.control.ZOps failNow
|
|
193
193
|
*/
|
|
194
|
-
export function failNow<E>(e: E, __tsplusTrace?: string): Z<never, unknown, never,
|
|
194
|
+
export function failNow<E>(e: E, __tsplusTrace?: string): Z<never, unknown, never, never, E, never> {
|
|
195
195
|
return Z.failCauseNow(Cause.fail(e));
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* @tsplus static fncts.control.ZOps failCause
|
|
200
200
|
*/
|
|
201
|
-
export function failCause<E>(
|
|
202
|
-
cause: Lazy<Cause<E>>,
|
|
203
|
-
__tsplusTrace?: string,
|
|
204
|
-
): Z<never, unknown, never, unknown, E, never> {
|
|
201
|
+
export function failCause<E>(cause: Lazy<Cause<E>>, __tsplusTrace?: string): Z<never, unknown, never, never, E, never> {
|
|
205
202
|
return Z.defer(Z.failCauseNow(cause()));
|
|
206
203
|
}
|
|
207
204
|
|
|
208
205
|
/**
|
|
209
206
|
* @tsplus static fncts.control.ZOps failCauseNow
|
|
210
207
|
*/
|
|
211
|
-
export function failCauseNow<E>(cause: Cause<E>, __tsplusTrace?: string): Z<never, unknown, never,
|
|
208
|
+
export function failCauseNow<E>(cause: Cause<E>, __tsplusTrace?: string): Z<never, unknown, never, never, E, never> {
|
|
212
209
|
return new Fail(cause);
|
|
213
210
|
}
|
|
214
211
|
|
|
@@ -226,14 +223,14 @@ export function flatten<W, S1, S2, R, E, A, W1, S3, R1, E1>(
|
|
|
226
223
|
*
|
|
227
224
|
* @tsplus static fncts.control.ZOps get
|
|
228
225
|
*/
|
|
229
|
-
export function get<S>(): Z<never, S, S,
|
|
226
|
+
export function get<S>(): Z<never, S, S, never, never, S> {
|
|
230
227
|
return Z.modify((s) => [s, s]);
|
|
231
228
|
}
|
|
232
229
|
|
|
233
230
|
/**
|
|
234
231
|
* @tsplus static fncts.control.ZOps gets
|
|
235
232
|
*/
|
|
236
|
-
export function gets<S, A>(f: (s: S) => A): Z<never, S, S,
|
|
233
|
+
export function gets<S, A>(f: (s: S) => A): Z<never, S, S, never, never, A> {
|
|
237
234
|
return Z.modify((s) => [f(s), s]);
|
|
238
235
|
}
|
|
239
236
|
|
|
@@ -247,14 +244,14 @@ export function getsZ<S, W, R, E, A>(f: (s: S) => Z<W, S, S, R, E, A>): Z<W, S,
|
|
|
247
244
|
/**
|
|
248
245
|
* @tsplus static fncts.control.ZOps halt
|
|
249
246
|
*/
|
|
250
|
-
export function halt(defect: Lazy<unknown>, __tsplusTrace?: string): Z<never, unknown, never,
|
|
247
|
+
export function halt(defect: Lazy<unknown>, __tsplusTrace?: string): Z<never, unknown, never, never, never, never> {
|
|
251
248
|
return Z.failCause(Cause.halt(defect()));
|
|
252
249
|
}
|
|
253
250
|
|
|
254
251
|
/**
|
|
255
252
|
* @tsplus static fncts.control.ZOps haltNow
|
|
256
253
|
*/
|
|
257
|
-
export function haltNow(defect: unknown, __tsplusTrace?: string): Z<never, unknown, never,
|
|
254
|
+
export function haltNow(defect: unknown, __tsplusTrace?: string): Z<never, unknown, never, never, never, never> {
|
|
258
255
|
return Z.failCauseNow(Cause.halt(defect));
|
|
259
256
|
}
|
|
260
257
|
|
|
@@ -341,7 +338,7 @@ export function matchZ_<W, S1, S5, S2, R, E, A, W1, S3, R1, E1, B, W2, S4, R2, E
|
|
|
341
338
|
fa: Z<W, S1, S2, R, E, A>,
|
|
342
339
|
onFailure: (e: E) => Z<W1, S5, S3, R1, E1, B>,
|
|
343
340
|
onSuccess: (a: A) => Z<W2, S2, S4, R2, E2, C>,
|
|
344
|
-
): Z<W | W1 | W2, S1 & S5, S3 | S4, R
|
|
341
|
+
): Z<W | W1 | W2, S1 & S5, S3 | S4, R | R1 | R2, E1 | E2, B | C> {
|
|
345
342
|
return fa.matchCauseZ((cause) => cause.failureOrCause.match(onFailure, Z.failCauseNow), onSuccess);
|
|
346
343
|
}
|
|
347
344
|
|
|
@@ -352,7 +349,7 @@ export function matchCauseZ_<W, S1, S2, R, E, A, W1, S0, S3, R1, E1, B, W2, S4,
|
|
|
352
349
|
fa: Z<W, S1, S2, R, E, A>,
|
|
353
350
|
onFailure: (e: Cause<E>) => Z<W1, S0, S3, R1, E1, B>,
|
|
354
351
|
onSuccess: (a: A) => Z<W2, S2, S4, R2, E2, C>,
|
|
355
|
-
): Z<W | W1 | W2, S0 & S1, S3 | S4, R
|
|
352
|
+
): Z<W | W1 | W2, S0 & S1, S3 | S4, R | R1 | R2, E1 | E2, B | C> {
|
|
356
353
|
return matchLogCauseZ_(
|
|
357
354
|
fa,
|
|
358
355
|
(ws, e) => onFailure(e).mapLog((w1s) => ws.concat(w1s)),
|
|
@@ -367,7 +364,7 @@ export function matchLogZ_<W, S1, S5, S2, R, E, A, W1, S3, R1, E1, B, W2, S4, R2
|
|
|
367
364
|
fa: Z<W, S1, S2, R, E, A>,
|
|
368
365
|
onFailure: (ws: Conc<W>, e: E) => Z<W1, S5, S3, R1, E1, B>,
|
|
369
366
|
onSuccess: (ws: Conc<W>, a: A) => Z<W2, S2, S4, R2, E2, C>,
|
|
370
|
-
): Z<W | W1 | W2, S1 & S5, S3 | S4, R
|
|
367
|
+
): Z<W | W1 | W2, S1 & S5, S3 | S4, R | R1 | R2, E1 | E2, B | C> {
|
|
371
368
|
return matchLogCauseZ_(
|
|
372
369
|
fa,
|
|
373
370
|
(ws, cause) => cause.failureOrCause.match((e) => onFailure(ws, e), Z.failCauseNow),
|
|
@@ -398,7 +395,7 @@ export function matchLogCauseZ_<W, S1, S2, R, E, A, W1, S0, S3, R1, E1, B, W2, S
|
|
|
398
395
|
*
|
|
399
396
|
* @tsplus static fncts.control.ZOps modify
|
|
400
397
|
*/
|
|
401
|
-
export function modify<S1, S2, A>(f: (s: S1) => readonly [A, S2]): Z<never, S1, S2,
|
|
398
|
+
export function modify<S1, S2, A>(f: (s: S1) => readonly [A, S2]): Z<never, S1, S2, never, never, A> {
|
|
402
399
|
return new Modify(f);
|
|
403
400
|
}
|
|
404
401
|
|
|
@@ -407,7 +404,7 @@ export function modify<S1, S2, A>(f: (s: S1) => readonly [A, S2]): Z<never, S1,
|
|
|
407
404
|
*
|
|
408
405
|
* @tsplus static fncts.control.ZOps modifyEither
|
|
409
406
|
*/
|
|
410
|
-
export function modifyEither<S1, S2, E, A>(f: (s: S1) => Either<E, readonly [A, S2]>): Z<never, S1, S2,
|
|
407
|
+
export function modifyEither<S1, S2, E, A>(f: (s: S1) => Either<E, readonly [A, S2]>): Z<never, S1, S2, never, E, A> {
|
|
411
408
|
return Z.get<S1>()
|
|
412
409
|
.map(f)
|
|
413
410
|
.flatMap((r) => r.match(Z.failNow, ([a, s2]) => Z.succeedNow(a).mapState(() => s2)));
|
|
@@ -419,7 +416,7 @@ export function modifyEither<S1, S2, E, A>(f: (s: S1) => Either<E, readonly [A,
|
|
|
419
416
|
export function orElse_<W, S1, S2, R, E, A, W1, S3, R1, E1, A1>(
|
|
420
417
|
fa: Z<W, S1, S2, R, E, A>,
|
|
421
418
|
fb: Lazy<Z<W1, S1, S3, R1, E1, A1>>,
|
|
422
|
-
): Z<W | W1, S1, S2 | S3, R
|
|
419
|
+
): Z<W | W1, S1, S2 | S3, R | R1, E | E1, A | A1> {
|
|
423
420
|
return fa.matchZ(() => fb(), Z.succeedNow);
|
|
424
421
|
}
|
|
425
422
|
|
|
@@ -432,7 +429,7 @@ export function orElse_<W, S1, S2, R, E, A, W1, S3, R1, E1, A1>(
|
|
|
432
429
|
export function orElseEither_<W, S1, S2, R, E, A, S3, S4, R1, E1, A1>(
|
|
433
430
|
fa: Z<W, S1, S2, R, E, A>,
|
|
434
431
|
that: Lazy<Z<W, S3, S4, R1, E1, A1>>,
|
|
435
|
-
): Z<W, S1 & S3, S2 | S4, R
|
|
432
|
+
): Z<W, S1 & S3, S2 | S4, R | R1, E1, Either<A, A1>> {
|
|
436
433
|
return fa.matchZ(
|
|
437
434
|
() => that().map(Either.right),
|
|
438
435
|
(a) => Z.succeedNow(Either.left(a)),
|
|
@@ -454,7 +451,7 @@ export function provideEnvironment_<W, S1, S2, R, E, A>(
|
|
|
454
451
|
*
|
|
455
452
|
* @tsplus static fncts.control.ZOps put
|
|
456
453
|
*/
|
|
457
|
-
export function put<S>(s: S): Z<never, unknown, S,
|
|
454
|
+
export function put<S>(s: S): Z<never, unknown, S, never, never, void> {
|
|
458
455
|
return Z.modify(() => [undefined, s]);
|
|
459
456
|
}
|
|
460
457
|
|
|
@@ -487,7 +484,7 @@ export function repeatUntil_<W, S1, S2 extends S1, R, E, A>(
|
|
|
487
484
|
export function succeed<A, W = never, S1 = unknown, S2 = never>(
|
|
488
485
|
effect: Lazy<A>,
|
|
489
486
|
__tsplusTrace?: string,
|
|
490
|
-
): Z<W, S1, S2,
|
|
487
|
+
): Z<W, S1, S2, never, never, A> {
|
|
491
488
|
return new Succeed(effect);
|
|
492
489
|
}
|
|
493
490
|
|
|
@@ -497,7 +494,7 @@ export function succeed<A, W = never, S1 = unknown, S2 = never>(
|
|
|
497
494
|
export function succeedNow<A, W = never, S1 = unknown, S2 = never>(
|
|
498
495
|
a: A,
|
|
499
496
|
__tsplusTrace?: string,
|
|
500
|
-
): Z<W, S1, S2,
|
|
497
|
+
): Z<W, S1, S2, never, never, A> {
|
|
501
498
|
return new SucceedNow(a);
|
|
502
499
|
}
|
|
503
500
|
|
|
@@ -514,14 +511,14 @@ export function tap_<W, S1, S2, R, E, A, W1, S3, R1, E1, B>(
|
|
|
514
511
|
/**
|
|
515
512
|
* @tsplus static fncts.control.ZOps tell
|
|
516
513
|
*/
|
|
517
|
-
export function tell<W>(w: W): Z<W, unknown, never,
|
|
514
|
+
export function tell<W>(w: W): Z<W, unknown, never, never, never, void> {
|
|
518
515
|
return Z.tellAll(Conc.single(w));
|
|
519
516
|
}
|
|
520
517
|
|
|
521
518
|
/**
|
|
522
519
|
* @tsplus static fncts.control.ZOps tellAll
|
|
523
520
|
*/
|
|
524
|
-
export function tellAll<W>(ws: Conc<W>): Z<W, unknown, never,
|
|
521
|
+
export function tellAll<W>(ws: Conc<W>): Z<W, unknown, never, never, never, void> {
|
|
525
522
|
return new Tell(ws);
|
|
526
523
|
}
|
|
527
524
|
|
|
@@ -540,14 +537,14 @@ export function transform_<W, S1, S2, R, E, A, S3, B>(
|
|
|
540
537
|
/**
|
|
541
538
|
* @tsplus static fncts.control.ZOps unit
|
|
542
539
|
*/
|
|
543
|
-
export const unit: Z<never, unknown, never,
|
|
540
|
+
export const unit: Z<never, unknown, never, never, never, void> = Z.succeedNow(undefined);
|
|
544
541
|
|
|
545
542
|
/**
|
|
546
543
|
* Constructs a computation from the specified update function.
|
|
547
544
|
*
|
|
548
545
|
* @tsplus static fncts.control.ZOps update
|
|
549
546
|
*/
|
|
550
|
-
export function update<S1, S2>(f: (s: S1) => S2): Z<never, S1, S2,
|
|
547
|
+
export function update<S1, S2>(f: (s: S1) => S2): Z<never, S1, S2, never, never, void> {
|
|
551
548
|
return Z.modify((s) => [undefined, f(s)]);
|
|
552
549
|
}
|
|
553
550
|
|
|
@@ -32,7 +32,7 @@ export abstract class Z<W, S1, S2, R, E, A> {
|
|
|
32
32
|
readonly _W!: () => W;
|
|
33
33
|
readonly _S1!: (_: S1) => void;
|
|
34
34
|
readonly _S2!: () => S2;
|
|
35
|
-
readonly _R!: (
|
|
35
|
+
readonly _R!: () => R;
|
|
36
36
|
readonly _E!: () => E;
|
|
37
37
|
readonly _A!: () => A;
|
|
38
38
|
}
|
|
@@ -75,14 +75,14 @@ export const enum ZTag {
|
|
|
75
75
|
MapLog = "MapLog",
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export class SucceedNow<A> extends Z<never, unknown, never,
|
|
78
|
+
export class SucceedNow<A> extends Z<never, unknown, never, never, never, A> {
|
|
79
79
|
readonly _tag = ZTag.SucceedNow;
|
|
80
80
|
constructor(readonly value: A) {
|
|
81
81
|
super();
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
export class Succeed<A> extends Z<never, unknown, never,
|
|
85
|
+
export class Succeed<A> extends Z<never, unknown, never, never, never, A> {
|
|
86
86
|
readonly _tag = ZTag.Succeed;
|
|
87
87
|
constructor(readonly effect: () => A) {
|
|
88
88
|
super();
|
|
@@ -96,14 +96,14 @@ export class Defer<W, S1, S2, R, E, A> extends Z<W, S1, S2, R, E, A> {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
export class Fail<E> extends Z<never, unknown, never,
|
|
99
|
+
export class Fail<E> extends Z<never, unknown, never, never, E, never> {
|
|
100
100
|
readonly _tag = ZTag.Fail;
|
|
101
101
|
constructor(readonly cause: Cause<E>) {
|
|
102
102
|
super();
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
export class Modify<S1, S2, A> extends Z<never, S1, S2,
|
|
106
|
+
export class Modify<S1, S2, A> extends Z<never, S1, S2, never, never, A> {
|
|
107
107
|
readonly _tag = ZTag.Modify;
|
|
108
108
|
constructor(readonly run: (s1: S1) => readonly [A, S2]) {
|
|
109
109
|
super();
|
|
@@ -149,7 +149,7 @@ export class Provide<W, S1, S2, R, E, A> extends Z<W, S1, S2, never, E, A> {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
export class Tell<W> extends Z<W, unknown, never,
|
|
152
|
+
export class Tell<W> extends Z<W, unknown, never, never, never, void> {
|
|
153
153
|
readonly _tag = ZTag.Tell;
|
|
154
154
|
constructor(readonly log: Conc<W>) {
|
|
155
155
|
super();
|
|
@@ -179,7 +179,6 @@ export type Concrete =
|
|
|
179
179
|
/**
|
|
180
180
|
* @tsplus static fncts.control.ZOps concrete
|
|
181
181
|
*/
|
|
182
|
-
// @ts-expect-error
|
|
183
182
|
export function concrete(_: Z<any, any, any, any, any, any>): asserts _ is Concrete {
|
|
184
183
|
//
|
|
185
184
|
}
|
|
@@ -246,7 +246,7 @@ export function unsafeRunReader_<W, R, A>(ma: Z<W, unknown, never, R, never, A>,
|
|
|
246
246
|
*
|
|
247
247
|
* @tsplus fluent fncts.control.Z unsafeRunState
|
|
248
248
|
*/
|
|
249
|
-
export function unsafeRunState_<W, S1, S2, A>(ma: Z<W, S1, S2,
|
|
249
|
+
export function unsafeRunState_<W, S1, S2, A>(ma: Z<W, S1, S2, never, never, A>, s: S1): S2 {
|
|
250
250
|
return ma.unsafeRun(s)[0];
|
|
251
251
|
}
|
|
252
252
|
|
|
@@ -256,7 +256,7 @@ export function unsafeRunState_<W, S1, S2, A>(ma: Z<W, S1, S2, unknown, never, A
|
|
|
256
256
|
*
|
|
257
257
|
* @tsplus fluent fncts.control.Z unsafeRunStateResult
|
|
258
258
|
*/
|
|
259
|
-
export function unsafeRunStateResult_<W, S1, S2, A>(ma: Z<W, S1, S2,
|
|
259
|
+
export function unsafeRunStateResult_<W, S1, S2, A>(ma: Z<W, S1, S2, never, never, A>, s: S1): A {
|
|
260
260
|
return ma.unsafeRunAll(s)[1].match(
|
|
261
261
|
(cause) => {
|
|
262
262
|
// throw cause.squash
|
|
@@ -271,7 +271,7 @@ export function unsafeRunStateResult_<W, S1, S2, A>(ma: Z<W, S1, S2, unknown, ne
|
|
|
271
271
|
*
|
|
272
272
|
* @tsplus getter fncts.control.Z unsafeRunExit
|
|
273
273
|
*/
|
|
274
|
-
export function unsafeRunExit<E, A>(ma: Z<never, unknown, unknown,
|
|
274
|
+
export function unsafeRunExit<E, A>(ma: Z<never, unknown, unknown, never, E, A>): Exit<E, A> {
|
|
275
275
|
return ma.unsafeRunAll({} as never)[1].map(([_, a]) => a);
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -279,7 +279,7 @@ export function unsafeRunExit<E, A>(ma: Z<never, unknown, unknown, unknown, E, A
|
|
|
279
279
|
*
|
|
280
280
|
* @tsplus getter fncts.control.Z unsafeRunWriter
|
|
281
281
|
*/
|
|
282
|
-
export function unsafeRunWriter<W, A>(ma: Z<W, unknown, unknown,
|
|
282
|
+
export function unsafeRunWriter<W, A>(ma: Z<W, unknown, unknown, never, never, A>): readonly [Conc<W>, A] {
|
|
283
283
|
const [w, exit] = ma.unsafeRunAll({});
|
|
284
284
|
return exit.match(
|
|
285
285
|
() => {
|
package/_src/control.ts
ADDED
|
@@ -225,3 +225,11 @@ export class UnionError extends DecodeError {
|
|
|
225
225
|
.map((errors) => RoseTree(`${this.errors.length} error(s) found while decoding ${this.label}`, errors)),
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
+
|
|
229
|
+
export class EmptyError extends DecodeError {
|
|
230
|
+
readonly _tag = "EmptyError";
|
|
231
|
+
constructor(readonly actual: unknown) {
|
|
232
|
+
super();
|
|
233
|
+
}
|
|
234
|
+
render = Eval(RoseTree(cannotDecode(this.actual, "a collection containing at least one element")));
|
|
235
|
+
}
|
|
File without changes
|
package/_src/data/DecodeError.ts
CHANGED
|
@@ -3,7 +3,7 @@ export const enum EitherTag {
|
|
|
3
3
|
Right = "Right",
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export const EitherTypeId = Symbol.for("fncts.
|
|
6
|
+
export const EitherTypeId = Symbol.for("fncts.data.Either");
|
|
7
7
|
export type EitherTypeId = typeof EitherTypeId;
|
|
8
8
|
|
|
9
9
|
export interface EitherF extends HKT {
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @tsplus fluent fncts.Environment add
|
|
3
3
|
*/
|
|
4
4
|
export function add<R, H extends S, S = H>(self: Environment<R>, service: H, tag: Tag<S>): Environment<R | S> {
|
|
5
|
-
|
|
6
|
-
return new Environment(self0.map.set(tag, [service, self0.index]), self0.index + 1);
|
|
5
|
+
return new Environment(self.map.set(tag, service));
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -31,7 +30,7 @@ export function getMaybe<R extends Has<S>, S>(self: Environment<R>, tag: Tag<S>)
|
|
|
31
30
|
* @tsplus static fncts.EnvironmentOps __call
|
|
32
31
|
*/
|
|
33
32
|
export function make(): Environment<never> {
|
|
34
|
-
return new Environment(HashMap.makeDefault(),
|
|
33
|
+
return new Environment(HashMap.makeDefault(), HashMap.makeDefault());
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
/**
|
|
@@ -39,10 +38,8 @@ export function make(): Environment<never> {
|
|
|
39
38
|
* @tsplus fluent fncts.Environment union
|
|
40
39
|
*/
|
|
41
40
|
export function union<R, R1>(self: Environment<R>, that: Environment<R1>): Environment<R & R1> {
|
|
42
|
-
const [self0, that0] = self.index + that.index < self.index ? [self.clean, that.clean] : [self, that];
|
|
43
41
|
return new Environment(
|
|
44
|
-
|
|
45
|
-
self0.index + that0.index,
|
|
42
|
+
self.map.union(that.map),
|
|
46
43
|
);
|
|
47
44
|
}
|
|
48
45
|
|
|
@@ -51,13 +48,12 @@ export function union<R, R1>(self: Environment<R>, that: Environment<R1>): Envir
|
|
|
51
48
|
*/
|
|
52
49
|
export function clean<R>(self: Environment<R>): Environment<R> {
|
|
53
50
|
const [map, index] = self.map.toList
|
|
54
|
-
.sort(Number.Ord.contramap(([, [, idx]]) => idx))
|
|
55
51
|
.foldLeft(
|
|
56
52
|
[HashMap.makeDefault<Tag<unknown>, readonly [unknown, number]>(), 0],
|
|
57
|
-
([map, index], [tag,
|
|
53
|
+
([map, index], [tag, service]) => [map.set(tag, [service, index] as const), index + 1],
|
|
58
54
|
);
|
|
59
55
|
|
|
60
|
-
return new Environment(map
|
|
56
|
+
return new Environment(map);
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
/**
|
|
@@ -66,14 +62,12 @@ export function clean<R>(self: Environment<R>): Environment<R> {
|
|
|
66
62
|
export function unsafeGet<R, S>(self: Environment<R>, tag: Tag<S>): S {
|
|
67
63
|
return self.cache.get(tag).match(
|
|
68
64
|
() => {
|
|
69
|
-
let index = -1;
|
|
70
65
|
const iterator = self.map[Symbol.iterator]();
|
|
71
66
|
let service: S = null!;
|
|
72
|
-
let r: IteratorResult<readonly [Tag<unknown>,
|
|
67
|
+
let r: IteratorResult<readonly [Tag<unknown>, unknown]>;
|
|
73
68
|
while (!(r = iterator.next()).done) {
|
|
74
|
-
const [curTag,
|
|
75
|
-
if (curTag == tag
|
|
76
|
-
index = curIndex;
|
|
69
|
+
const [curTag, curService] = r.value;
|
|
70
|
+
if (curTag == tag) {
|
|
77
71
|
service = curService as S;
|
|
78
72
|
}
|
|
79
73
|
}
|
|
@@ -13,8 +13,7 @@ export class Environment<R> implements Hashable, Equatable {
|
|
|
13
13
|
readonly _typeId: EnvSymbol = EnvSymbol;
|
|
14
14
|
readonly [EnvSymbol]!: (_: never) => R;
|
|
15
15
|
constructor(
|
|
16
|
-
readonly map: HashMap<Tag<any>,
|
|
17
|
-
readonly index: number,
|
|
16
|
+
readonly map: HashMap<Tag<any>, unknown>,
|
|
18
17
|
public cache: HashMap<Tag<any>, unknown> = HashMap.makeDefault(),
|
|
19
18
|
) {}
|
|
20
19
|
|