From e017d16592532b6de3c8514ce55017933a721a98 Mon Sep 17 00:00:00 2001 From: Quildreen Motta Date: Sat, 11 Mar 2017 19:23:42 -0300 Subject: [PATCH] (release) Publishes version 2.0.0-alpha3 --- ...nown module).Folktale.data.maybe.Just.html | 82 --- ...ule).Folktale.data.maybe.Just.inspect.html | 26 - ...ale.data.maybe.Just.prototype.Nothing.html | 74 --- ....maybe.Just.prototype.Nothing.inspect.html | 26 - ...ototype.Nothing.prototype.constructor.html | 25 - ....prototype.Nothing.prototype.fromJSON.html | 59 -- ...e.Just.prototype.Nothing.prototype.of.html | 35 - ....prototype.Nothing.prototype.toEither.html | 38 -- ...totype.Nothing.prototype.toValidation.html | 38 -- ...data.maybe.Just.prototype.constructor.html | 26 - ...n module).Folktale.data.maybe.inspect.html | 26 - docs/api/en/folktale.html | 41 -- .../en/folktale.src.core.adt.data.ADT.html | 42 -- .../en/folktale.src.core.adt.data.apply.html | 28 - .../en/folktale.src.core.adt.data.cata.html | 38 -- .../en/folktale.src.core.adt.data.chain.html | 28 - ...olktale.src.core.adt.data.constructor.html | 30 - .../en/folktale.src.core.adt.data.data.html | 483 -------------- .../en/folktale.src.core.adt.data.derive.html | 44 -- .../en/folktale.src.core.adt.data.equals.html | 31 - .../en/folktale.src.core.adt.data.get.html | 27 - .../folktale.src.core.adt.data.getOrElse.html | 27 - ...olktale.src.core.adt.data.hasInstance.html | 44 -- .../folktale.src.core.adt.data.inspect.html | 28 - ...olktale.src.core.adt.data.isCancelled.html | 34 - .../folktale.src.core.adt.data.isError.html | 34 - .../en/folktale.src.core.adt.data.isJust.html | 34 - .../en/folktale.src.core.adt.data.isLeft.html | 34 - .../folktale.src.core.adt.data.isNothing.html | 34 - .../en/folktale.src.core.adt.data.isOk.html | 34 - .../folktale.src.core.adt.data.isPending.html | 34 - ...folktale.src.core.adt.data.isRejected.html | 34 - ...folktale.src.core.adt.data.isResolved.html | 34 - .../folktale.src.core.adt.data.isRight.html | 34 - .../en/folktale.src.core.adt.data.map.html | 28 - .../folktale.src.core.adt.data.matchWith.html | 47 -- .../en/folktale.src.core.adt.data.orElse.html | 32 - .../folktale.src.core.adt.data.prototype.html | 76 --- .../en/folktale.src.core.adt.data.tag.html | 28 - .../en/folktale.src.core.adt.data.toJSON.html | 47 -- .../en/folktale.src.core.adt.data.type.html | 30 - .../folktale.src.core.adt.data.unsafeGet.html | 26 - .../folktale.src.core.adt.data.variants.html | 29 - docs/api/en/folktale.src.core.adt.html | 91 --- ...tale.src.core.adt.serialize.serialize.html | 195 ------ .../folktale.src.core.adt.setoid.setoid.html | 345 ---------- ...tale.src.core.adt.setoid.withEquality.html | 92 --- .../en/folktale.src.core.adt.show.show.html | 121 ---- ...ale.src.core.fantasy-land.apply.apply.html | 33 - ...ale.src.core.fantasy-land.bimap.bimap.html | 33 - ...ale.src.core.fantasy-land.chain.chain.html | 33 - ...e.src.core.fantasy-land.concat.concat.html | 33 - ...olktale.src.core.fantasy-land.curried.html | 42 -- ...ale.src.core.fantasy-land.empty.empty.html | 35 - ...e.src.core.fantasy-land.equals.equals.html | 29 - .../en/folktale.src.core.fantasy-land.html | 49 -- .../folktale.src.core.fantasy-land.infix.html | 44 -- ...olktale.src.core.fantasy-land.map.map.html | 33 - .../folktale.src.core.fantasy-land.of.of.html | 35 - docs/api/en/folktale.src.core.html | 68 -- .../folktale.src.core.lambda.compose.all.html | 48 -- ...ktale.src.core.lambda.compose.compose.html | 240 ------- ...olktale.src.core.lambda.compose.infix.html | 36 -- ...ale.src.core.lambda.constant.constant.html | 63 -- .../folktale.src.core.lambda.curry.curry.html | 285 -------- docs/api/en/folktale.src.core.lambda.html | 99 --- ...ale.src.core.lambda.identity.identity.html | 50 -- ...ktale.src.core.lambda.partialise.hole.html | 26 - ...src.core.lambda.partialise.partialise.html | 169 ----- ....src.core.object.from-pairs.fromPairs.html | 53 -- docs/api/en/folktale.src.core.object.html | 74 --- ...rc.core.object.map-entries.mapEntries.html | 75 --- ...src.core.object.map-entries.overwrite.html | 39 -- ...le.src.core.object.map-entries.unique.html | 37 -- ...tale.src.core.object.map-values.infix.html | 36 -- ....src.core.object.map-values.mapValues.html | 53 -- ...tale.src.core.object.to-pairs.toPairs.html | 66 -- ...olktale.src.core.object.values.values.html | 66 -- ...ersions.either-to-maybe.eitherToMaybe.html | 44 -- ...ther-to-validation.eitherToValidation.html | 42 -- .../api/en/folktale.src.data.conversions.html | 56 -- ...ersions.maybe-to-either.maybeToEither.html | 44 -- ...ersions.maybe-to-result.maybeToResult.html | 43 -- ...maybe-to-validation.maybeToValidation.html | 43 -- ...s.nullable-to-either.nullableToEither.html | 41 -- ...ons.nullable-to-maybe.nullableToMaybe.html | 42 -- ...s.nullable-to-result.nullableToResult.html | 40 -- ...le-to-validation.nullableToValidation.html | 40 -- ...ersions.result-to-maybe.resultToMaybe.html | 43 -- ...sult-to-validation.resultToValidation.html | 41 -- ...lidation-to-either.validationToEither.html | 42 -- ...validation-to-maybe.validationToMaybe.html | 43 -- ...lidation-to-result.validationToResult.html | 41 -- .../api/en/folktale.src.data.either.Left.html | 36 -- .../en/folktale.src.data.either.Right.html | 36 -- .../folktale.src.data.either.constructor.html | 28 - ...folktale.src.data.either.either.apply.html | 48 -- ...folktale.src.data.either.either.bimap.html | 47 -- ...folktale.src.data.either.either.chain.html | 44 -- .../folktale.src.data.either.either.fold.html | 48 -- .../folktale.src.data.either.either.get.html | 46 -- ...tale.src.data.either.either.getOrElse.html | 42 -- ...lktale.src.data.either.either.leftMap.html | 43 -- .../folktale.src.data.either.either.map.html | 43 -- ...folktale.src.data.either.either.merge.html | 39 -- .../folktale.src.data.either.either.of.html | 33 - ...olktale.src.data.either.either.orElse.html | 43 -- .../folktale.src.data.either.either.swap.html | 39 -- ...lktale.src.data.either.either.toMaybe.html | 35 - ...e.src.data.either.either.toValidation.html | 35 - .../en/folktale.src.data.either.fromJSON.html | 60 -- docs/api/en/folktale.src.data.either.html | 53 -- .../en/folktale.src.data.either.inspect.html | 26 - .../en/folktale.src.data.either.try.try.html | 49 -- ...e.src.data.future._deferred._Deferred.html | 67 -- ...le.src.data.future._execution-state.0.html | 51 -- ...ata.future._execution-state.Cancelled.html | 51 -- ...data.future._execution-state.Rejected.html | 51 -- ...data.future._execution-state.Resolved.html | 51 -- ...ture._execution-state._ExecutionState.html | 63 -- ...a.future._execution-state.constructor.html | 28 - ....data.future._execution-state.inspect.html | 26 - ...ktale.src.data.future._future._Future.html | 382 ----------- .../folktale.src.data.future._future.of.html | 31 - ...tale.src.data.future._future.rejected.html | 30 - docs/api/en/folktale.src.data.future.html | 38 -- docs/api/en/folktale.src.data.html | 41 -- docs/api/en/folktale.src.data.maybe.Just.html | 44 -- .../en/folktale.src.data.maybe.Nothing.html | 37 -- .../folktale.src.data.maybe.constructor.html | 28 - .../en/folktale.src.data.maybe.fromJSON.html | 60 -- .../folktale.src.data.maybe.fromNullable.html | 40 -- .../folktale.src.data.maybe.fromResult.html | 39 -- ...olktale.src.data.maybe.fromValidation.html | 39 -- docs/api/en/folktale.src.data.maybe.html | 334 ---------- .../en/folktale.src.data.maybe.inspect.html | 26 - .../folktale.src.data.maybe.maybe.apply.html | 60 -- .../folktale.src.data.maybe.maybe.cata.html | 42 -- .../folktale.src.data.maybe.maybe.chain.html | 66 -- .../en/folktale.src.data.maybe.maybe.get.html | 33 - ...lktale.src.data.maybe.maybe.getOrElse.html | 46 -- .../en/folktale.src.data.maybe.maybe.map.html | 57 -- .../en/folktale.src.data.maybe.maybe.of.html | 35 - .../folktale.src.data.maybe.maybe.orElse.html | 68 -- ...olktale.src.data.maybe.maybe.toResult.html | 38 -- ...ale.src.data.maybe.maybe.toValidation.html | 38 -- ...lktale.src.data.maybe.maybe.unsafeGet.html | 60 -- .../folktale.src.data.maybe.maybe.value.html | 38 -- docs/api/en/folktale.src.data.maybe.of.html | 35 - .../en/folktale.src.data.maybe.toEither.html | 38 -- .../folktale.src.data.maybe.toValidation.html | 38 -- .../en/folktale.src.data.result.Error.html | 88 --- docs/api/en/folktale.src.data.result.Ok.html | 88 --- .../folktale.src.data.result.constructor.html | 26 - .../en/folktale.src.data.result.fromJSON.html | 59 -- .../folktale.src.data.result.fromMaybe.html | 38 -- ...folktale.src.data.result.fromNullable.html | 42 -- ...lktale.src.data.result.fromValidation.html | 40 -- docs/api/en/folktale.src.data.result.html | 610 ------------------ .../en/folktale.src.data.result.inspect.html | 26 - ...folktale.src.data.result.result.apply.html | 62 -- ...folktale.src.data.result.result.bimap.html | 55 -- ...folktale.src.data.result.result.chain.html | 60 -- ...ktale.src.data.result.result.errorMap.html | 41 -- .../folktale.src.data.result.result.fold.html | 51 -- .../folktale.src.data.result.result.get.html | 33 - ...tale.src.data.result.result.getOrElse.html | 45 -- .../folktale.src.data.result.result.map.html | 54 -- ...ktale.src.data.result.result.mapError.html | 49 -- ...folktale.src.data.result.result.merge.html | 37 -- .../folktale.src.data.result.result.of.html | 34 - ...olktale.src.data.result.result.orElse.html | 53 -- .../folktale.src.data.result.result.swap.html | 47 -- ...lktale.src.data.result.result.toMaybe.html | 38 -- ...e.src.data.result.result.toValidation.html | 40 -- ...tale.src.data.result.result.unsafeGet.html | 58 -- ...folktale.src.data.result.result.value.html | 38 -- .../en/folktale.src.data.result.try.try.html | 53 -- ...lpers.provide-fantasy-land-aliases.ap.html | 29 - .../ap.html | 29 - .../bimap.html | 30 - .../chain.html | 30 - .../equals.html | 29 - .../map.html | 29 - .../of.html | 30 - docs/api/en/style.css | 36 ++ 186 files changed, 36 insertions(+), 10693 deletions(-) delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.inspect.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.inspect.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.constructor.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.fromJSON.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.of.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toEither.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toValidation.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.constructor.html delete mode 100644 docs/api/en/(unknown module).Folktale.data.maybe.inspect.html delete mode 100644 docs/api/en/folktale.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.ADT.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.apply.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.cata.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.chain.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.constructor.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.data.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.derive.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.equals.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.get.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.getOrElse.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.hasInstance.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.inspect.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isCancelled.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isError.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isJust.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isLeft.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isNothing.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isOk.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isPending.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isRejected.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isResolved.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.isRight.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.map.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.matchWith.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.orElse.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.prototype.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.tag.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.toJSON.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.type.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.unsafeGet.html delete mode 100644 docs/api/en/folktale.src.core.adt.data.variants.html delete mode 100644 docs/api/en/folktale.src.core.adt.html delete mode 100644 docs/api/en/folktale.src.core.adt.serialize.serialize.html delete mode 100644 docs/api/en/folktale.src.core.adt.setoid.setoid.html delete mode 100644 docs/api/en/folktale.src.core.adt.setoid.withEquality.html delete mode 100644 docs/api/en/folktale.src.core.adt.show.show.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.apply.apply.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.bimap.bimap.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.chain.chain.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.concat.concat.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.curried.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.empty.empty.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.equals.equals.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.infix.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.map.map.html delete mode 100644 docs/api/en/folktale.src.core.fantasy-land.of.of.html delete mode 100644 docs/api/en/folktale.src.core.html delete mode 100644 docs/api/en/folktale.src.core.lambda.compose.all.html delete mode 100644 docs/api/en/folktale.src.core.lambda.compose.compose.html delete mode 100644 docs/api/en/folktale.src.core.lambda.compose.infix.html delete mode 100644 docs/api/en/folktale.src.core.lambda.constant.constant.html delete mode 100644 docs/api/en/folktale.src.core.lambda.curry.curry.html delete mode 100644 docs/api/en/folktale.src.core.lambda.html delete mode 100644 docs/api/en/folktale.src.core.lambda.identity.identity.html delete mode 100644 docs/api/en/folktale.src.core.lambda.partialise.hole.html delete mode 100644 docs/api/en/folktale.src.core.lambda.partialise.partialise.html delete mode 100644 docs/api/en/folktale.src.core.object.from-pairs.fromPairs.html delete mode 100644 docs/api/en/folktale.src.core.object.html delete mode 100644 docs/api/en/folktale.src.core.object.map-entries.mapEntries.html delete mode 100644 docs/api/en/folktale.src.core.object.map-entries.overwrite.html delete mode 100644 docs/api/en/folktale.src.core.object.map-entries.unique.html delete mode 100644 docs/api/en/folktale.src.core.object.map-values.infix.html delete mode 100644 docs/api/en/folktale.src.core.object.map-values.mapValues.html delete mode 100644 docs/api/en/folktale.src.core.object.to-pairs.toPairs.html delete mode 100644 docs/api/en/folktale.src.core.object.values.values.html delete mode 100644 docs/api/en/folktale.src.data.conversions.either-to-maybe.eitherToMaybe.html delete mode 100644 docs/api/en/folktale.src.data.conversions.either-to-validation.eitherToValidation.html delete mode 100644 docs/api/en/folktale.src.data.conversions.html delete mode 100644 docs/api/en/folktale.src.data.conversions.maybe-to-either.maybeToEither.html delete mode 100644 docs/api/en/folktale.src.data.conversions.maybe-to-result.maybeToResult.html delete mode 100644 docs/api/en/folktale.src.data.conversions.maybe-to-validation.maybeToValidation.html delete mode 100644 docs/api/en/folktale.src.data.conversions.nullable-to-either.nullableToEither.html delete mode 100644 docs/api/en/folktale.src.data.conversions.nullable-to-maybe.nullableToMaybe.html delete mode 100644 docs/api/en/folktale.src.data.conversions.nullable-to-result.nullableToResult.html delete mode 100644 docs/api/en/folktale.src.data.conversions.nullable-to-validation.nullableToValidation.html delete mode 100644 docs/api/en/folktale.src.data.conversions.result-to-maybe.resultToMaybe.html delete mode 100644 docs/api/en/folktale.src.data.conversions.result-to-validation.resultToValidation.html delete mode 100644 docs/api/en/folktale.src.data.conversions.validation-to-either.validationToEither.html delete mode 100644 docs/api/en/folktale.src.data.conversions.validation-to-maybe.validationToMaybe.html delete mode 100644 docs/api/en/folktale.src.data.conversions.validation-to-result.validationToResult.html delete mode 100644 docs/api/en/folktale.src.data.either.Left.html delete mode 100644 docs/api/en/folktale.src.data.either.Right.html delete mode 100644 docs/api/en/folktale.src.data.either.constructor.html delete mode 100644 docs/api/en/folktale.src.data.either.either.apply.html delete mode 100644 docs/api/en/folktale.src.data.either.either.bimap.html delete mode 100644 docs/api/en/folktale.src.data.either.either.chain.html delete mode 100644 docs/api/en/folktale.src.data.either.either.fold.html delete mode 100644 docs/api/en/folktale.src.data.either.either.get.html delete mode 100644 docs/api/en/folktale.src.data.either.either.getOrElse.html delete mode 100644 docs/api/en/folktale.src.data.either.either.leftMap.html delete mode 100644 docs/api/en/folktale.src.data.either.either.map.html delete mode 100644 docs/api/en/folktale.src.data.either.either.merge.html delete mode 100644 docs/api/en/folktale.src.data.either.either.of.html delete mode 100644 docs/api/en/folktale.src.data.either.either.orElse.html delete mode 100644 docs/api/en/folktale.src.data.either.either.swap.html delete mode 100644 docs/api/en/folktale.src.data.either.either.toMaybe.html delete mode 100644 docs/api/en/folktale.src.data.either.either.toValidation.html delete mode 100644 docs/api/en/folktale.src.data.either.fromJSON.html delete mode 100644 docs/api/en/folktale.src.data.either.html delete mode 100644 docs/api/en/folktale.src.data.either.inspect.html delete mode 100644 docs/api/en/folktale.src.data.either.try.try.html delete mode 100644 docs/api/en/folktale.src.data.future._deferred._Deferred.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state.0.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state.Cancelled.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state.Rejected.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state.Resolved.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state._ExecutionState.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state.constructor.html delete mode 100644 docs/api/en/folktale.src.data.future._execution-state.inspect.html delete mode 100644 docs/api/en/folktale.src.data.future._future._Future.html delete mode 100644 docs/api/en/folktale.src.data.future._future.of.html delete mode 100644 docs/api/en/folktale.src.data.future._future.rejected.html delete mode 100644 docs/api/en/folktale.src.data.future.html delete mode 100644 docs/api/en/folktale.src.data.html delete mode 100644 docs/api/en/folktale.src.data.maybe.Just.html delete mode 100644 docs/api/en/folktale.src.data.maybe.Nothing.html delete mode 100644 docs/api/en/folktale.src.data.maybe.constructor.html delete mode 100644 docs/api/en/folktale.src.data.maybe.fromJSON.html delete mode 100644 docs/api/en/folktale.src.data.maybe.fromNullable.html delete mode 100644 docs/api/en/folktale.src.data.maybe.fromResult.html delete mode 100644 docs/api/en/folktale.src.data.maybe.fromValidation.html delete mode 100644 docs/api/en/folktale.src.data.maybe.html delete mode 100644 docs/api/en/folktale.src.data.maybe.inspect.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.apply.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.cata.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.chain.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.get.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.getOrElse.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.map.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.of.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.orElse.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.toResult.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.toValidation.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.unsafeGet.html delete mode 100644 docs/api/en/folktale.src.data.maybe.maybe.value.html delete mode 100644 docs/api/en/folktale.src.data.maybe.of.html delete mode 100644 docs/api/en/folktale.src.data.maybe.toEither.html delete mode 100644 docs/api/en/folktale.src.data.maybe.toValidation.html delete mode 100644 docs/api/en/folktale.src.data.result.Error.html delete mode 100644 docs/api/en/folktale.src.data.result.Ok.html delete mode 100644 docs/api/en/folktale.src.data.result.constructor.html delete mode 100644 docs/api/en/folktale.src.data.result.fromJSON.html delete mode 100644 docs/api/en/folktale.src.data.result.fromMaybe.html delete mode 100644 docs/api/en/folktale.src.data.result.fromNullable.html delete mode 100644 docs/api/en/folktale.src.data.result.fromValidation.html delete mode 100644 docs/api/en/folktale.src.data.result.html delete mode 100644 docs/api/en/folktale.src.data.result.inspect.html delete mode 100644 docs/api/en/folktale.src.data.result.result.apply.html delete mode 100644 docs/api/en/folktale.src.data.result.result.bimap.html delete mode 100644 docs/api/en/folktale.src.data.result.result.chain.html delete mode 100644 docs/api/en/folktale.src.data.result.result.errorMap.html delete mode 100644 docs/api/en/folktale.src.data.result.result.fold.html delete mode 100644 docs/api/en/folktale.src.data.result.result.get.html delete mode 100644 docs/api/en/folktale.src.data.result.result.getOrElse.html delete mode 100644 docs/api/en/folktale.src.data.result.result.map.html delete mode 100644 docs/api/en/folktale.src.data.result.result.mapError.html delete mode 100644 docs/api/en/folktale.src.data.result.result.merge.html delete mode 100644 docs/api/en/folktale.src.data.result.result.of.html delete mode 100644 docs/api/en/folktale.src.data.result.result.orElse.html delete mode 100644 docs/api/en/folktale.src.data.result.result.swap.html delete mode 100644 docs/api/en/folktale.src.data.result.result.toMaybe.html delete mode 100644 docs/api/en/folktale.src.data.result.result.toValidation.html delete mode 100644 docs/api/en/folktale.src.data.result.result.unsafeGet.html delete mode 100644 docs/api/en/folktale.src.data.result.result.value.html delete mode 100644 docs/api/en/folktale.src.data.result.try.try.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.ap.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/ap.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/bimap.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/chain.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/equals.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/map.html delete mode 100644 docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/of.html diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.html deleted file mode 100644 index de5ac69..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Just - - - - - -

Just

Constructs a Maybe value that represents a successful value (a Just).

-

Signature

Just(value)
Type
forall a: (a) => Maybe a

Documentation

Constructs a Maybe value that represents a successful value (a Just).

-
-

NOTE:
The provided value is stored as-given in the structure. If you want to -convert a nullable value (a value that may be null/undefined) to a Maybe -value, use the Maybe.fromNullable(value) function instead of -Maybe.Just(value).

-
-

See the documentation for the Maybe structure to understand how to use this.

-

Static properties

Comparing and Testing

hasInstance(value)

Checks if a value belongs to this Variant.

-

Debug Representation

inspect: toString()

Returns a textual representation of the Variant.

-
Experimental
toString()

Returns a textual representation of the Variant.

-
Experimental

Internal

get constructor

The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

-
prototype

The object that provides common behaviours for instances of this variant.

-

State and Configuration

get tag

The unique tag for this variant within the ADT.

-
get type

The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

-

Instance (prototype) properties

Comparing and Testing

hasInstance(value)

Checks if a value belongs to this ADT.

-
Inherited

Comparing and testing

equals(value)

Compares two setoids structurally.

-
Experimental

Constructing

Just(value)

Constructs a Maybe value that represents a successful value (a Just).

-
Inherited
Nothing()

Constructs a Maybe value that represents a failure (a Nothing).

-
Inherited
of(value)

Constructs a Maybe value that represents a successful value (a Just).

-
Inherited

Converting to other types

toResult(fallbackValue)

A convenience method for the folktale/data/conversions/maybe-to-result module.

-
Inherited
toValidation(fallbackValue)

A convenience method for the folktale/data/conversions/maybe-to-validation module.

-
Inherited

Debug Representation

inspect: toString()

Returns a textual representation of the ADT instance.

-
Experimental
toString()

Returns a textual representation of the ADT instance.

-
Experimental

Extending ADTs

derive(...derivations)

Allows a function to provide functionality to variants in an ADT.

-
ExperimentalInherited

Extracting values

get()

This method has been renamed to unsafeGet().

-
DeprecatedInherited
getOrElse(default)

Extracts the value of a Maybe structure, if it exists (i.e.: is a Just), -otherwise returns the provided default value.

-
unsafeGet()

Extracts the value from a Just structure.

-

Fantasy Land

ap(that)

Fantasy Land's Apply ap

-
fantasy-land/ap(that)

Fantasy Land's Apply ap

-
fantasy-land/chain(transformation)

Fantasy Land’s Chain chain.

-
fantasy-land/equals(that)

Fantasy Land's Setoid `equals'.

-
fantasy-land/map(transformation)

Fantasy Land's Functor map.

-
fantasy-land/of(value)

Fantasy Land's Applicative of

-

Members

variants

The variants present in this ADT.

-
Inherited

Pattern matching

Recovering from errors

orElse(handler)

Allows recovering from from failed Maybe values.

-

Serialisation

fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

Parses a previously serialised ADT into a rich ADT object.

-
ExperimentalInherited
toJSON()

Serialises a variant to JSON.

-
Experimental

State and configuration

get value

The value contained in a Just instance of the Maybe structure.

-
Abstract

Testing and Comparing

get isJust

True if a value belongs to the ADT variant.

-
Deprecated

Transforming

apply(aMaybe)

Transforms a Maybe value using a function contained in another Maybe. As with -.map(), the Maybe values are expected to be Just, and no operation is -performed if any of them is a Nothing.

-
chain(transformation)

Transforms an entire Maybe structure with the provided function. As with -.map(), the transformation is only applied if the value is a Just, but -unlike .map() the transformation is expected to return a new Maybe value.

-
map(transformation)

Transforms the value inside a Maybe structure with an unary function. Only -transforms values that are successful (Just), and constructs a new Maybe as a -result.

-
matchWith(pattern)

Selects an operation based on this Variant's tag.

-

Source Code

Just(value) {
-    return { value };
-  }
- - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.inspect.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.inspect.html deleted file mode 100644 index 60741b5..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

toString

Returns a textual representation of the Variant.

-

Signature

toString()
Type
() => String

Documentation

Returns a textual representation of the Variant.

-

Properties

(Uncategorised)

Experimental

Source Code

() => variantName
Stability
experimental
Authors
Authors
  • @boris-marinov
Maintainers
    - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.html deleted file mode 100644 index 9153190..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Nothing - - - - - -

    Nothing

    Constructs a Maybe value that represents a failure (a Nothing).

    -

    Signature

    Nothing()
    Type
    forall a: () => Maybe a

    Documentation

    Constructs a Maybe value that represents a failure (a Nothing).

    -

    See the documentation for the Maybe structure to understand how to use this.

    -

    Static properties

    Comparing and Testing

    hasInstance(value)

    Checks if a value belongs to this Variant.

    -

    Debug Representation

    inspect: toString()

    Returns a textual representation of the Variant.

    -
    Experimental
    toString()

    Returns a textual representation of the Variant.

    -
    Experimental

    Internal

    get constructor

    The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

    -
    prototype

    The object that provides common behaviours for instances of this variant.

    -

    State and Configuration

    get tag

    The unique tag for this variant within the ADT.

    -
    get type

    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

    -

    Instance (prototype) properties

    Comparing and Testing

    hasInstance(value)

    Checks if a value belongs to this ADT.

    -
    Inherited

    Comparing and testing

    equals(value)

    Compares two setoids structurally.

    -
    Experimental

    Constructing

    Just(value)

    Constructs a Maybe value that represents a successful value (a Just).

    -
    Inherited
    Nothing()

    Constructs a Maybe value that represents a failure (a Nothing).

    -
    Inherited
    of(value)

    Constructs a Maybe value that represents a successful value (a Just).

    -
    Inherited

    Converting to other types

    toResult(fallbackValue)

    A convenience method for the folktale/data/conversions/maybe-to-result module.

    -
    Inherited
    toValidation(fallbackValue)

    A convenience method for the folktale/data/conversions/maybe-to-validation module.

    -
    Inherited

    Debug Representation

    inspect: toString()

    Returns a textual representation of the ADT instance.

    -
    Experimental
    toString()

    Returns a textual representation of the ADT instance.

    -
    Experimental

    Extending ADTs

    derive(...derivations)

    Allows a function to provide functionality to variants in an ADT.

    -
    ExperimentalInherited

    Extracting values

    get()

    This method has been renamed to unsafeGet().

    -
    DeprecatedInherited
    getOrElse(default)

    Extracts the value of a Maybe structure, if it exists (i.e.: is a Just), -otherwise returns the provided default value.

    -
    unsafeGet()

    Extracts the value from a Just structure.

    -

    Fantasy Land

    ap(that)

    Fantasy Land's Apply ap

    -
    fantasy-land/ap(that)

    Fantasy Land's Apply ap

    -
    fantasy-land/chain(transformation)

    Fantasy Land’s Chain chain.

    -
    fantasy-land/equals(that)

    Fantasy Land's Setoid `equals'.

    -
    fantasy-land/map(transformation)

    Fantasy Land's Functor map.

    -
    fantasy-land/of(value)

    Fantasy Land's Applicative of

    -

    Members

    variants

    The variants present in this ADT.

    -
    Inherited

    Pattern matching

    Recovering from errors

    orElse(handler)

    Allows recovering from from failed Maybe values.

    -

    Serialisation

    fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

    Parses a previously serialised ADT into a rich ADT object.

    -
    ExperimentalInherited
    toJSON()

    Serialises a variant to JSON.

    -
    Experimental

    Testing and Comparing

    get isNothing

    True if a value belongs to the ADT variant.

    -
    Deprecated

    Transforming

    apply(aMaybe)

    Transforms a Maybe value using a function contained in another Maybe. As with -.map(), the Maybe values are expected to be Just, and no operation is -performed if any of them is a Nothing.

    -
    chain(transformation)

    Transforms an entire Maybe structure with the provided function. As with -.map(), the transformation is only applied if the value is a Just, but -unlike .map() the transformation is expected to return a new Maybe value.

    -
    map(transformation)

    Transforms the value inside a Maybe structure with an unary function. Only -transforms values that are successful (Just), and constructs a new Maybe as a -result.

    -
    matchWith(pattern)

    Selects an operation based on this Variant's tag.

    -

    Source Code

    Nothing() {
    -  }
    - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.inspect.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.inspect.html deleted file mode 100644 index 60741b5..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

    toString

    Returns a textual representation of the Variant.

    -

    Signature

    toString()
    Type
    () => String

    Documentation

    Returns a textual representation of the Variant.

    -

    Properties

    (Uncategorised)

    Experimental

    Source Code

    () => variantName
    Stability
    experimental
    Authors
    Authors
    • @boris-marinov
    Maintainers
      - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.constructor.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.constructor.html deleted file mode 100644 index 27ed14c..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.constructor.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Nothing - - - - - -

      Nothing

      Signature

      Nothing()
      Type
      forall a: () => Maybe a

      Documentation

      Properties

      (Uncategorised)

      Source Code

      Nothing() {
      -  }
      Authors
      Authors
        Maintainers
          - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.fromJSON.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.fromJSON.html deleted file mode 100644 index d02192c..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.fromJSON.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - fromJSON - - - - - -

          fromJSON

          Parses a previously serialised ADT into a rich ADT object.

          -

          Signature

          fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)
          Type
          type JSONSerialisation = {
          -  "@@type":  String,
          -  "@@tag":   String,
          -  "@@value": Object Any
          -}
          -type JSONParser = {
          -  fromJSON: (JSONSerialisation, Array JSONParser) => Variant
          -}
          -
          -(JSONSerialisation, Array JSONParser) => Variant

          Documentation

          Parses a previously serialised ADT into a rich ADT object.

          -

          Example:

          -
          const { data, setoid } = require('folktale/core/adt');
          -const Id = data('Id', {
          -  Id(value){ return { value } }
          -}).derive(serialize, setoid);
          -
          -Id.Id(1).toJSON();
          -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
          -
          -Id.fromJSON(Id.Id(1).toJSON());
          -// ==> Id.Id(1)
          -

          Properties

          (Uncategorised)

          Experimental

          Source Code

          function(value, parsers = { [typeName]: adt }, keysIndicateType = false) {
          -    const valueTypeName = value[typeJsonKey];
          -    const valueTagName = value[tagJsonKey];
          -    const valueContents = value[valueJsonKey];
          -    assertType(typeName, valueTypeName);
          -    const parsersByType = keysIndicateType ? parsers
          -          : /*otherwise*/                    indexByType(values(parsers));
          -
          -    const parsedValue = mapValues(valueContents, parseValue(parsersByType));
          -    return Object.assign(Object.create(adt[valueTagName].prototype), parsedValue);
          -  }
          Stability
          experimental
          Authors
          Authors
          • @boris-marinov
          Maintainers
            - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.of.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.of.html deleted file mode 100644 index 98d71b0..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.of.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - of - - - - - -

            of

            Signature

            of(value)
            Type
            forall a: (a) => Maybe a

            Documentation

            Constructs a Maybe value that represents a successful value (a Just).

            -
            -

            NOTE:
            The provided value is stored as-given in the structure. If you want to -convert a nullable value (a value that may be null/undefined) to a Maybe -value, use the Maybe.fromNullable(value) function instead of -Maybe.of(value).

            -
            -

            See the documentation for the Maybe structure to understand how to use this.

            -

            Properties

            (Uncategorised)

            A Number.

            -
            Experimental

            Source Code

            function(value) {
            -  return Just(value);
            -}
            Authors
            Authors
              Maintainers
                - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toEither.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toEither.html deleted file mode 100644 index 89c52aa..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toEither.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toEither - - - - - -

                toEither

                Signature

                toEither(fallbackValue)
                Type
                forall a, b: (Maybe a).(b) => Either b a

                Documentation

                A convenience method for the folktale/data/conversions/maybe-to-either module.

                -

                Example:

                -
                const Maybe = require('folktale/data/maybe');
                -const Either = require('folktale/data/either');
                -
                -Maybe.Just(1).toEither(0);
                -// ==> Either.Right(1)
                -
                -Maybe.Nothing().toEither(0)
                -// ==> Either.Left(0)
                -

                Properties

                (Uncategorised)

                A Number.

                -
                Experimental

                Source Code

                function(fallbackValue) {
                -  return require('folktale/data/conversions/maybe-to-either')(this, fallbackValue);
                -}
                Authors
                Authors
                  Maintainers
                    - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toValidation.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toValidation.html deleted file mode 100644 index dfa3528..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.Nothing.prototype.toValidation.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toValidation - - - - - -

                    toValidation

                    Signature

                    toValidation(fallbackValue)
                    Type
                    forall a, b: (Maybe a).(b) => Validation b a

                    Documentation

                    A convenience method for the folktale/data/conversions/maybe-to-validation module.

                    -

                    Example:

                    -
                    const Maybe = require('folktale/data/maybe');
                    -const Validation = require('folktale/data/validation');
                    -
                    -Maybe.Just(1).toValidation(0);
                    -// ==> Validation.Success(1)
                    -
                    -Maybe.Nothing().toValidation(0)
                    -// ==> Validation.Failure(0)    
                    -

                    Properties

                    (Uncategorised)

                    A Number.

                    -
                    Experimental

                    Source Code

                    function(fallbackValue) {
                    -  return require('folktale/data/conversions/maybe-to-validation')(this, fallbackValue);
                    -}
                    Authors
                    Authors
                      Maintainers
                        - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.constructor.html b/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.constructor.html deleted file mode 100644 index 24eb642..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.Just.prototype.constructor.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Just - - - - - -

                        Just

                        Signature

                        Just(value)
                        Type
                        forall a: (a) => Maybe a

                        Documentation

                        Properties

                        (Uncategorised)

                        Source Code

                        Just(value) {
                        -    return { value };
                        -  }
                        Authors
                        Authors
                          Maintainers
                            - - - - \ No newline at end of file diff --git a/docs/api/en/(unknown module).Folktale.data.maybe.inspect.html b/docs/api/en/(unknown module).Folktale.data.maybe.inspect.html deleted file mode 100644 index a619f53..0000000 --- a/docs/api/en/(unknown module).Folktale.data.maybe.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

                            toString

                            Returns a textual representation of the ADT.

                            -

                            Signature

                            toString()
                            Type
                            () => String

                            Documentation

                            Returns a textual representation of the ADT.

                            -

                            Properties

                            (Uncategorised)

                            Experimental

                            Source Code

                            () => typeName
                            Stability
                            experimental
                            Authors
                            Authors
                            • @boris-marinov
                            Maintainers
                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.html b/docs/api/en/folktale.html deleted file mode 100644 index fecdb54..0000000 --- a/docs/api/en/folktale.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - module folktale - - - - - -

                              module folktale

                              Folktale is a library for functional programming in JavaScript. It provides -combinators and data structures that make it easier to write programs by -composing existing features to build bigger things, which can be further -composed.

                              -

                              Documentation

                              Folktale is a library for functional programming in JavaScript. It provides -combinators and data structures that make it easier to write programs by -composing existing features to build bigger things, which can be further -composed.

                              -
                              -

                              TODO
                              This documentation is a stub and needs to be improved. It should give -pointers on where to start on functional programming and Folktale.

                              -
                              -

                              Properties

                              Data Structures

                              data

                              Implements common functional data structures in JavaScript.

                              -
                              Experimental

                              Essential Operations

                              core

                              Provides essential functionality for functional programs.

                              -
                              Experimental

                              Source Code

                              Defined in src/index.js at line 25, column 0
                              {
                              -  core: require('./core'),
                              -  data: require('./data')
                              -}
                              Stability
                              deprecated
                              Licence
                              MIT
                              Module
                              folktale
                              Authors
                              Authors
                              • Quildreen Motta
                              Maintainers
                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.ADT.html b/docs/api/en/folktale.src.core.adt.data.ADT.html deleted file mode 100644 index 108dff5..0000000 --- a/docs/api/en/folktale.src.core.adt.data.ADT.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - ADT - - - - - -

                                ADT

                                The basis of all algebraic data types.

                                -

                                Documentation

                                The basis of all algebraic data types.

                                -

                                ADT is used basically to share some methods for refining data structures -created by this module, derivation being one of them.

                                -

                                Properties

                                Extending ADTs

                                derive(...derivations)

                                Allows a function to provide functionality to variants in an ADT.

                                -
                                Experimental

                                Source Code

                                Defined in src/core/adt/data.js at line 279, column 0
                                {
                                -  /*~
                                -   * ---
                                -   * category : Extending ADTs
                                -   * type: |
                                -   *   ADT . (...(Variant, ADT) => Any) => ADT
                                -   */
                                -  derive(...derivations) {
                                -    derivations.forEach(derivation => {
                                -      this.variants.forEach(variant => derivation(variant, this));
                                -    });
                                -    return this;
                                -  }
                                -}
                                Stability
                                experimental
                                Licence
                                MIT
                                Module
                                folktale/src/core/adt/data
                                On This Page
                                Authors
                                Authors
                                • Quildreen Motta
                                Maintainers
                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.apply.html b/docs/api/en/folktale.src.core.adt.data.apply.html deleted file mode 100644 index 170e57c..0000000 --- a/docs/api/en/folktale.src.core.adt.data.apply.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - apply - - - - - -

                                  apply

                                  Signature

                                  apply(aMaybe)
                                  Type
                                  forall a, b: (Maybe (a) => b).(Maybe a) => Maybe b

                                  Documentation

                                  Properties

                                  (Uncategorised)

                                  A Number.

                                  -
                                  Experimental

                                  Source Code

                                  function(aMaybe) {
                                  -  assertMaybe('Maybe.Just#apply', aMaybe);
                                  -  return aMaybe.map(this.value);
                                  -}
                                  Licence
                                  MIT
                                  Module
                                  folktale/src/core/adt/data
                                  Authors
                                  Authors
                                  • Quildreen Motta
                                  Maintainers
                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.cata.html b/docs/api/en/folktale.src.core.adt.data.cata.html deleted file mode 100644 index 7075b8c..0000000 --- a/docs/api/en/folktale.src.core.adt.data.cata.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - cata - - - - - -

                                    cata

                                    Selects an operation based on this Variant's tag.

                                    -

                                    Signature

                                    cata(pattern)
                                    Type
                                    ('a is Variant).({ 'b: (Object Any) => 'c }) => 'c
                                    -where 'b = 'a[`@@folktale:adt:tag]
                                    Deprecated since 2.0.0

                                    .cata() is not a very intuitive name, and most people are -not familiar with the term catamorphism either. .matchWith() -is more familiar and conveys more information to more people.

                                    -

                                    Documentation

                                    Selects an operation based on this Variant's tag.

                                    -

                                    The catamorphism operation allows a very limited form of -pattern matching, by selecting an operation depending on this -value's tag.

                                    -

                                    Properties

                                    (Uncategorised)

                                    A Number.

                                    -
                                    Experimental

                                    A String.

                                    -
                                    Experimental

                                    Source Code

                                    Defined in src/core/adt/data.js at line 92, column 42
                                    cata(pattern) {
                                    -        warnDeprecation('`.cata(pattern)` is deprecated. Use `.matchWith(pattern)` instead.');
                                    -        return this.matchWith(pattern);
                                    -      }
                                    Stability
                                    deprecated
                                    Licence
                                    MIT
                                    Module
                                    folktale/src/core/adt/data
                                    Authors
                                    Authors
                                    • Quildreen Motta
                                    Maintainers
                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.chain.html b/docs/api/en/folktale.src.core.adt.data.chain.html deleted file mode 100644 index 1fa15f0..0000000 --- a/docs/api/en/folktale.src.core.adt.data.chain.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - chain - - - - - -

                                      chain

                                      Signature

                                      chain(transformation)
                                      Type
                                      forall a: (Maybe a).((a) => Maybe b) => Maybe b

                                      Documentation

                                      Properties

                                      (Uncategorised)

                                      A Number.

                                      -
                                      Experimental

                                      Source Code

                                      function(transformation) {
                                      -  assertFunction('Maybe.Just#chain', transformation);
                                      -  return transformation(this.value);
                                      -}
                                      Licence
                                      MIT
                                      Module
                                      folktale/src/core/adt/data
                                      Authors
                                      Authors
                                      • Quildreen Motta
                                      Maintainers
                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.constructor.html b/docs/api/en/folktale.src.core.adt.data.constructor.html deleted file mode 100644 index b65d74d..0000000 --- a/docs/api/en/folktale.src.core.adt.data.constructor.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - constructor - - - - - -

                                        constructor

                                        The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                        -

                                        Signature

                                        get constructor()

                                        Documentation

                                        The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                        -

                                        Properties

                                        (Uncategorised)

                                        Source Code

                                        Defined in src/core/adt/data.js at line 127, column 25
                                        get constructor() {
                                        -        return constructor;
                                        -      }
                                        Stability
                                        experimental
                                        Licence
                                        MIT
                                        Module
                                        folktale/src/core/adt/data
                                        Authors
                                        Authors
                                        • Quildreen Motta
                                        Maintainers
                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.data.html b/docs/api/en/folktale.src.core.adt.data.data.html deleted file mode 100644 index bc6c0ed..0000000 --- a/docs/api/en/folktale.src.core.adt.data.data.html +++ /dev/null @@ -1,483 +0,0 @@ - - - - - data - - - - - -

                                          data

                                          Constructs a tagged union data structure.

                                          -

                                          Signature

                                          data(typeId, patterns)
                                          Type
                                          (String, Object (Array String)) => ADT

                                          Documentation

                                          Constructs a tagged union data structure.

                                          -

                                          Using the ADT module:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -var List = data('List', {
                                          -  Nil(){ },
                                          -  Cons(value, rest) {
                                          -    return { value, rest };
                                          -  }
                                          -});
                                          -
                                          -var { Nil, Cons } = List;
                                          -
                                          -Cons('a', Cons('b', Cons('c', Nil())));
                                          -// ==> { value: 'a', rest: { value: 'b', ..._ }}
                                          -

                                          Why use tagged unions?

                                          -

                                          Data modelling is a very important part of programming, directly -affecting things like correctness and performance. Folktale is -in general mostly interested in correctness, and providing tools -for achieving that.

                                          -

                                          When modelling data in a program, there are several different -choices that one must make in an attempt to capture the rules of -how that data is manipulated and what they represent. Data modeling -tends to come in three different concepts:

                                          -
                                            -
                                          • Scalars represent concepts that have only one atomic -value at a time. This value makes sense on its own, and can't -be divided into further concepts. Examples of this are numers, -strings, etc.

                                            -
                                          • -
                                          • Product represent bigger concepts that are made out of -possibly several smaller concepts, each of which is independent -of each other, and always present. An object that contains a -person's name and age is an example of a product, arrays -are another example.

                                            -
                                          • -
                                          • Unions represent one of out of many concepts, at any given -time. JS doesn't have many data structure that captures the idea -of an union, but there are many cases where this happens in a -codebase:

                                            -
                                              -
                                            • Reading a file may either give you the data in that -file or an error object;

                                              -
                                            • -
                                            • Accessing a property in an object may either give you the -value or undefined;

                                              -
                                            • -
                                            • Querying a database may give you a connection error (maybe -we weren't able to contact the database), a query error -(maybe the query wasn't well formed), a "this value isn't -here" response, or the value you want.

                                              -
                                            • -
                                            -
                                          • -
                                          -

                                          Out of these, you're probably already familiar with products and scalars, -because they're used everywhere in JavaScript, but maybe you're not -familiar with unions, since JavaScript doesn't have many of them built-in.

                                          -

                                          For example, when reading a file in Node, you have this:

                                          -
                                          fs.readFile(filename, (error, value) => {
                                          -  if (error != null) {
                                          -    handleError(error);
                                          -  } else {
                                          -    handleSuccess(value);
                                          -  }
                                          -});
                                          -

                                          The callback function receives two arguments, error and value, but -only one of them may ever be present at any given time. If you have a -value, then error must be null, and if you have an error, then value -must be null. Nothing in the representation of this data tells you -that, or forces you to deal with it like that.

                                          -

                                          If you compare it with an API like fetch, where you get a Promise -instead, many of these problems are solved:

                                          -
                                          fetch(url).then(
                                          -  (response) => handleSuccess(response),
                                          -  (error)    => handleError(error)
                                          -);
                                          -

                                          Here the result of fetch can be either a response or an error, like in -the readFile example, but the only way of getting to that value is -through the then function, which requires you to define separate branches -for handling each case. This way it's not possible to forget to deal with -one of the cases, or make mistakes in the branching condition, such as -if (error == null) { handleError(...) } — which the first version of -this documentation had, in fact.

                                          -

                                          Modelling data with Core.ADT

                                          -

                                          So, properly modelling your data helps making sure that a series of errors -can't ever occurr in your program, which is great as you have to deal with -less problems, but how does Core.ADT help you in that?

                                          -

                                          A simple failure case

                                          -

                                          To answer this question let's consider a very simple, everyday problem: you -have a function that can return any value, but it can also fail. How do you -differentiate failure from regular values?

                                          -
                                          const find = (predicate, items) => {
                                          -  for (let i = 0; i < items.length; ++i) {
                                          -    const item = items[i];
                                          -    if (predicate(item))  return item;
                                          -  }
                                          -  return null;
                                          -};
                                          -

                                          The example above returns the item if the predicate matches anything, or null -if it doesn't. But null is also a valid JavaScript value:

                                          -
                                          find(x => true, [1, 2, 3]);    // ==> 1
                                          -find(x => false, [1, 2, 3]);   // ==> null
                                          -find(x => true, [null, 1, 2]); // ==> null
                                          -

                                          Now, there isn't a way of differentiating failure from success if your arrays -have a null value. One could say "this function works for arrays without -nulls", but there isn't a separate type that can enforce those guarantees -either. This confusing behaviour opens the door for bugs that are very -difficult to find, since they're created way before they hit the find -function.

                                          -

                                          A more practical approach is to return something that can't be in the array. -For example, if we return an object like: { found: Bool, value: Any }, then -we don't run into this issue:

                                          -
                                          const find2 = (predicate, items) => {
                                          -  for (let i = 0; i < items.length; ++i) {
                                          -    const item = items[i];
                                          -    if (predicate(item))  return { found: true, value: item };
                                          -  }
                                          -  return { found: false };
                                          -};
                                          -
                                          -find2(x => true, [1, 2, 3]);    // ==> { found: true, value: 1 }
                                          -find2(x => false, [1, 2, 3]);   // ==> { found: false }
                                          -find2(x => true, [null, 1, 2]); // ==> { found: true, value: null }
                                          -

                                          We can differentiate between successes and failures now, but in order to -use the value we need to unpack it. Now we have two problems: found and -value aren't entirely related, and we have to create this ad-hoc relationship -through an if statement. That's very easy to get wrong. Another problem is -that nothing forces people to check found before looking at value.

                                          -

                                          So, a better solution for this is to use tagged unions and pattern matching:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -const Maybe = data('Maybe', {
                                          -  None() { return {} },
                                          -  Some(value) { return { value } }
                                          -});
                                          -
                                          -const find3 = (predicate, items) => {
                                          -  for (let i = 0; i < items.length; ++i) {
                                          -    const item = items[i];
                                          -    if (predicate(item))  return Maybe.Some(item);
                                          -  }
                                          -  return Maybe.None();
                                          -};
                                          -
                                          -find3(x => true, [1, 2, 3]);    // ==> Maybe.Some(1)
                                          -find3(x => false, [1, 2, 3]);   // ==> Maybe.None()
                                          -find3(x => true, [null, 1, 2]); // ==> Maybe.Some(null)
                                          -
                                          -find3(x => true, [1, 2, 3]).matchWith({
                                          -  None: ()          => "Not found",
                                          -  Some: ({ value }) => "Found " + value
                                          -}); // ==> "Found 1"
                                          -

                                          Modelling complex cases

                                          -

                                          Let's consider a more complex case. Imagine you're writing a function to -handle communicating with some HTTP API. Like in the case presented in -the previous section, a call to the API may succeed or fail. Unlike the -previous example, here a failure has more information associated with it, -and we can have different kinds of failures:

                                          -
                                            -
                                          • The operation may succeed, and return a value;
                                          • -
                                          • The operation may fail:
                                              -
                                            • Because it wasn't possible to reach the API (due to a network error, for example);
                                            • -
                                            • Because the return value of the API wasn't in the expected format (unable to parse);
                                            • -
                                            • Because the API itself returned an error (e.g.: if the request had bad data in it).
                                            • -
                                            -
                                          • -
                                          -

                                          A common way of writing this in Node would be like this:

                                          -
                                          api.method((error, response) => {
                                          -  if (error != null) {
                                          -    if (error.code === "http") {
                                          -      // handle network failures here
                                          -    }
                                          -    if (error.code === "service") {
                                          -      // handle service failures here
                                          -    } 
                                          -  } else {
                                          -    try {
                                          -      var data = normalise(response);
                                          -      // handle success here 
                                          -    } catch(e) { 
                                          -      // handle invalid responses here
                                          -    }
                                          -  }
                                          -});
                                          -

                                          But again, in this style of programming it's easier to make mistakes that are hard -to catch, since we're assigning meaning through control flow in an ad-hoc manner, -and there's nothing to tell us if we've got it wrong. It's also harder to abstract, -because we can't capture these rules as data, so we have to add even more special -control flow structures to handle the abstractions.

                                          -

                                          Let's model it as a tagged union instead. We could make a single data structure -that captures all 4 possible results, and that would be a reasonable way of modelling -this. But on the other hand, we wouldn't be able to talk about failures in general, -because this forces us to handle each failure case independently. Instead we'll have -two tagged unions:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -const Result = data('Result', {
                                          -  Ok(value) {
                                          -    return { value }; 
                                          -  },
                                          -  Error(reason) {
                                          -    return { reason };
                                          -  }
                                          -});
                                          -
                                          -const APIError = data('APIError', {
                                          -  NetworkError(error){
                                          -    return { error };
                                          -  },
                                          -  ServiceError(code, message) {
                                          -    return { code, message };
                                          -  },
                                          -  ParsingError(error, data) {
                                          -    return { error, data };
                                          -  }
                                          -});
                                          -

                                          Then we can construct these values in the API, and make sure people will handle -all cases when using it:

                                          -
                                          function handleError(error) {
                                          -  error.matchWith({
                                          -    NetworkError: ({ error }) => { ... },
                                          -    ServiceError: ({ code, message }) => { ... },
                                          -    ParsingError: ({ error, data }) => { ... }
                                          -  })
                                          -}
                                          -
                                          -api.method(response => {
                                          -  response.matchWith({
                                          -    Error: ({ reason }) => handleError(reason),
                                          -    Ok:    ({ value })  => { ... }
                                          -  })
                                          -});
                                          -

                                          Providing common functionality

                                          -

                                          When you're modelling data with ADTs it's tempting to create a lot of -very specific objects to capture correctly all of the choices that may -exist in a particular domain, but Core.ADT only gives you construction -and pattern matching, so what if you want your types to have a notion -of equality?

                                          -

                                          That's where the concept of derivation comes in. A derivation is a -function that provides a set of common functionality for an ADT and -its variants. For example, if one wanted to add the notion of equality -to an ADT, they could derive Setoid as follows:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -const Setoid = require('folktale/core/adt/setoid');
                                          -
                                          -const Either = data('Either', {
                                          -  Left(value) { return { value } },
                                          -  Right(value){ return { value } }
                                          -}).derive(Setoid);
                                          -

                                          Note the .derive(Setoid) invocation. derive is a method that can -be called at any time on the ADT to provide new common functionality -to it. In this case, the Setoid derivation gives all variants an -equals() method:

                                          -
                                          Either.Left(1).equals(Either.Left(1));   // ==> true
                                          -Either.Left(1).equals(Either.Right(1));  // ==> false
                                          -Either.Right(1).equals(Either.Right(2)); // ==> false
                                          -Either.Right(2).equals(Either.Right(2)); // ==> true
                                          -

                                          While Core.ADT provides a set of common derivations (categorised -Derivation in the documentation), one may create their own derivation -functions to use with Folktale's ADTs. See the Extending ADTs -section for details.

                                          -

                                          Architecture

                                          -

                                          The ADT module approaches this problem in a structural-type-ish way, which -happens to be very similar to how OCaml's polymorphic variants work, and -how different values are handled in untyped languages.

                                          -

                                          In essence, calling data with a set of patterns results in the creation -of N constructors, each with a distinct tag.

                                          -

                                          Revisiting the previous List ADT example, when one writes:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -var List = data('List', {
                                          -  Nil:  () => {},
                                          -  Cons: (value, rest) => ({ value, rest })
                                          -})
                                          -

                                          That's roughly equivalent to the idiomatic:

                                          -
                                          var List = {};
                                          -
                                          -function Nil() { }
                                          -Nil.prototype = Object.create(List);
                                          -
                                          -function Cons(value, rest) {
                                          -  this.value = value;
                                          -  this.rest  = rest;
                                          -}
                                          -Cons.prototype = Object.create(List);
                                          -

                                          The data function takes as arguments a type identifier (which can be any -object, if you want it to be unique), and an object with the variants. Each -property in this object is expected to be a function that returns the -properties that'll be provided for the instance of that variant.

                                          -

                                          The given variants are not returned directly. Instead, we return a wrapper -that will construct a proper value of this type, and augment it with the -properties provided by that variant initialiser.

                                          -

                                          Reflection

                                          -

                                          The ADT module relies on JavaScript's built-in reflective features first, -and adds a couple of additional fields to this.

                                          -

                                          Types and Tags

                                          -

                                          The provided type for the ADT, and the tag provided for the variant -are both reified in the ADT structure and the constructed values. These -allow checking the compatibility of different values structurally, which -sidesteps the problems with realms.

                                          -

                                          The type of the ADT is provided by the global symbol @@folktale:adt:type:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -var Id = data('Identity', { Id: () => {} });
                                          -Id[Symbol.for('@@folktale:adt:type')]
                                          -// ==> 'Identity'
                                          -

                                          The tag of the value is provided by the global symbol @@folktale:adt:tag:

                                          -
                                          var List = data('List', {
                                          -  Nil: () => {},
                                          -  Cons: (h, t) => ({ h, t })
                                          -});
                                          -List.Nil()[Symbol.for('@@folktale:adt:tag')]
                                          -// ==> 'Nil'
                                          -

                                          These symbols are also exported as properties of the data function -itself, so you can use data.typeSymbol and data.tagSymbol instead -of retrieving a symbol instance with the Symbol.for function.

                                          -

                                          is-a tests

                                          -

                                          Sometimes it's desirable to test if a value belongs to an ADT or -to a variant. Out of the box the structures constructed by ADT -provide a hasInstance check that verify if a value is structurally -part of an ADT structure, by checking the Type and Tag of that value.

                                          -
                                          checking if a value belongs to an ADT:
                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -var IdA = data('IdA', { Id: (x) => ({ x }) });
                                          -var IdB = data('IdB', { Id: (x) => ({ x }) });
                                          -
                                          -IdA.hasInstance(IdA.Id(1))  // ==> true
                                          -IdA.hasInstance(IdB.Id(1))  // ==> false
                                          -
                                          checking if a value belongs to a variant:
                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -var Either = data('Either', {
                                          -  Left:  value => ({ value }),
                                          -  Right: value => ({ value })
                                          -});
                                          -var { Left, Right } = Either;
                                          -
                                          -Left.hasInstance(Left(1));  // ==> true
                                          -Left.hasInstance(Right(1)); // ==> false
                                          -

                                          Note that if two ADTs have the same type ID, they'll be considered -equivalent by hasInstance. You may pass an object (like -Symbol('type name')) to data to avoid this, however reference -equality does not work across realms in JavaScript.

                                          -

                                          Since all instances inherit from the ADT and the variant's prototype -it's also possible to use proto.isPrototypeOf(instance) to check -if an instance belongs to an ADT by reference equality, rather than -structural equality.

                                          -

                                          Extending ADTs

                                          -

                                          Because all variants inherit from the ADT namespace, it's possible -to provide new functionality to all variants by simply adding new -properties to the ADT:

                                          -
                                          const data = require('folktale/core/adt/data');
                                          -
                                          -var List = data('List', {
                                          -  Nil:  () => {},
                                          -  Cons: (value, rest) => ({ value, rest })
                                          -});
                                          -
                                          -var { Nil, Cons } = List;
                                          -
                                          -List.sum = function() {
                                          -  return this.matchWith({
                                          -    Nil:  () => 0,
                                          -    Cons: ({ value, rest }) => value + rest.sum()
                                          -  });
                                          -};
                                          -
                                          -Cons(1, Cons(2, Nil())).sum();
                                          -// ==> 3
                                          -

                                          A better approach, however, may be to use the derive function from -the ADT to provide new functionality to every variant. derive accepts -many derivation functions, which are just functions taking a variant and -and ADT, and providing new functionality for that variant.

                                          -

                                          If one wanted to define a JSON serialisation for each variant, for example, -they could do so by using the derive functionality:

                                          -
                                          function ToJSON(variant, adt) {
                                          -  var { tag, type } = variant;
                                          -  variant.prototype.toJSON = function() {
                                          -    var json = { tag: `${type}:${tag}` };
                                          -    Object.keys(this).forEach(key => {
                                          -      var value = this[key];
                                          -      if (value && typeof value.toJSON === "function") {
                                          -        json[key] = value.toJSON();
                                          -      } else {
                                          -        json[key] = value;
                                          -      }
                                          -    });
                                          -    return json;
                                          -  }
                                          -}
                                          -
                                          -var List = data('List', {
                                          -  Nil:  () => {},
                                          -  Cons: (value, rest) => ({ value, rest })
                                          -}).derive(ToJSON);
                                          -
                                          -var { Nil, Cons } = List;
                                          -
                                          -Nil().toJSON()
                                          -// ==> { tag: "List:Nil" }
                                          -
                                          -Cons(1, Nil()).toJSON()
                                          -// ==> { tag: "List:Cons", value: 1, rest: { "tag": "List:Nil" }}
                                          -

                                          Properties

                                          Data Structures

                                          ADT

                                          The basis of all algebraic data types.

                                          -
                                          Experimental

                                          (Uncategorised)

                                          Experimental

                                          A Symbol.

                                          -
                                          Experimental

                                          A Symbol.

                                          -
                                          Experimental

                                          Source Code

                                          Defined in src/core/adt/data.js at line 229, column 0
                                          (typeId, patterns) => {
                                          -  const ADTNamespace = Object.create(ADT);
                                          -  const variants     = defineVariants(typeId, patterns, ADTNamespace);
                                          -
                                          -  extend(ADTNamespace, variants, {
                                          -    // This is internal, and we don't really document it to the user
                                          -    [TYPE]: typeId,
                                          -
                                          -    /*~
                                          -     * The variants present in this ADT.
                                          -     * 
                                          -     * ---
                                          -     * category: Members
                                          -     * type: Array Variant
                                          -     * ~belongsTo: ADTNamespace
                                          -     */
                                          -    variants: values(variants),
                                          -
                                          -    /*~
                                          -     * Checks if a value belongs to this ADT.
                                          -     *
                                          -     * Values are considered to belong to an ADT if they have the same
                                          -     * `Symbol.for('@@folktale:adt:type')` property as the ADT's.
                                          -     *
                                          -     * If you don't want a structural check, you can test whether the
                                          -     * ADT is in the prototype chain of the value, but keep in mind that
                                          -     * this does not work cross-realm.
                                          -     *
                                          -     * ---
                                          -     * category  : Comparing and Testing
                                          -     * type: |
                                          -     *   ADT.(Variant) -> Boolean
                                          -     *
                                          -     * ~belongsTo: ADTNamespace
                                          -     */
                                          -    hasInstance(value) {
                                          -      return Boolean(value)
                                          -      &&     value[TYPE] === this[TYPE];
                                          -    }
                                          -  });
                                          -
                                          -  return ADTNamespace;
                                          -}
                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.derive.html b/docs/api/en/folktale.src.core.adt.data.derive.html deleted file mode 100644 index d44dbc1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.derive.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - derive - - - - - -

                                          derive

                                          Allows a function to provide functionality to variants in an ADT.

                                          -

                                          Signature

                                          derive(...derivations)
                                          Type
                                          ADT . (...(Variant, ADT) => Any) => ADT

                                          Documentation

                                          Allows a function to provide functionality to variants in an ADT.

                                          -

                                          The derive method exists to support meta-programming on ADT objects, -such that additional functionality (implementation of interfaces or -protocols, for example) may be provided by libraries instead of having -to be hand-coded by the user.

                                          -

                                          The operation accepts many derivation functions, which will be invoked -for each variant in the ADT, where a Variant is just an object with the -following attributes:

                                          -
                                          interface Variant(Any...) -> 'a <: self.prototype {
                                          -  tag         : String,
                                          -  type        : Any,
                                          -  constructor : Constructor,
                                          -  prototype   : Object
                                          -}
                                          -

                                          Properties

                                          (Uncategorised)

                                          Source Code

                                          derive(...derivations) {
                                          -    derivations.forEach(derivation => {
                                          -      this.variants.forEach(variant => derivation(variant, this));
                                          -    });
                                          -    return this;
                                          -  }
                                          Stability
                                          experimental
                                          Licence
                                          MIT
                                          Module
                                          folktale/src/core/adt/data
                                          Authors
                                          Authors
                                          • Quildreen Motta
                                          Maintainers
                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.equals.html b/docs/api/en/folktale.src.core.adt.data.equals.html deleted file mode 100644 index 7ffcbba..0000000 --- a/docs/api/en/folktale.src.core.adt.data.equals.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - equals - - - - - -

                                            equals

                                            Compares two setoids structurally.

                                            -

                                            Signature

                                            equals(value)
                                            Type
                                            forall S, a:
                                            -  (S a).(S a) => Boolean
                                            -where S is Setoid

                                            Documentation

                                            Compares two setoids structurally.

                                            -

                                            Properties

                                            (Uncategorised)

                                            Experimental

                                            Source Code

                                            function(value) {
                                            -      assertType(adt)(`${this[tagSymbol]}#equals`, value);
                                            -      return sameType(this, value) && compositesEqual(this, value, Object.keys(this));
                                            -    }
                                            Stability
                                            experimental
                                            Licence
                                            MIT
                                            Module
                                            folktale/src/core/adt/data
                                            Authors
                                            Authors
                                            • @boris-marinov
                                            • Quildreen Motta
                                            Maintainers
                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.get.html b/docs/api/en/folktale.src.core.adt.data.get.html deleted file mode 100644 index 8e1398b..0000000 --- a/docs/api/en/folktale.src.core.adt.data.get.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - get - - - - - -

                                              get

                                              Signature

                                              get()
                                              Type
                                              forall a: (Maybe a).() => a :: (throws TypeError)

                                              Documentation

                                              Properties

                                              (Uncategorised)

                                              Source Code

                                              function() {
                                              -  warnDeprecation('`.get()` is deprecated, and has been renamed to `.unsafeGet()`.');
                                              -  return this.unsafeGet();
                                              -}
                                              Stability
                                              deprecated
                                              Licence
                                              MIT
                                              Module
                                              folktale/src/core/adt/data
                                              Authors
                                              Authors
                                              • Quildreen Motta
                                              Maintainers
                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.getOrElse.html b/docs/api/en/folktale.src.core.adt.data.getOrElse.html deleted file mode 100644 index 89514af..0000000 --- a/docs/api/en/folktale.src.core.adt.data.getOrElse.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - getOrElse - - - - - -

                                                getOrElse

                                                Signature

                                                getOrElse(_default_)
                                                Type
                                                forall a: (Maybe a).(a) => a

                                                Documentation

                                                Properties

                                                (Uncategorised)

                                                A Number.

                                                -
                                                Experimental

                                                Source Code

                                                function(_default_) {
                                                -  return this.value;
                                                -}
                                                Licence
                                                MIT
                                                Module
                                                folktale/src/core/adt/data
                                                Authors
                                                Authors
                                                • Quildreen Motta
                                                Maintainers
                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.hasInstance.html b/docs/api/en/folktale.src.core.adt.data.hasInstance.html deleted file mode 100644 index e1e1a44..0000000 --- a/docs/api/en/folktale.src.core.adt.data.hasInstance.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - hasInstance - - - - - -

                                                  hasInstance

                                                  Checks if a value belongs to this Variant.

                                                  -

                                                  Signature

                                                  hasInstance(value)
                                                  Type
                                                  (Variant) => Boolean

                                                  Documentation

                                                  Checks if a value belongs to this Variant.

                                                  -

                                                  This is similar to the ADT.hasInstance check, with the -exception that we also check if the value is of the same -variant (has the same tag) as this variant.

                                                  -

                                                  Example:

                                                  -
                                                  const Either = data('Either', {
                                                  -  Left:  (value) => ({ value }),
                                                  -  Right: (value) => ({ value })
                                                  -});
                                                  -
                                                  -const { Left, Right } = Either;
                                                  -
                                                  -Left.hasInstance(Left(1));  // ==> true
                                                  -Left.hasInstance(Right(1)); // ==> false
                                                  -

                                                  Properties

                                                  (Uncategorised)

                                                  Source Code

                                                  Defined in src/core/adt/data.js at line 127, column 25
                                                  hasInstance(value) {
                                                  -        return Boolean(value) 
                                                  -        &&     adt.hasInstance(value) 
                                                  -        &&     value[TAG] === name;
                                                  -      }
                                                  Stability
                                                  experimental
                                                  Licence
                                                  MIT
                                                  Module
                                                  folktale/src/core/adt/data
                                                  Authors
                                                  Authors
                                                  • Quildreen Motta
                                                  Maintainers
                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.inspect.html b/docs/api/en/folktale.src.core.adt.data.inspect.html deleted file mode 100644 index f61c84e..0000000 --- a/docs/api/en/folktale.src.core.adt.data.inspect.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - toString - - - - - -

                                                    toString

                                                    Returns a textual representation of the ADT instance.

                                                    -

                                                    Signature

                                                    toString()
                                                    Type
                                                    (ADT).() => String

                                                    Documentation

                                                    Returns a textual representation of the ADT instance.

                                                    -

                                                    Properties

                                                    (Uncategorised)

                                                    Experimental

                                                    Source Code

                                                    function() {
                                                    -    return `${variantName}(${plainObjectToString.call(this)})`;
                                                    -  }
                                                    Stability
                                                    experimental
                                                    Licence
                                                    MIT
                                                    Module
                                                    folktale/src/core/adt/data
                                                    Authors
                                                    Authors
                                                    • @boris-marinov
                                                    Maintainers
                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isCancelled.html b/docs/api/en/folktale.src.core.adt.data.isCancelled.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isCancelled.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                      (Anonymous)

                                                      True if a value belongs to the ADT variant.

                                                      -
                                                      Deprecated since 2.0.0

                                                      Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                      -

                                                      Documentation

                                                      True if a value belongs to the ADT variant.

                                                      -

                                                      Properties

                                                      (Uncategorised)

                                                      Source Code

                                                      Defined in src/core/adt/data.js at line 55, column 42
                                                      get [`is${name}`]() {
                                                      -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                      -instead to check if a value belongs to the ADT variant.`);
                                                      -        return true;
                                                      -      }
                                                      Stability
                                                      deprecated
                                                      Licence
                                                      MIT
                                                      Module
                                                      folktale/src/core/adt/data
                                                      On This Page
                                                      Authors
                                                      Authors
                                                      • Quildreen Motta
                                                      Maintainers
                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isError.html b/docs/api/en/folktale.src.core.adt.data.isError.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isError.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                        (Anonymous)

                                                        True if a value belongs to the ADT variant.

                                                        -
                                                        Deprecated since 2.0.0

                                                        Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                        -

                                                        Documentation

                                                        True if a value belongs to the ADT variant.

                                                        -

                                                        Properties

                                                        (Uncategorised)

                                                        Source Code

                                                        Defined in src/core/adt/data.js at line 55, column 42
                                                        get [`is${name}`]() {
                                                        -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                        -instead to check if a value belongs to the ADT variant.`);
                                                        -        return true;
                                                        -      }
                                                        Stability
                                                        deprecated
                                                        Licence
                                                        MIT
                                                        Module
                                                        folktale/src/core/adt/data
                                                        On This Page
                                                        Authors
                                                        Authors
                                                        • Quildreen Motta
                                                        Maintainers
                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isJust.html b/docs/api/en/folktale.src.core.adt.data.isJust.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isJust.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                          (Anonymous)

                                                          True if a value belongs to the ADT variant.

                                                          -
                                                          Deprecated since 2.0.0

                                                          Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                          -

                                                          Documentation

                                                          True if a value belongs to the ADT variant.

                                                          -

                                                          Properties

                                                          (Uncategorised)

                                                          Source Code

                                                          Defined in src/core/adt/data.js at line 55, column 42
                                                          get [`is${name}`]() {
                                                          -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                          -instead to check if a value belongs to the ADT variant.`);
                                                          -        return true;
                                                          -      }
                                                          Stability
                                                          deprecated
                                                          Licence
                                                          MIT
                                                          Module
                                                          folktale/src/core/adt/data
                                                          On This Page
                                                          Authors
                                                          Authors
                                                          • Quildreen Motta
                                                          Maintainers
                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isLeft.html b/docs/api/en/folktale.src.core.adt.data.isLeft.html deleted file mode 100644 index 03f7344..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isLeft.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                            (Anonymous)

                                                            True if a value belongs to the ADT variant.

                                                            -
                                                            Deprecated since 2.0.0

                                                            Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                            -

                                                            Documentation

                                                            True if a value belongs to the ADT variant.

                                                            -

                                                            Properties

                                                            (Uncategorised)

                                                            Source Code

                                                            Defined in src/core/adt/data.js at line 92, column 42
                                                            get [`is${name}`]() {
                                                            -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                            -instead to check if a value belongs to the ADT variant.`);
                                                            -        return true;
                                                            -      }
                                                            Stability
                                                            deprecated
                                                            Licence
                                                            MIT
                                                            Module
                                                            folktale/src/core/adt/data
                                                            On This Page
                                                            Authors
                                                            Authors
                                                            • Quildreen Motta
                                                            Maintainers
                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isNothing.html b/docs/api/en/folktale.src.core.adt.data.isNothing.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isNothing.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                              (Anonymous)

                                                              True if a value belongs to the ADT variant.

                                                              -
                                                              Deprecated since 2.0.0

                                                              Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                              -

                                                              Documentation

                                                              True if a value belongs to the ADT variant.

                                                              -

                                                              Properties

                                                              (Uncategorised)

                                                              Source Code

                                                              Defined in src/core/adt/data.js at line 55, column 42
                                                              get [`is${name}`]() {
                                                              -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                              -instead to check if a value belongs to the ADT variant.`);
                                                              -        return true;
                                                              -      }
                                                              Stability
                                                              deprecated
                                                              Licence
                                                              MIT
                                                              Module
                                                              folktale/src/core/adt/data
                                                              On This Page
                                                              Authors
                                                              Authors
                                                              • Quildreen Motta
                                                              Maintainers
                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isOk.html b/docs/api/en/folktale.src.core.adt.data.isOk.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isOk.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                                (Anonymous)

                                                                True if a value belongs to the ADT variant.

                                                                -
                                                                Deprecated since 2.0.0

                                                                Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                                -

                                                                Documentation

                                                                True if a value belongs to the ADT variant.

                                                                -

                                                                Properties

                                                                (Uncategorised)

                                                                Source Code

                                                                Defined in src/core/adt/data.js at line 55, column 42
                                                                get [`is${name}`]() {
                                                                -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                                -instead to check if a value belongs to the ADT variant.`);
                                                                -        return true;
                                                                -      }
                                                                Stability
                                                                deprecated
                                                                Licence
                                                                MIT
                                                                Module
                                                                folktale/src/core/adt/data
                                                                On This Page
                                                                Authors
                                                                Authors
                                                                • Quildreen Motta
                                                                Maintainers
                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isPending.html b/docs/api/en/folktale.src.core.adt.data.isPending.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isPending.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                                  (Anonymous)

                                                                  True if a value belongs to the ADT variant.

                                                                  -
                                                                  Deprecated since 2.0.0

                                                                  Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                                  -

                                                                  Documentation

                                                                  True if a value belongs to the ADT variant.

                                                                  -

                                                                  Properties

                                                                  (Uncategorised)

                                                                  Source Code

                                                                  Defined in src/core/adt/data.js at line 55, column 42
                                                                  get [`is${name}`]() {
                                                                  -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                                  -instead to check if a value belongs to the ADT variant.`);
                                                                  -        return true;
                                                                  -      }
                                                                  Stability
                                                                  deprecated
                                                                  Licence
                                                                  MIT
                                                                  Module
                                                                  folktale/src/core/adt/data
                                                                  On This Page
                                                                  Authors
                                                                  Authors
                                                                  • Quildreen Motta
                                                                  Maintainers
                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isRejected.html b/docs/api/en/folktale.src.core.adt.data.isRejected.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isRejected.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                                    (Anonymous)

                                                                    True if a value belongs to the ADT variant.

                                                                    -
                                                                    Deprecated since 2.0.0

                                                                    Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                                    -

                                                                    Documentation

                                                                    True if a value belongs to the ADT variant.

                                                                    -

                                                                    Properties

                                                                    (Uncategorised)

                                                                    Source Code

                                                                    Defined in src/core/adt/data.js at line 55, column 42
                                                                    get [`is${name}`]() {
                                                                    -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                                    -instead to check if a value belongs to the ADT variant.`);
                                                                    -        return true;
                                                                    -      }
                                                                    Stability
                                                                    deprecated
                                                                    Licence
                                                                    MIT
                                                                    Module
                                                                    folktale/src/core/adt/data
                                                                    On This Page
                                                                    Authors
                                                                    Authors
                                                                    • Quildreen Motta
                                                                    Maintainers
                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isResolved.html b/docs/api/en/folktale.src.core.adt.data.isResolved.html deleted file mode 100644 index 4ce9da1..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isResolved.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                                      (Anonymous)

                                                                      True if a value belongs to the ADT variant.

                                                                      -
                                                                      Deprecated since 2.0.0

                                                                      Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                                      -

                                                                      Documentation

                                                                      True if a value belongs to the ADT variant.

                                                                      -

                                                                      Properties

                                                                      (Uncategorised)

                                                                      Source Code

                                                                      Defined in src/core/adt/data.js at line 55, column 42
                                                                      get [`is${name}`]() {
                                                                      -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                                      -instead to check if a value belongs to the ADT variant.`);
                                                                      -        return true;
                                                                      -      }
                                                                      Stability
                                                                      deprecated
                                                                      Licence
                                                                      MIT
                                                                      Module
                                                                      folktale/src/core/adt/data
                                                                      On This Page
                                                                      Authors
                                                                      Authors
                                                                      • Quildreen Motta
                                                                      Maintainers
                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.isRight.html b/docs/api/en/folktale.src.core.adt.data.isRight.html deleted file mode 100644 index 03f7344..0000000 --- a/docs/api/en/folktale.src.core.adt.data.isRight.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - -

                                                                        (Anonymous)

                                                                        True if a value belongs to the ADT variant.

                                                                        -
                                                                        Deprecated since 2.0.0

                                                                        Having a value.isFoo property doesn't allow people to -differentiate two variants from different ADTs that have the -same name. So, instead, now variants and ADTs come with a -static .hasInstance(value) method.

                                                                        -

                                                                        Documentation

                                                                        True if a value belongs to the ADT variant.

                                                                        -

                                                                        Properties

                                                                        (Uncategorised)

                                                                        Source Code

                                                                        Defined in src/core/adt/data.js at line 92, column 42
                                                                        get [`is${name}`]() {
                                                                        -        warnDeprecation(`.is${name} is deprecated. Use ${name}.hasInstance(value)
                                                                        -instead to check if a value belongs to the ADT variant.`);
                                                                        -        return true;
                                                                        -      }
                                                                        Stability
                                                                        deprecated
                                                                        Licence
                                                                        MIT
                                                                        Module
                                                                        folktale/src/core/adt/data
                                                                        On This Page
                                                                        Authors
                                                                        Authors
                                                                        • Quildreen Motta
                                                                        Maintainers
                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.map.html b/docs/api/en/folktale.src.core.adt.data.map.html deleted file mode 100644 index 3b35996..0000000 --- a/docs/api/en/folktale.src.core.adt.data.map.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - map - - - - - -

                                                                          map

                                                                          Signature

                                                                          map(transformation)
                                                                          Type
                                                                          forall a, b: (Maybe a).((a) => b) => Maybe b

                                                                          Documentation

                                                                          Properties

                                                                          (Uncategorised)

                                                                          A Number.

                                                                          -
                                                                          Experimental

                                                                          Source Code

                                                                          function(transformation) {
                                                                          -  assertFunction('Maybe.Nothing#map',  transformation);
                                                                          -  return Just(transformation(this.value));
                                                                          -}
                                                                          Licence
                                                                          MIT
                                                                          Module
                                                                          folktale/src/core/adt/data
                                                                          Authors
                                                                          Authors
                                                                          • Quildreen Motta
                                                                          Maintainers
                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.matchWith.html b/docs/api/en/folktale.src.core.adt.data.matchWith.html deleted file mode 100644 index 98b48d4..0000000 --- a/docs/api/en/folktale.src.core.adt.data.matchWith.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - matchWith - - - - - -

                                                                            matchWith

                                                                            Selects an operation based on this Variant's tag.

                                                                            -

                                                                            Signature

                                                                            matchWith(pattern)
                                                                            Type
                                                                            ('a is Variant).({ 'b: (Object Any) => 'c }) => 'c
                                                                            -where 'b = 'a[`@@folktale:adt:tag]

                                                                            Documentation

                                                                            Selects an operation based on this Variant's tag.

                                                                            -

                                                                            The matchWith operation allows a very limited form of -pattern matching, by selecting an operation depending on this -value's tag.

                                                                            -

                                                                            Example:

                                                                            -
                                                                            const List = data('List', {
                                                                            -  Nil:  ()           => ({}),
                                                                            -  Cons: (head, tail) => ({ head, tail })
                                                                            -});
                                                                            -
                                                                            -const { Nil, Cons } = List;
                                                                            -
                                                                            -const sum = (list) => list.matchWith({
                                                                            -  Nil:  ()               => 0,
                                                                            -  Cons: ({ head, tail }) => head + sum(tail)  
                                                                            -});
                                                                            -
                                                                            -sum(Cons(1, Cons(2, Nil()))); // ==> 3
                                                                            -

                                                                            Properties

                                                                            (Uncategorised)

                                                                            Source Code

                                                                            Defined in src/core/adt/data.js at line 55, column 42
                                                                            matchWith(pattern) {
                                                                            -        return pattern[name](this);
                                                                            -      }
                                                                            Stability
                                                                            experimental
                                                                            Licence
                                                                            MIT
                                                                            Module
                                                                            folktale/src/core/adt/data
                                                                            Authors
                                                                            Authors
                                                                            • Quildreen Motta
                                                                            Maintainers
                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.orElse.html b/docs/api/en/folktale.src.core.adt.data.orElse.html deleted file mode 100644 index 2c39334..0000000 --- a/docs/api/en/folktale.src.core.adt.data.orElse.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - orElse - - - - - -

                                                                              orElse

                                                                              category: Recovering from errors -type: | - forall a: (Maybe a).((a) => Maybe a) => Maybe a

                                                                              -

                                                                              Signature

                                                                              orElse()

                                                                              Documentation

                                                                              category: Recovering from errors -type: | - forall a: (Maybe a).((a) => Maybe a) => Maybe a

                                                                              -

                                                                              Properties

                                                                              (Uncategorised)

                                                                              Source Code

                                                                              function() {
                                                                              -  return this;
                                                                              -}
                                                                              Licence
                                                                              MIT
                                                                              Module
                                                                              folktale/src/core/adt/data
                                                                              Authors
                                                                              Authors
                                                                              • Quildreen Motta
                                                                              Maintainers
                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.prototype.html b/docs/api/en/folktale.src.core.adt.data.prototype.html deleted file mode 100644 index 26aac0c..0000000 --- a/docs/api/en/folktale.src.core.adt.data.prototype.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - prototype - - - - - -

                                                                                prototype

                                                                                The object that provides common behaviours for instances of this variant.

                                                                                -

                                                                                Documentation

                                                                                The object that provides common behaviours for instances of this variant.

                                                                                -

                                                                                Properties

                                                                                Comparing and Testing

                                                                                hasInstance(value)

                                                                                Checks if a value belongs to this ADT.

                                                                                -
                                                                                Inherited

                                                                                Comparing and testing

                                                                                equals(value)

                                                                                Compares two setoids structurally.

                                                                                -
                                                                                Experimental

                                                                                Constructing

                                                                                Error(value)

                                                                                Constructs a Result whose value represents a failure.

                                                                                -
                                                                                ExperimentalInherited
                                                                                Ok(value)

                                                                                Constructs a Result whose value represents a success.

                                                                                -
                                                                                ExperimentalInherited
                                                                                of(value)

                                                                                Constructs a Result holding an Ok value.

                                                                                -
                                                                                ExperimentalInherited

                                                                                Converting

                                                                                toMaybe()

                                                                                Transforms a Result into a Maybe. Error values are lost in the process.

                                                                                -
                                                                                ExperimentalInherited
                                                                                toValidation()

                                                                                Transforms a Result into a Validation.

                                                                                -
                                                                                ExperimentalInherited

                                                                                Debug Representation

                                                                                inspect: toString()

                                                                                Returns a textual representation of the ADT instance.

                                                                                -
                                                                                Experimental
                                                                                toString()

                                                                                Returns a textual representation of the ADT instance.

                                                                                -
                                                                                Experimental

                                                                                Extending ADTs

                                                                                derive(...derivations)

                                                                                Allows a function to provide functionality to variants in an ADT.

                                                                                -
                                                                                ExperimentalInherited

                                                                                Extracting values

                                                                                get()

                                                                                This method has been renamed to unsafeGet().

                                                                                -
                                                                                DeprecatedInherited
                                                                                getOrElse(default)

                                                                                Extracts the value of a Result structure, if it exists (i.e.: is an Ok), -otherwise returns the provided default value.

                                                                                -
                                                                                Experimental
                                                                                merge()

                                                                                Returns the value inside of the Result structure, regardless of its state.

                                                                                -
                                                                                ExperimentalInherited
                                                                                unsafeGet()

                                                                                Extracts the value from a Result structure.

                                                                                -
                                                                                Experimental

                                                                                Fantasy Land

                                                                                ap(that)

                                                                                Fantasy Land's Apply ap

                                                                                -
                                                                                fantasy-land/ap(that)

                                                                                Fantasy Land's Apply ap

                                                                                -
                                                                                fantasy-land/bimap(f, g)

                                                                                Fantasy Land’s Bifunctor bimap

                                                                                -
                                                                                fantasy-land/chain(transformation)

                                                                                Fantasy Land’s Chain chain.

                                                                                -
                                                                                fantasy-land/equals(that)

                                                                                Fantasy Land's Setoid `equals'.

                                                                                -
                                                                                fantasy-land/map(transformation)

                                                                                Fantasy Land's Functor map.

                                                                                -
                                                                                fantasy-land/of(value)

                                                                                Fantasy Land's Applicative of

                                                                                -

                                                                                Members

                                                                                variants

                                                                                The variants present in this ADT.

                                                                                -
                                                                                Inherited

                                                                                Pattern matching

                                                                                fold(ErrorTransformation, OkTransformation)

                                                                                Applies a function to each case of a Result.

                                                                                -
                                                                                Experimental

                                                                                Recovering

                                                                                orElse(handler)

                                                                                Allows recovering from Error values with a handler function.

                                                                                -
                                                                                Experimental

                                                                                Serialisation

                                                                                fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

                                                                                Parses a previously serialised ADT into a rich ADT object.

                                                                                -
                                                                                ExperimentalInherited
                                                                                toJSON()

                                                                                Serialises a variant to JSON.

                                                                                -
                                                                                Experimental

                                                                                State and configuration

                                                                                get value

                                                                                The value contained in an Ok instance of the Result structure.

                                                                                -
                                                                                Abstract

                                                                                Testing and Comparing

                                                                                get isOk

                                                                                True if a value belongs to the ADT variant.

                                                                                -
                                                                                Deprecated

                                                                                Transforming

                                                                                apply(anResult)

                                                                                Applies the function contained in one Result to the value in another Result. -Application only occurs if both Results are Ok, otherwise keeps the first -Error.

                                                                                -
                                                                                Experimental
                                                                                bimap(ErrorTransformation, OkTransformation)

                                                                                Transforms each side of a Result with a function, without changing the context -of the computation. That is, Errors will still be Errors, Oks will still be -Oks.

                                                                                -
                                                                                Experimental
                                                                                chain(transformation)

                                                                                Transforms the value and context of a Result computation with an unary function. -As with .map(), the transformation is only applied if the value is an Ok, -but the transformation is expected a new Result value, which then becomes the -result of the method.

                                                                                -
                                                                                Experimental
                                                                                map(transformation)

                                                                                Transforms the value inside of a Result structure with an unary function without -changing the context of the computation. That is, Error values continue to be -Error values, and Ok values continue to be Ok values.

                                                                                -
                                                                                Experimental
                                                                                mapError(transformation)

                                                                                Transforms the value inside an Error without changing the context of the -computation.

                                                                                -
                                                                                Experimental
                                                                                matchWith(pattern)

                                                                                Selects an operation based on this Variant's tag.

                                                                                -
                                                                                Experimental
                                                                                swap()

                                                                                Inverts the context of a Result value such that Errors are transformed into Oks, -and Oks are transformed into Errors. Does not touch the value inside of the -Result.

                                                                                -
                                                                                Experimental

                                                                                Source Code

                                                                                Defined in src/core/adt/data.js at line 127, column 25
                                                                                InternalConstructor.prototype
                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.tag.html b/docs/api/en/folktale.src.core.adt.data.tag.html deleted file mode 100644 index d079d9b..0000000 --- a/docs/api/en/folktale.src.core.adt.data.tag.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - tag - - - - - -

                                                                                tag

                                                                                The unique tag for this variant within the ADT.

                                                                                -

                                                                                Signature

                                                                                get tag()

                                                                                Documentation

                                                                                The unique tag for this variant within the ADT.

                                                                                -

                                                                                Properties

                                                                                (Uncategorised)

                                                                                Source Code

                                                                                Defined in src/core/adt/data.js at line 127, column 25
                                                                                get tag() {
                                                                                -        return name;
                                                                                -      }
                                                                                Stability
                                                                                experimental
                                                                                Licence
                                                                                MIT
                                                                                Module
                                                                                folktale/src/core/adt/data
                                                                                Authors
                                                                                Authors
                                                                                • Quildreen Motta
                                                                                Maintainers
                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.toJSON.html b/docs/api/en/folktale.src.core.adt.data.toJSON.html deleted file mode 100644 index 0bf1ccc..0000000 --- a/docs/api/en/folktale.src.core.adt.data.toJSON.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - toJSON - - - - - -

                                                                                  toJSON

                                                                                  Serialises a variant to JSON.

                                                                                  -

                                                                                  Signature

                                                                                  toJSON()
                                                                                  Type
                                                                                  type JSONSerialisation = {
                                                                                  -  "@@type":  String,
                                                                                  -  "@@tag":   String,
                                                                                  -  "@@value": Object Any
                                                                                  -}
                                                                                  -
                                                                                  -Variant . () => JSONSerialisation

                                                                                  Documentation

                                                                                  Serialises a variant to JSON.

                                                                                  -

                                                                                  Example:

                                                                                  -
                                                                                  const { data, setoid } = require('folktale/core/adt');
                                                                                  -const Id = data('Id', {
                                                                                  -  Id(value){ return { value } }
                                                                                  -}).derive(serialize, setoid);
                                                                                  -
                                                                                  -Id.Id(1).toJSON();
                                                                                  -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                  -

                                                                                  Properties

                                                                                  (Uncategorised)

                                                                                  Experimental

                                                                                  Source Code

                                                                                  function() {
                                                                                  -    return { 
                                                                                  -      [typeJsonKey]:  typeName, 
                                                                                  -      [tagJsonKey]:   tagName, 
                                                                                  -      [valueJsonKey]: mapValues(this, serializeValue) 
                                                                                  -    };
                                                                                  -  }
                                                                                  Stability
                                                                                  experimental
                                                                                  Licence
                                                                                  MIT
                                                                                  Module
                                                                                  folktale/src/core/adt/data
                                                                                  Authors
                                                                                  Authors
                                                                                  • @boris-marinov
                                                                                  Maintainers
                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.type.html b/docs/api/en/folktale.src.core.adt.data.type.html deleted file mode 100644 index 52f0167..0000000 --- a/docs/api/en/folktale.src.core.adt.data.type.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - type - - - - - -

                                                                                    type

                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                    -

                                                                                    Signature

                                                                                    get type()

                                                                                    Documentation

                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                    -

                                                                                    Properties

                                                                                    (Uncategorised)

                                                                                    Source Code

                                                                                    Defined in src/core/adt/data.js at line 127, column 25
                                                                                    get type() {
                                                                                    -        return typeId;
                                                                                    -      }
                                                                                    Stability
                                                                                    experimental
                                                                                    Licence
                                                                                    MIT
                                                                                    Module
                                                                                    folktale/src/core/adt/data
                                                                                    Authors
                                                                                    Authors
                                                                                    • Quildreen Motta
                                                                                    Maintainers
                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.unsafeGet.html b/docs/api/en/folktale.src.core.adt.data.unsafeGet.html deleted file mode 100644 index 9074a1e..0000000 --- a/docs/api/en/folktale.src.core.adt.data.unsafeGet.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - unsafeGet - - - - - -

                                                                                      unsafeGet

                                                                                      Signature

                                                                                      unsafeGet()
                                                                                      Type
                                                                                      forall a: (Maybe a).() => a :: (throws TypeError)

                                                                                      Documentation

                                                                                      Properties

                                                                                      (Uncategorised)

                                                                                      Source Code

                                                                                      function() {
                                                                                      -  return this.value;
                                                                                      -}
                                                                                      Licence
                                                                                      MIT
                                                                                      Module
                                                                                      folktale/src/core/adt/data
                                                                                      Authors
                                                                                      Authors
                                                                                      • Quildreen Motta
                                                                                      Maintainers
                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.data.variants.html b/docs/api/en/folktale.src.core.adt.data.variants.html deleted file mode 100644 index 171853b..0000000 --- a/docs/api/en/folktale.src.core.adt.data.variants.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - variants - - - - - -

                                                                                        variants

                                                                                        The variants present in this ADT.

                                                                                        -

                                                                                        Signature

                                                                                        Type
                                                                                        Array Variant

                                                                                        Documentation

                                                                                        The variants present in this ADT.

                                                                                        -

                                                                                        Properties

                                                                                        Constructing

                                                                                        0: Error(value)

                                                                                        Constructs a Result whose value represents a failure.

                                                                                        -
                                                                                        Experimental
                                                                                        1: Ok(value)

                                                                                        Constructs a Result whose value represents a success.

                                                                                        -
                                                                                        Experimental

                                                                                        (Uncategorised)

                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited

                                                                                        A Number.

                                                                                        -
                                                                                        Experimental
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited
                                                                                        Inherited

                                                                                        Source Code

                                                                                        Defined in src/core/adt/data.js at line 233, column 33
                                                                                        values(variants)
                                                                                        Stability
                                                                                        deprecated
                                                                                        Licence
                                                                                        MIT
                                                                                        Module
                                                                                        folktale/src/core/adt/data
                                                                                        Authors
                                                                                        Authors
                                                                                        • Quildreen Motta
                                                                                        Maintainers
                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.html b/docs/api/en/folktale.src.core.adt.html deleted file mode 100644 index 4087ae1..0000000 --- a/docs/api/en/folktale.src.core.adt.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - module folktale/core/adt - - - - - -

                                                                                          module folktale/core/adt

                                                                                          Provides utilities to define tagged unions.

                                                                                          -

                                                                                          Documentation

                                                                                          Provides utilities to define tagged unions.

                                                                                          -

                                                                                          Programming with Tagged Unions

                                                                                          -

                                                                                          Modelling data is important for a range of reasons. From performance -to correctness to safety. Tagged unions give you a way of modelling -choices that forces the correct handling of them, unlike predicate-based -branching, such as the one used by if statements and other common -control flow structures.

                                                                                          -

                                                                                          Most of the structures provided by Folktale are tagged unions. But -Folktale also gives you a primitive for constructing new ones in an -easy way. The data function provided by this module achieves that -goal:

                                                                                          -
                                                                                          const data = require('folktale/core/adt/data');
                                                                                          -
                                                                                          -const Maybe = data('Maybe', {
                                                                                          -  Some(value){ return { value } },
                                                                                          -  None() { return {} }
                                                                                          -});
                                                                                          -
                                                                                          -Maybe.Some(1).matchWith({
                                                                                          -  Some: ({ value }) => `Found ${value}`,
                                                                                          -  None: ()          => "Not found" 
                                                                                          -});
                                                                                          -// ==> "Found 1"
                                                                                          -

                                                                                          Tagged unions constructed by this module allow one to easily bestow -common functionality in them through the derive function. For example, -one could add the concept of equality to the Maybe data structure -constructed previously by using the Setoid derivation, which is also -provided by this module:

                                                                                          -
                                                                                          const Setoid = require('folktale/core/adt/setoid');
                                                                                          -Maybe.derive(Setoid);
                                                                                          -
                                                                                          -Maybe.Some(1).equals(Maybe.Some(1)); // ==> true
                                                                                          -Maybe.Some(2).equals(Maybe.Some(1)); // ==> false
                                                                                          -

                                                                                          These structures also provide a way of testing if a value belongs to -an ADT in a cross-realm way using the .hasInstance method on the ADT -or variant:

                                                                                          -
                                                                                          Maybe.hasInstance(Maybe.None());       // ==> true
                                                                                          -Maybe.Some.hasInstance(Maybe.None());  // ==> false
                                                                                          -Maybe.Some.hasInstance(Maybe.Some(1)); // ==> true
                                                                                          -

                                                                                          See the documentation on the data function for details.

                                                                                          -

                                                                                          What's in Core.ADT?

                                                                                          -

                                                                                          Core.ADT provides features to construct tagged unions, and common -derivations for those structures. These operations are divided as -follows:

                                                                                          -
                                                                                            -
                                                                                          • Constructing Data Structures: functions that construct new -tagged unions.

                                                                                            -
                                                                                          • -
                                                                                          • Extending ADTs: functions that allow one to extend existing -ADTs and variants with new functionality.

                                                                                            -
                                                                                          • -
                                                                                          • Derivation: functions that can be used as derivations to -provide common functionality to ADTs.

                                                                                            -
                                                                                          • -
                                                                                          -

                                                                                          Properties

                                                                                          Constructing Data Structures

                                                                                          data(typeId, patterns)

                                                                                          Constructs a tagged union data structure.

                                                                                          -
                                                                                          Experimental

                                                                                          Derivation

                                                                                          serialize(variant, adt)

                                                                                          Provides JSON serialisation and parsing for ADTs.

                                                                                          -
                                                                                          Experimental
                                                                                          setoid: createDerivation(valuesEqual)

                                                                                          Provides structural equality for ADTs.

                                                                                          -
                                                                                          Experimental
                                                                                          show(variant, adt)

                                                                                          Provides a textual representation for ADTs.

                                                                                          -
                                                                                          Experimental

                                                                                          Source Code

                                                                                          Defined in src/core/adt/index.js at line 15, column 0
                                                                                          {
                                                                                          -  data: require('./data'),
                                                                                          -  setoid: require('./setoid'),
                                                                                          -  show: require('./show'),
                                                                                          -  serialize: require('./serialize')
                                                                                          -}
                                                                                          Stability
                                                                                          experimental
                                                                                          Licence
                                                                                          MIT
                                                                                          Module
                                                                                          folktale/src/core/adt
                                                                                          Authors
                                                                                          Authors
                                                                                          • Quildreen Motta
                                                                                          Maintainers
                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.serialize.serialize.html b/docs/api/en/folktale.src.core.adt.serialize.serialize.html deleted file mode 100644 index 06d82fc..0000000 --- a/docs/api/en/folktale.src.core.adt.serialize.serialize.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - serialize - - - - - -

                                                                                            serialize

                                                                                            Provides JSON serialisation and parsing for ADTs.

                                                                                            -

                                                                                            Signature

                                                                                            serialize(variant, adt)
                                                                                            Type
                                                                                            (Variant, ADT) => Void

                                                                                            Documentation

                                                                                            Provides JSON serialisation and parsing for ADTs.

                                                                                            -

                                                                                            The serialize derivation bestows .toJSON() and .fromJSON(value) -upon ADTs constructed by Core.ADT. Both serialisation and parsing -are recursive, and .fromJSON can automatically reify values of -other types.

                                                                                            -

                                                                                            Example:

                                                                                            -
                                                                                            const { data, setoid, serialize } = require('folktale/core/adt');
                                                                                            -const Id = data('Id', {
                                                                                            -  Id(value){ return { value } }
                                                                                            -}).derive(serialize, setoid);
                                                                                            -
                                                                                            -Id.Id(1).toJSON();
                                                                                            -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                            -
                                                                                            -Id.fromJSON(Id.Id(1).toJSON());
                                                                                            -// ==> Id.Id(1)
                                                                                            -

                                                                                            JSON serialisation

                                                                                            -

                                                                                            This derivation provides JSON serialisation through the .toJSON method, -which converts rich ADTs into objects that can be safely serialised as -JSON. For example:

                                                                                            -
                                                                                            const { data, serialize } = require('folktale/core/adt');
                                                                                            -
                                                                                            -const { Id } = data('Id', {
                                                                                            -  Id(value){ return { value } }
                                                                                            -}).derive(serialize);
                                                                                            -
                                                                                            -Id(1).toJSON();
                                                                                            -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                            -

                                                                                            During the transformation, if any of the values contains a .toJSON -method, that's called to serialise the structure. Otherwise the value is -just returned as-is:

                                                                                            -
                                                                                            Id(Id(1)).toJSON();
                                                                                            -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: { '@@type': 'Id', '@@tag': 'Id', '@@value': { 'value': 1 } } } }
                                                                                            -

                                                                                            It's not necessary to call the .toJSON() method directly in most cases, since -JSON.stringify will already invoke that for you:

                                                                                            -
                                                                                            JSON.stringify(Id(1));
                                                                                            -// ==> '{"@@type":"Id","@@tag":"Id","@@value":{"value":1}}'
                                                                                            -
                                                                                            -JSON.stringify(Id([Id(1)]));
                                                                                            -// ==> '{"@@type":"Id","@@tag":"Id","@@value":{"value":[{"@@type":"Id","@@tag":"Id","@@value":{"value":1}}]}}'
                                                                                            -

                                                                                            JSON parsing

                                                                                            -

                                                                                            The reverse process of serialisation is parsing, and the .fromJSON method -provided by this derivation is able to reconstruct the proper ADT from -serialised data:

                                                                                            -
                                                                                            const { data, setoid, serialize } = require('folktale/core/adt');
                                                                                            -
                                                                                            -const Id = data('Id', {
                                                                                            -  Id(value){ return { value } }
                                                                                            -}).derive(serialize, setoid);
                                                                                            -
                                                                                            -const json = Id.Id(1).toJSON();
                                                                                            -Id.fromJSON(json);
                                                                                            -// ==> Id.Id(1)
                                                                                            -

                                                                                            In general, as long as the values in an ADT are either ADT instances or simple -values supported by JSON, the following equivalence holds:

                                                                                            -
                                                                                            ADT.fromJSON(adt.toJSON()) = adt
                                                                                            -

                                                                                            Some ADTs instances may contain other ADT instances as values. Serialising them -is simple because JavaScript's dispatch takes care of selecting the correct -serialisation for us. With parsing we don't have that luck, so instead the -ADT takes a list of parsers as argument:

                                                                                            -
                                                                                            const A = data('A', { 
                                                                                            -  A(value) { return { value } }
                                                                                            -}).derive(serialize, setoid);
                                                                                            -
                                                                                            -const B = data('B', {
                                                                                            -  B(value) { return { value } }
                                                                                            -}).derive(serialize, setoid);
                                                                                            -
                                                                                            -A.fromJSON(A.A(B.B(1)).toJSON(), [A, B]);
                                                                                            -// ==> A.A(B.B(1))
                                                                                            -

                                                                                            The serialisation format

                                                                                            -

                                                                                            In order to support the serialisatio and parsing of ADTs, this module -uses a specific format that encodes that information in the serialised -data. This way, .toJSON() produces values of this interface, and -.fromJSON(value) expects values of this interface:

                                                                                            -
                                                                                            type JSONSerialisation = {
                                                                                            -  "@@type":  String,
                                                                                            -  "@@tag":   String,
                                                                                            -  "@@value": Object Any
                                                                                            -}
                                                                                            -

                                                                                            Properties

                                                                                            (Uncategorised)

                                                                                            Experimental

                                                                                            Source Code

                                                                                            Defined in src/core/adt/serialize.js at line 124, column 0
                                                                                            (variant, adt) => {
                                                                                            -  const typeName = adt[typeSymbol];
                                                                                            -  const tagName = variant.prototype[tagSymbol];
                                                                                            -
                                                                                            -  /*~
                                                                                            -   * Serialises a variant to JSON.
                                                                                            -   * 
                                                                                            -   * ## Example::
                                                                                            -   * 
                                                                                            -   *     const { data, setoid } = require('folktale/core/adt');
                                                                                            -   *     const Id = data('Id', {
                                                                                            -   *       Id(value){ return { value } }
                                                                                            -   *     }).derive(serialize, setoid);
                                                                                            -   * 
                                                                                            -   *     Id.Id(1).toJSON();
                                                                                            -   *     // ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                            -   *
                                                                                            -   * 
                                                                                            -   * ---
                                                                                            -   * category: Serialisation
                                                                                            -   * stability: experimental
                                                                                            -   * authors:
                                                                                            -   *   - "@boris-marinov"
                                                                                            -   * 
                                                                                            -   * type: |
                                                                                            -   *   type JSONSerialisation = {
                                                                                            -   *     "@@type":  String,
                                                                                            -   *     "@@tag":   String,
                                                                                            -   *     "@@value": Object Any
                                                                                            -   *   }
                                                                                            -   * 
                                                                                            -   *   Variant . () => JSONSerialisation
                                                                                            -   */
                                                                                            -  variant.prototype.toJSON = function() {
                                                                                            -    return { 
                                                                                            -      [typeJsonKey]:  typeName, 
                                                                                            -      [tagJsonKey]:   tagName, 
                                                                                            -      [valueJsonKey]: mapValues(this, serializeValue) 
                                                                                            -    };
                                                                                            -  };
                                                                                            -
                                                                                            -  /*~
                                                                                            -   * Parses a previously serialised ADT into a rich ADT object.
                                                                                            -   * 
                                                                                            -   * ## Example::
                                                                                            -   * 
                                                                                            -   *     const { data, setoid } = require('folktale/core/adt');
                                                                                            -   *     const Id = data('Id', {
                                                                                            -   *       Id(value){ return { value } }
                                                                                            -   *     }).derive(serialize, setoid);
                                                                                            -   * 
                                                                                            -   *     Id.Id(1).toJSON();
                                                                                            -   *     // ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                            -   * 
                                                                                            -   *     Id.fromJSON(Id.Id(1).toJSON());
                                                                                            -   *     // ==> Id.Id(1)
                                                                                            -   * 
                                                                                            -   * ---
                                                                                            -   * category: Serialisation
                                                                                            -   * stability: experimental
                                                                                            -   * authors:
                                                                                            -   *   - "@boris-marinov"
                                                                                            -   * 
                                                                                            -   * type: |
                                                                                            -   *   type JSONSerialisation = {
                                                                                            -   *     "@@type":  String,
                                                                                            -   *     "@@tag":   String,
                                                                                            -   *     "@@value": Object Any
                                                                                            -   *   }
                                                                                            -   *   type JSONParser = {
                                                                                            -   *     fromJSON: (JSONSerialisation, Array JSONParser) => Variant
                                                                                            -   *   }
                                                                                            -   * 
                                                                                            -   *   (JSONSerialisation, Array JSONParser) => Variant
                                                                                            -   */
                                                                                            -  adt.fromJSON = function(value, parsers = { [typeName]: adt }, keysIndicateType = false) {
                                                                                            -    const valueTypeName = value[typeJsonKey];
                                                                                            -    const valueTagName = value[tagJsonKey];
                                                                                            -    const valueContents = value[valueJsonKey];
                                                                                            -    assertType(typeName, valueTypeName);
                                                                                            -    const parsersByType = keysIndicateType ? parsers
                                                                                            -          : /*otherwise*/                    indexByType(values(parsers));
                                                                                            -
                                                                                            -    const parsedValue = mapValues(valueContents, parseValue(parsersByType));
                                                                                            -    return Object.assign(Object.create(adt[valueTagName].prototype), parsedValue);
                                                                                            -  };
                                                                                            -}
                                                                                            Stability
                                                                                            experimental
                                                                                            Licence
                                                                                            MIT
                                                                                            Module
                                                                                            folktale/src/core/adt/serialize
                                                                                            Authors
                                                                                            Authors
                                                                                            • @boris-marinov
                                                                                            Maintainers
                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.setoid.setoid.html b/docs/api/en/folktale.src.core.adt.setoid.setoid.html deleted file mode 100644 index c6e313c..0000000 --- a/docs/api/en/folktale.src.core.adt.setoid.setoid.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - createDerivation - - - - - -

                                                                                              createDerivation

                                                                                              Provides structural equality for ADTs.

                                                                                              -

                                                                                              Signature

                                                                                              createDerivation(valuesEqual)
                                                                                              Type
                                                                                              (Variant, ADT) => Void

                                                                                              Documentation

                                                                                              Provides structural equality for ADTs.

                                                                                              -

                                                                                              The setoid derivation bestows Fantasy Land's fantasy-land/equals -method upon ADTs constructed by Core.ADT, as well as an equals -alias. This equals method performs structural equality, and may -be configured on how to compare values that aren't themselves setoids.

                                                                                              -

                                                                                              Example:

                                                                                              -
                                                                                              const { data, setoid } = require('folktale/core/adt');
                                                                                              -const Result = data('Result', {
                                                                                              -  Ok(value){
                                                                                              -    return { value };
                                                                                              -  },
                                                                                              -  Error(value) {
                                                                                              -    return { value };
                                                                                              -  }
                                                                                              -}).derive(setoid);
                                                                                              -const { Ok, Error } = Result;
                                                                                              -
                                                                                              -Ok(1).equals(Ok(1));
                                                                                              -// ==> true
                                                                                              -
                                                                                              -Ok(1).equals(Error(1));
                                                                                              -// ==> false
                                                                                              -
                                                                                              -Error(Error(1)).equals(Error(Error(1)));
                                                                                              -// ==> true
                                                                                              -

                                                                                              Structural equality

                                                                                              -

                                                                                              The equals method provided by this derivation checks for structural -equivalence. That is, two values are considered equal if they have the -same content.

                                                                                              -

                                                                                              For simple ADTs this is pretty easy to see. For example, consider the -following definition:

                                                                                              -
                                                                                              const { data, setoid } = require('folktale/core/adt');
                                                                                              -const Id = data('Id', {
                                                                                              -  Id(value){ return { value } }
                                                                                              -}).derive(setoid);
                                                                                              -
                                                                                              -const a = Id.Id(1);
                                                                                              -const b = Id.Id(1);
                                                                                              -

                                                                                              Here we have an ADT with a single case, Id, and we've made two -instances of this data structure, each containing the value 1. -However, if we try to compare them using JavaScript standard -operators, we'll not be comparing their contents, but rather whether -or not they are the same object:

                                                                                              -
                                                                                              a === a; // ==> true
                                                                                              -b === b; // ==> true
                                                                                              -a === b; // ==> false
                                                                                              -

                                                                                              So a === b is false, even though both a and b have the same -contents. This is because === compares values by their identity, -and each object has a different identity.

                                                                                              -

                                                                                              If we want to compare things by value, we can use the equals method -provided by this setoid derivation instead:

                                                                                              -
                                                                                              a.equals(b);        // ==> true
                                                                                              -a.equals(a);        // ==> true
                                                                                              -a.equals(Id.Id(2)); // ==> false
                                                                                              -

                                                                                              When comparing with the equals method, two values are considered -equal if they represent the same value. This is called structural -equality.

                                                                                              -

                                                                                              Equality in details

                                                                                              -

                                                                                              Given two data structures, they are considered equal if:

                                                                                              -
                                                                                                -
                                                                                              • They have the same type;
                                                                                              • -
                                                                                              • They have the same tag;
                                                                                              • -
                                                                                              • They have the same keys, and these keys have the same values;
                                                                                              • -
                                                                                              -

                                                                                              The following example shows these in practice:

                                                                                              -
                                                                                              const { data, setoid } = require('folktale/core/adt');
                                                                                              -
                                                                                              -//                    ┌◦ TYPE
                                                                                              -//                  ┌╌┴╌╌╌╌┐
                                                                                              -const Result = data('Result', {
                                                                                              -//  ┌◦ TAG             ┌◦ KEYS
                                                                                              -// ┌┴┐               ┌╌┴╌╌╌╌╌┐
                                                                                              -   Ok(value){ return { value } },
                                                                                              -
                                                                                              -//   ┌◦ TAG               ┌◦ KEYS
                                                                                              -// ┌╌┴╌┐                ┌╌┴╌╌╌╌╌┐
                                                                                              -   Error(value){ return { value } }
                                                                                              -}).derive(setoid);
                                                                                              -
                                                                                              -const { Ok, Error } = Result;
                                                                                              -

                                                                                              So here we have the Result ADT. Values created from this ADT always -have the same type: "Result". A type is expected to be unique within -all ADTs in a program:

                                                                                              -
                                                                                              Ok(1)[data.typeSymbol];    // ==> 'Result'
                                                                                              -Error(1)[data.typeSymbol]; // ==> 'Result'
                                                                                              -

                                                                                              Each variant has its own tag, which is the name you give to the -constructor. A tag is unique within an ADT, but not necessarily unique -amongst other ADTs:

                                                                                              -
                                                                                              Ok(1)[data.tagSymbol];     // ==> 'Ok'
                                                                                              -Error(1)[data.tagSymbol];  // ==> 'Error'
                                                                                              -

                                                                                              Finally, the keys in an ADT are the same as the keys in the constructor -returns. So, in this case, both Ok and Errors have [value] as the key:

                                                                                              -
                                                                                              Object.keys(Ok(1));    // ==> ['value']
                                                                                              -Object.keys(Error(1)); // ==> ['value']
                                                                                              -

                                                                                              So if we compare these two for equality:

                                                                                              -
                                                                                              Ok(1).equals(Ok(1)); // ==> true
                                                                                              -// same type, tag, keys and values.
                                                                                              -
                                                                                              -Ok(1).equals(Ok(2)); // ==> false
                                                                                              -// same type, tag, and keys. Different values (1 !== 2).
                                                                                              -
                                                                                              -Ok(1).equals(Error(1)); // ==> false
                                                                                              -// same type, keys, and values. Different tags ('Ok' !== 'Error').
                                                                                              -
                                                                                              -const { Error: E } = data('Res', {
                                                                                              -  Error(value){ return { value } }
                                                                                              -}).derive(setoid);
                                                                                              -
                                                                                              -E(1).equals(Error(1)); // ==> false
                                                                                              -// same tag, keys, and values. Different types ('Result' !== 'Res')
                                                                                              -

                                                                                              How complex equality works?

                                                                                              -

                                                                                              The values in an ADT aren't always a JS primitive, such as numbers and -strings. Setoid's equals method handles these in two different ways:

                                                                                              -
                                                                                                -
                                                                                              • If the values are a setoid, then the values are compared using the -left Setoid's equals method. This means that if all values are -setoids or primitives, then deep equality just works.

                                                                                                -
                                                                                              • -
                                                                                              • If the values are not a setoid, the provided equality comparison is -used to compare both values. By default, this comparison just uses -reference equality, so it's the equivalent of a === b.

                                                                                                -
                                                                                              • -
                                                                                              -

                                                                                              Here's an example:

                                                                                              -
                                                                                              const { data, setoid } = require('folktale/core/adt');
                                                                                              -const { Id } = data('Id', {
                                                                                              -  Id(value){ return { value } }
                                                                                              -}).derive(setoid);
                                                                                              -
                                                                                              -// This is fine, because all values are either Setoids or primitives
                                                                                              -Id(Id(1)).equals(Id(Id(1))); // ==> true
                                                                                              -
                                                                                              -// This is not fine, because it compares `[1] === [1]`
                                                                                              -Id([1]).equals(Id([1]));     // ==> false
                                                                                              -

                                                                                              To handle complex JS values, one must provide their own deep equality -function. Folktale does not have a deep equality function yet, but -most functional libraries have a equals function for that.

                                                                                              -

                                                                                              Here's an example of an equality function that checks array equality:

                                                                                              -
                                                                                              const isEqual = (a, b) =>
                                                                                              -  Array.isArray(a) && Array.isArray(b) ?  arrayEquals(a, b)
                                                                                              -: a == null                            ?  a === b
                                                                                              -: a['fantasy-land/equals']             ?  a['fantasy-land/equals'](b)
                                                                                              -: a.equals                             ?  a.equals(b)
                                                                                              -:                                         a === b;
                                                                                              -
                                                                                              -const arrayEquals = (a, b) =>
                                                                                              -   Array.isArray(a) && Array.isArray(b)
                                                                                              -&& a.length === b.length
                                                                                              -&& a.every((x, i) => isEqual(x, b[i]));
                                                                                              -
                                                                                              -const { Id: Id2 } = data('Id', {
                                                                                              -  Id(value){ return { value } }
                                                                                              -}).derive(setoid.withEquality(isEqual));
                                                                                              -
                                                                                              -Id2([1]).equals(Id2([1]));       // ==> true
                                                                                              -Id2(Id2(1)).equals(Id2(Id2(1))); // ==> true
                                                                                              -Id2(2).equals(Id2(1));           // ==> false
                                                                                              -

                                                                                              Setoid equality and the asymmetry problem:

                                                                                              -

                                                                                              Because the Setoid equals method is defined directly in objects, -and invoked using the method call syntax, it creates an asymmetry -problem. That is, if there are two objects, a and b, then -a equals b is not the same as b equals a, since the equals -method may be different on those objects!

                                                                                              -

                                                                                              Here's an example of the asymmetry problem:

                                                                                              -
                                                                                              const { data, setoid } = require('folktale/core/adt');
                                                                                              -const { Id } = data('Id', {
                                                                                              -  Id(value){ return { value } }
                                                                                              -}).derive(setoid);
                                                                                              -
                                                                                              -const bogus = {
                                                                                              -  equals(that){ return that.value === this.value },
                                                                                              -  value: 1
                                                                                              -};
                                                                                              -
                                                                                              -// This is what you expect
                                                                                              -Id(1).equals(bogus); // ==> false
                                                                                              -
                                                                                              -// And so is this
                                                                                              -Id(Id(1)).equals(Id(bogus)); // ==> false
                                                                                              -
                                                                                              -// But this is not
                                                                                              -Id(bogus).equals(Id(Id(1))); // ==> true
                                                                                              -

                                                                                              To avoid this problem all Setoid implementations should do type -checking and make sure that they have the same equals method. -Setoid implementations derived by this derivation do so by -checking the type and tag of the ADTs being compared.

                                                                                              -

                                                                                              Performance considerations

                                                                                              -

                                                                                              There are no optimisations for deep equality provided by this method, -thus you should expect it to visit every value starting from the root. -This can be quite expensive for larger data structures.

                                                                                              -

                                                                                              If you expect to be working with larger data structures, and check -equality between them often, you are, usually, very out of luck. You -may consider providing your own Setoid isntance with the following -optimisations:

                                                                                              -
                                                                                                -
                                                                                              • If two objects are the same reference, you don't need to check -them structurally, for they must be equal — Setoid does this, -but if you're providing your own equality function, you must -do this there as well;

                                                                                                -
                                                                                              • -
                                                                                              • If two objects have the same type, but different hashes, then -they must have different values (assuming you haven't messed up -your hash function);

                                                                                                -
                                                                                              • -
                                                                                              • If two objects have the same type, and the same hashes, then they -might be equal, but you can't tell without looking at all of its -values.

                                                                                                -
                                                                                              • -
                                                                                              -

                                                                                              Here's an example of this optimisation applied to linked lists that -can only hold numbers (with a very naive hash function):

                                                                                              -
                                                                                              const hash = Symbol('hash code');
                                                                                              -const { data, setoid } = require('folktale/core/adt');
                                                                                              -
                                                                                              -const { Cons, Nil } = data('List', {
                                                                                              -  Nil(){ return { [hash]: 0 } },
                                                                                              -  Cons(value, rest) {
                                                                                              -    return {
                                                                                              -      [hash]: value + rest[hash],
                                                                                              -      value, rest
                                                                                              -    }
                                                                                              -  }
                                                                                              -});
                                                                                              -
                                                                                              -Nil.prototype.equals = function(that) {
                                                                                              -  return Nil.hasInstance(that);
                                                                                              -}
                                                                                              -
                                                                                              -Cons.prototype.equals = function(that) {
                                                                                              -  if (this === that)              return true
                                                                                              -  if (!Cons.hasInstance(that))    return false
                                                                                              -  if (this[hash] !== that[hash])  return false
                                                                                              -
                                                                                              -  return this.value === that.value
                                                                                              -  &&     this.rest.equals(that.rest)
                                                                                              -}
                                                                                              -
                                                                                              -const a = Cons(1, Cons(2, Cons(3, Nil())));
                                                                                              -const b = Cons(1, Cons(2, Cons(3, Nil())));
                                                                                              -const c = Cons(1, b);
                                                                                              -
                                                                                              -a.equals(b); // ==> true
                                                                                              -a.equals(c); // ==> false
                                                                                              -
                                                                                              -

                                                                                              NOTE:
                                                                                              You should use a suitable hashing algorithm for your data structures.

                                                                                              -
                                                                                              -

                                                                                              Properties

                                                                                              (Uncategorised)

                                                                                              Experimental

                                                                                              Source Code

                                                                                              Defined in src/core/adt/setoid.js at line 51, column 0
                                                                                              (valuesEqual) => {
                                                                                              -  /*~
                                                                                              -   * Tests if two objects are equal.
                                                                                              -   * ---
                                                                                              -   * type: ('a, 'a) => Boolean
                                                                                              -   */
                                                                                              -  const equals = (a, b) => {
                                                                                              -    // identical objects must be equal
                                                                                              -    if (a === b)  return true;
                                                                                              -
                                                                                              -    // we require both values to be setoids if one of them is
                                                                                              -    const leftSetoid  = isSetoid(a);
                                                                                              -    const rightSetoid = isSetoid(b);
                                                                                              -    if (leftSetoid) {
                                                                                              -      if (rightSetoid)  return flEquals(a, b);
                                                                                              -      else              return false;
                                                                                              -    }
                                                                                              -
                                                                                              -    // fall back to the provided equality
                                                                                              -    return valuesEqual(a, b);
                                                                                              -  };
                                                                                              -
                                                                                              -
                                                                                              -  /*~
                                                                                              -   * Tests if two variants are equal.
                                                                                              -   * ---
                                                                                              -   * type: (Object Any, Object Any, Array String) => Boolean
                                                                                              -   */
                                                                                              -  const compositesEqual = (a, b, keys) => {
                                                                                              -    for (let i = 0; i < keys.length; ++i) {
                                                                                              -      const keyA = a[keys[i]];
                                                                                              -      const keyB = b[keys[i]];
                                                                                              -      if (!(equals(keyA, keyB))) {
                                                                                              -        return false;
                                                                                              -      }
                                                                                              -    }
                                                                                              -    return true;
                                                                                              -  };
                                                                                              -
                                                                                              -
                                                                                              -  const derivation = (variant, adt) => {
                                                                                              -    /*~
                                                                                              -     * Compares two setoids structurally.
                                                                                              -     * ---
                                                                                              -     * category: Comparing and testing
                                                                                              -     * stability: experimental
                                                                                              -     * authors:
                                                                                              -     *   - "@boris-marinov"
                                                                                              -     *   - Quildreen Motta
                                                                                              -     * 
                                                                                              -     * type: |
                                                                                              -     *   forall S, a:
                                                                                              -     *     (S a).(S a) => Boolean
                                                                                              -     *   where S is Setoid
                                                                                              -     */
                                                                                              -    variant.prototype.equals = function(value) {
                                                                                              -      assertType(adt)(`${this[tagSymbol]}#equals`, value);
                                                                                              -      return sameType(this, value) && compositesEqual(this, value, Object.keys(this));
                                                                                              -    };
                                                                                              -    provideAliases(variant.prototype);
                                                                                              -    return variant;
                                                                                              -  };
                                                                                              -  copyDocs(createDerivation, derivation, {
                                                                                              -    type: '(Variant, ADT) => Void'
                                                                                              -  });
                                                                                              -
                                                                                              -
                                                                                              -  return derivation;
                                                                                              -}
                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.setoid.withEquality.html b/docs/api/en/folktale.src.core.adt.setoid.withEquality.html deleted file mode 100644 index 939875b..0000000 --- a/docs/api/en/folktale.src.core.adt.setoid.withEquality.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - createDerivation - - - - - -

                                                                                              createDerivation

                                                                                              Signature

                                                                                              createDerivation(valuesEqual)
                                                                                              Type
                                                                                              (('a, 'a) => Boolean) => (Variant, ADT) => Void

                                                                                              Documentation

                                                                                              Properties

                                                                                              (Uncategorised)

                                                                                              Experimental

                                                                                              Source Code

                                                                                              Defined in src/core/adt/setoid.js at line 51, column 0
                                                                                              (valuesEqual) => {
                                                                                              -  /*~
                                                                                              -   * Tests if two objects are equal.
                                                                                              -   * ---
                                                                                              -   * type: ('a, 'a) => Boolean
                                                                                              -   */
                                                                                              -  const equals = (a, b) => {
                                                                                              -    // identical objects must be equal
                                                                                              -    if (a === b)  return true;
                                                                                              -
                                                                                              -    // we require both values to be setoids if one of them is
                                                                                              -    const leftSetoid  = isSetoid(a);
                                                                                              -    const rightSetoid = isSetoid(b);
                                                                                              -    if (leftSetoid) {
                                                                                              -      if (rightSetoid)  return flEquals(a, b);
                                                                                              -      else              return false;
                                                                                              -    }
                                                                                              -
                                                                                              -    // fall back to the provided equality
                                                                                              -    return valuesEqual(a, b);
                                                                                              -  };
                                                                                              -
                                                                                              -
                                                                                              -  /*~
                                                                                              -   * Tests if two variants are equal.
                                                                                              -   * ---
                                                                                              -   * type: (Object Any, Object Any, Array String) => Boolean
                                                                                              -   */
                                                                                              -  const compositesEqual = (a, b, keys) => {
                                                                                              -    for (let i = 0; i < keys.length; ++i) {
                                                                                              -      const keyA = a[keys[i]];
                                                                                              -      const keyB = b[keys[i]];
                                                                                              -      if (!(equals(keyA, keyB))) {
                                                                                              -        return false;
                                                                                              -      }
                                                                                              -    }
                                                                                              -    return true;
                                                                                              -  };
                                                                                              -
                                                                                              -
                                                                                              -  const derivation = (variant, adt) => {
                                                                                              -    /*~
                                                                                              -     * Compares two setoids structurally.
                                                                                              -     * ---
                                                                                              -     * category: Comparing and testing
                                                                                              -     * stability: experimental
                                                                                              -     * authors:
                                                                                              -     *   - "@boris-marinov"
                                                                                              -     *   - Quildreen Motta
                                                                                              -     * 
                                                                                              -     * type: |
                                                                                              -     *   forall S, a:
                                                                                              -     *     (S a).(S a) => Boolean
                                                                                              -     *   where S is Setoid
                                                                                              -     */
                                                                                              -    variant.prototype.equals = function(value) {
                                                                                              -      assertType(adt)(`${this[tagSymbol]}#equals`, value);
                                                                                              -      return sameType(this, value) && compositesEqual(this, value, Object.keys(this));
                                                                                              -    };
                                                                                              -    provideAliases(variant.prototype);
                                                                                              -    return variant;
                                                                                              -  };
                                                                                              -  copyDocs(createDerivation, derivation, {
                                                                                              -    type: '(Variant, ADT) => Void'
                                                                                              -  });
                                                                                              -
                                                                                              -
                                                                                              -  return derivation;
                                                                                              -}
                                                                                              Stability
                                                                                              experimental
                                                                                              Licence
                                                                                              MIT
                                                                                              Module
                                                                                              folktale/src/core/adt/setoid
                                                                                              Authors
                                                                                              Authors
                                                                                              • @boris-marinov
                                                                                              Maintainers
                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.adt.show.show.html b/docs/api/en/folktale.src.core.adt.show.show.html deleted file mode 100644 index 02a7594..0000000 --- a/docs/api/en/folktale.src.core.adt.show.show.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - show - - - - - -

                                                                                                show

                                                                                                Provides a textual representation for ADTs.

                                                                                                -

                                                                                                Signature

                                                                                                show(variant, adt)
                                                                                                Type
                                                                                                (Variant, ADT) => Void

                                                                                                Documentation

                                                                                                Provides a textual representation for ADTs.

                                                                                                -

                                                                                                The show serialisation bestows ES2015's Symbol.toStringTag, used -for the native Object.prototype.toString, along with a .toString() -method and Node's REPL .inspect() method.

                                                                                                -

                                                                                                Example:

                                                                                                -
                                                                                                const { data, show } = require('folktale/core/adt');
                                                                                                -const { Id } = data('Id', {
                                                                                                -  Id(value){ return { value } }
                                                                                                -}).derive(show);
                                                                                                -
                                                                                                -Object.prototype.toString.call(Id(1));
                                                                                                -// => '[object Id.Id]'
                                                                                                -
                                                                                                -Id(1).toString();
                                                                                                -// ==> 'Id.Id({ value: 1 })'
                                                                                                -
                                                                                                -Id(1).inspect();
                                                                                                -// ==> 'Id.Id({ value: 1 })'
                                                                                                -

                                                                                                ES2015's ToStringTag

                                                                                                -

                                                                                                This derivation defines ES2015's ToStringTag symbol, which is used -by Object.prototype.toString to construct a default textual -representation of the object.

                                                                                                -

                                                                                                This means that instead of getting '[object Object]', you'll get -a more helpful '[object <Type>.<Tag>]' representation, where this -function is used.

                                                                                                -

                                                                                                Textual representation

                                                                                                -

                                                                                                This derivation defines a .toString() method. .toString is called -in many places to define how to represent an object, but also called -when JS operators want to convert an object to a String. This derivation -only cares about representation that's suitable for debugging.

                                                                                                -

                                                                                                The representation includes the type, tag, and key/value pairs of the -data structure.

                                                                                                -

                                                                                                Node REPL representation

                                                                                                -

                                                                                                Node's REPL uses .inspect() instead of the regular .toString(). -This derivation also provides the .inspect() method, but just as -an alias for the .toString() method.

                                                                                                -

                                                                                                Properties

                                                                                                (Uncategorised)

                                                                                                Experimental

                                                                                                Source Code

                                                                                                Defined in src/core/adt/show.js at line 101, column 0
                                                                                                (variant, adt) => {
                                                                                                -  const typeName    = adt[typeSymbol];
                                                                                                -  const variantName = `${adt[typeSymbol]}.${variant.prototype[tagSymbol]}`;
                                                                                                -
                                                                                                -  // (for Object.prototype.toString)
                                                                                                -  adt[Symbol.toStringTag]               = typeName;
                                                                                                -  variant.prototype[Symbol.toStringTag] = variantName;
                                                                                                -
                                                                                                -  // (regular JavaScript representations)
                                                                                                -  /*~
                                                                                                -   * Returns a textual representation of the ADT.
                                                                                                -   * ---
                                                                                                -   * category: Debug Representation
                                                                                                -   * stability: experimental
                                                                                                -   * authors:
                                                                                                -   *   - "@boris-marinov"
                                                                                                -   * 
                                                                                                -   * type: |
                                                                                                -   *   () => String
                                                                                                -   */
                                                                                                -  adt.toString = () => typeName;
                                                                                                -
                                                                                                -  /*~
                                                                                                -   * Returns a textual representation of the Variant.
                                                                                                -   * ---
                                                                                                -   * category: Debug Representation
                                                                                                -   * stability: experimental
                                                                                                -   * authors:
                                                                                                -   *   - "@boris-marinov"
                                                                                                -   * 
                                                                                                -   * type: |
                                                                                                -   *   () => String
                                                                                                -   */
                                                                                                -  variant.toString = () => variantName;
                                                                                                -
                                                                                                -  /*~
                                                                                                -   * Returns a textual representation of the ADT instance.
                                                                                                -   * ---
                                                                                                -   * category: Debug Representation
                                                                                                -   * stability: experimental
                                                                                                -   * authors:
                                                                                                -   *   - "@boris-marinov"
                                                                                                -   * 
                                                                                                -   * type: |
                                                                                                -   *   (ADT).() => String
                                                                                                -   */
                                                                                                -  variant.prototype.toString = function() {
                                                                                                -    return `${variantName}(${plainObjectToString.call(this)})`;
                                                                                                -  };
                                                                                                -
                                                                                                -  // (Node REPL representations)
                                                                                                -  adt.inspect                = adt.toString;
                                                                                                -  variant.inspect            = variant.toString;
                                                                                                -  variant.prototype.inspect  = variant.prototype.toString;
                                                                                                -
                                                                                                -  return variant;
                                                                                                -}
                                                                                                Stability
                                                                                                experimental
                                                                                                Licence
                                                                                                MIT
                                                                                                Module
                                                                                                folktale/src/core/adt/show
                                                                                                Authors
                                                                                                Authors
                                                                                                • @boris-marinov
                                                                                                Maintainers
                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.apply.apply.html b/docs/api/en/folktale.src.core.fantasy-land.apply.apply.html deleted file mode 100644 index cceeb3e..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.apply.apply.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - apply - - - - - -

                                                                                                  apply

                                                                                                  Applies the function inside an applicative to the value of another applicative.

                                                                                                  -

                                                                                                  Signature

                                                                                                  apply(applicativeFunction, applicativeValue)
                                                                                                  Type
                                                                                                  forall F, a, b:
                                                                                                  -  (F (a) => b, F a) => F b
                                                                                                  -where F is Apply

                                                                                                  Documentation

                                                                                                  Applies the function inside an applicative to the value of another applicative.

                                                                                                  -

                                                                                                  Properties

                                                                                                  Convenience

                                                                                                  curried()

                                                                                                  Applies the function inside an applicative to the value of another applicative.

                                                                                                  -
                                                                                                  Experimental
                                                                                                  infix(applicativeValue)

                                                                                                  Applies the function inside an applicative to the value of another applicative.

                                                                                                  -
                                                                                                  Experimental

                                                                                                  (Uncategorised)

                                                                                                  Experimental

                                                                                                  Source Code

                                                                                                  Defined in src/core/fantasy-land/apply.js at line 31, column 0
                                                                                                  (applicativeFunction, applicativeValue) =>
                                                                                                  -  isNew(applicativeValue)    ?  applicativeValue[ap](applicativeFunction)
                                                                                                  -: isOld(applicativeFunction) ?  warn(applicativeFunction.ap(applicativeValue))
                                                                                                  -: /*otherwise*/                 unsupported(applicativeFunction)
                                                                                                  Stability
                                                                                                  experimental
                                                                                                  Licence
                                                                                                  MIT
                                                                                                  Module
                                                                                                  folktale/src/core/fantasy-land/apply
                                                                                                  Authors
                                                                                                  Authors
                                                                                                  • @boris-marinov
                                                                                                  • Quildreen Motta
                                                                                                  Maintainers
                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.bimap.bimap.html b/docs/api/en/folktale.src.core.fantasy-land.bimap.bimap.html deleted file mode 100644 index 9ead21e..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.bimap.bimap.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - bimap - - - - - -

                                                                                                    bimap

                                                                                                    Maps one function over each side of a Bifunctor.

                                                                                                    -

                                                                                                    Signature

                                                                                                    bimap(bifunctor, transformLeft, transformRight)
                                                                                                    Type
                                                                                                    forall F, a, b, c, d:
                                                                                                    -  (F a b, (a) => c, (b) => d) => F c d
                                                                                                    -where F is Bifunctor

                                                                                                    Documentation

                                                                                                    Maps one function over each side of a Bifunctor.

                                                                                                    -

                                                                                                    Properties

                                                                                                    Convenience

                                                                                                    curried()

                                                                                                    Maps one function over each side of a Bifunctor.

                                                                                                    -
                                                                                                    Experimental
                                                                                                    infix(transformLeft, transformRight)

                                                                                                    Maps one function over each side of a Bifunctor.

                                                                                                    -
                                                                                                    Experimental

                                                                                                    (Uncategorised)

                                                                                                    Experimental

                                                                                                    Source Code

                                                                                                    Defined in src/core/fantasy-land/bimap.js at line 33, column 0
                                                                                                    (bifunctor, transformLeft, transformRight) =>
                                                                                                    -  isNew(bifunctor) ?  bifunctor[flBimap](transformLeft, transformRight)
                                                                                                    -: isOld(bifunctor) ?  warn(bifunctor.bimap(transformLeft, transformRight))
                                                                                                    -: /*otherwise*/       unsupported(bifunctor)
                                                                                                    Stability
                                                                                                    experimental
                                                                                                    Licence
                                                                                                    MIT
                                                                                                    Module
                                                                                                    folktale/src/core/fantasy-land/bimap
                                                                                                    Authors
                                                                                                    Authors
                                                                                                    • @boris-marinov
                                                                                                    • Quildreen Motta
                                                                                                    Maintainers
                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.chain.chain.html b/docs/api/en/folktale.src.core.fantasy-land.chain.chain.html deleted file mode 100644 index 7654bb3..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.chain.chain.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - chain - - - - - -

                                                                                                      chain

                                                                                                      Transforms a monad with an unary function.

                                                                                                      -

                                                                                                      Signature

                                                                                                      chain(monad, transformation)
                                                                                                      Type
                                                                                                      forall C, a, b:
                                                                                                      -  (C a, (a) => C b) => C b
                                                                                                      -where C is Chain

                                                                                                      Documentation

                                                                                                      Transforms a monad with an unary function.

                                                                                                      -

                                                                                                      Properties

                                                                                                      Convenience

                                                                                                      curried()

                                                                                                      Transforms a monad with an unary function.

                                                                                                      -
                                                                                                      Experimental
                                                                                                      infix(transformation)

                                                                                                      Transforms a monad with an unary function.

                                                                                                      -
                                                                                                      Experimental

                                                                                                      (Uncategorised)

                                                                                                      Experimental

                                                                                                      Source Code

                                                                                                      Defined in src/core/fantasy-land/chain.js at line 32, column 0
                                                                                                      (monad, transformation) =>
                                                                                                      -  isNew(monad) ?  monad[flChain](transformation)
                                                                                                      -: isOld(monad) ?  warn(monad.chain(transformation))
                                                                                                      -: /*otherwise*/   unsupported(monad)
                                                                                                      Stability
                                                                                                      experimental
                                                                                                      Licence
                                                                                                      MIT
                                                                                                      Module
                                                                                                      folktale/src/core/fantasy-land/chain
                                                                                                      Authors
                                                                                                      Authors
                                                                                                      • @boris-marinov
                                                                                                      • Quildreen Motta
                                                                                                      Maintainers
                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.concat.concat.html b/docs/api/en/folktale.src.core.fantasy-land.concat.concat.html deleted file mode 100644 index b08dc05..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.concat.concat.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - concat - - - - - -

                                                                                                        concat

                                                                                                        Joins two semigroups.

                                                                                                        -

                                                                                                        Signature

                                                                                                        concat(semigroupLeft, semigroupRight)
                                                                                                        Type
                                                                                                        forall S, a:
                                                                                                        -  (S a, S a) => S a
                                                                                                        -where S is Semigroup

                                                                                                        Documentation

                                                                                                        Joins two semigroups.

                                                                                                        -

                                                                                                        Properties

                                                                                                        Convenience

                                                                                                        curried()

                                                                                                        Joins two semigroups.

                                                                                                        -
                                                                                                        Experimental
                                                                                                        infix(aSemigroup)

                                                                                                        Joins two semigroups.

                                                                                                        -
                                                                                                        Experimental

                                                                                                        (Uncategorised)

                                                                                                        Experimental

                                                                                                        Source Code

                                                                                                        Defined in src/core/fantasy-land/concat.js at line 32, column 0
                                                                                                        (semigroupLeft, semigroupRight) =>
                                                                                                        -  isNewSemigroup(semigroupLeft) ?  semigroupLeft[flConcat](semigroupRight)
                                                                                                        -: isOldSemigroup(semigroupLeft) ?  warn(semigroupLeft.concat(semigroupRight))
                                                                                                        -: /*otherwise*/                    unsupported(semigroupLeft)
                                                                                                        Stability
                                                                                                        experimental
                                                                                                        Licence
                                                                                                        MIT
                                                                                                        Module
                                                                                                        folktale/src/core/fantasy-land/concat
                                                                                                        Authors
                                                                                                        Authors
                                                                                                        • @boris-marinov
                                                                                                        • Quildreen Motta
                                                                                                        Maintainers
                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.curried.html b/docs/api/en/folktale.src.core.fantasy-land.curried.html deleted file mode 100644 index f2f054d..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.curried.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - module folktale/core/fantasy-land/curried - - - - - -

                                                                                                          module folktale/core/fantasy-land/curried

                                                                                                          Compares two setoids for equality.

                                                                                                          -

                                                                                                          Documentation

                                                                                                          Compares two setoids for equality.

                                                                                                          -

                                                                                                          Properties

                                                                                                          Convenience

                                                                                                          apply()

                                                                                                          Applies the function inside an applicative to the value of another applicative.

                                                                                                          -
                                                                                                          Experimental
                                                                                                          bimap()

                                                                                                          Maps one function over each side of a Bifunctor.

                                                                                                          -
                                                                                                          Experimental
                                                                                                          chain()

                                                                                                          Transforms a monad with an unary function.

                                                                                                          -
                                                                                                          Experimental
                                                                                                          concat()

                                                                                                          Joins two semigroups.

                                                                                                          -
                                                                                                          Experimental
                                                                                                          empty()

                                                                                                          Returns the identity object for a monoid.

                                                                                                          -
                                                                                                          Experimental
                                                                                                          equals()
                                                                                                          Experimental
                                                                                                          map()

                                                                                                          Transforms the contents of a Functor.

                                                                                                          -
                                                                                                          Experimental
                                                                                                          of()

                                                                                                          Constructs an applicative containing the given value.

                                                                                                          -
                                                                                                          Experimental

                                                                                                          Source Code

                                                                                                          Defined in src/core/fantasy-land/curried.js at line 17, column 0
                                                                                                          {
                                                                                                          -  apply: require('./apply').curried,
                                                                                                          -  bimap: require('./bimap').curried,
                                                                                                          -  chain: require('./chain').curried,
                                                                                                          -  concat: require('./concat').curried,
                                                                                                          -  empty: require('./empty').curried,
                                                                                                          -  equals: require('./equals').curried,
                                                                                                          -  map: require('./map').curried,
                                                                                                          -  of: require('./of').curried
                                                                                                          -}
                                                                                                          Stability
                                                                                                          experimental
                                                                                                          Licence
                                                                                                          MIT
                                                                                                          Module
                                                                                                          folktale/src/core/fantasy-land/curried
                                                                                                          On This Page
                                                                                                          Authors
                                                                                                          Authors
                                                                                                          • Quildreen Motta
                                                                                                          Maintainers
                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.empty.empty.html b/docs/api/en/folktale.src.core.fantasy-land.empty.empty.html deleted file mode 100644 index d4e8e6d..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.empty.empty.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - empty - - - - - -

                                                                                                            empty

                                                                                                            Returns the identity object for a monoid.

                                                                                                            -

                                                                                                            Signature

                                                                                                            empty(monoid)
                                                                                                            Type
                                                                                                            forall M, a:
                                                                                                            -  (M) => M a
                                                                                                            -where M is Monoid

                                                                                                            Documentation

                                                                                                            Returns the identity object for a monoid.

                                                                                                            -

                                                                                                            Properties

                                                                                                            Convenience

                                                                                                            curried()

                                                                                                            Returns the identity object for a monoid.

                                                                                                            -
                                                                                                            Experimental
                                                                                                            infix()

                                                                                                            Returns the identity object for a monoid.

                                                                                                            -
                                                                                                            Experimental

                                                                                                            (Uncategorised)

                                                                                                            Experimental

                                                                                                            Source Code

                                                                                                            Defined in src/core/fantasy-land/empty.js at line 35, column 0
                                                                                                            (monoid) =>
                                                                                                            -  isNew(monoid)     ?  monoid[flEmpty]()
                                                                                                            -: isCtorNew(monoid) ?  monoid.constructor[flEmpty]()
                                                                                                            -: isOld(monoid)     ?  warn(monoid.empty())
                                                                                                            -: isCtorOld(monoid) ?  warn(monoid.constructor.empty())
                                                                                                            -: /*otherwise*/        unsupported(monoid)
                                                                                                            Stability
                                                                                                            experimental
                                                                                                            Licence
                                                                                                            MIT
                                                                                                            Module
                                                                                                            folktale/src/core/fantasy-land/empty
                                                                                                            Authors
                                                                                                            Authors
                                                                                                            • @boris-marinov
                                                                                                            • Quildreen Motta
                                                                                                            Maintainers
                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.equals.equals.html b/docs/api/en/folktale.src.core.fantasy-land.equals.equals.html deleted file mode 100644 index ae8b734..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.equals.equals.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - equals - - - - - -

                                                                                                              equals

                                                                                                              Signature

                                                                                                              equals(setoidLeft, setoidRight)
                                                                                                              Type
                                                                                                              forall S, a:
                                                                                                              -  (S a, S a) => Boolean
                                                                                                              -where S is Setoid

                                                                                                              Documentation

                                                                                                              Properties

                                                                                                              Convenience

                                                                                                              curried()
                                                                                                              Experimental
                                                                                                              infix(aSetoid)
                                                                                                              Experimental

                                                                                                              (Uncategorised)

                                                                                                              Experimental

                                                                                                              Source Code

                                                                                                              Defined in src/core/fantasy-land/equals.js at line 33, column 0
                                                                                                              (setoidLeft, setoidRight) =>
                                                                                                              -  isNew(setoidLeft) ?  setoidLeft[flEquals](setoidRight)
                                                                                                              -: isOld(setoidLeft) ?  warn(setoidLeft.equals(setoidRight))
                                                                                                              -: /*otherwise*/        unsupported(setoidLeft)
                                                                                                              Stability
                                                                                                              experimental
                                                                                                              Licence
                                                                                                              MIT
                                                                                                              Module
                                                                                                              folktale/src/core/fantasy-land/equals
                                                                                                              Authors
                                                                                                              Authors
                                                                                                              • @boris-marinov
                                                                                                              • Quildreen Motta
                                                                                                              Maintainers
                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.html b/docs/api/en/folktale.src.core.fantasy-land.html deleted file mode 100644 index c9b004e..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - module folktale/core/fantasy-land - - - - - -

                                                                                                                module folktale/core/fantasy-land

                                                                                                                Allows invoking methods of Fantasy Land structures without -worrying about the differences in multiple versions of the spec.

                                                                                                                -

                                                                                                                Documentation

                                                                                                                Allows invoking methods of Fantasy Land structures without -worrying about the differences in multiple versions of the spec.

                                                                                                                -

                                                                                                                Properties

                                                                                                                Convenience

                                                                                                                curried

                                                                                                                Compares two setoids for equality.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                infix

                                                                                                                Method versions of the fantasy-land functions, supporting the -structure::fn(...) syntax.

                                                                                                                -
                                                                                                                Experimental

                                                                                                                Fantasy Land

                                                                                                                apply(applicativeFunction, applicativeValue)

                                                                                                                Applies the function inside an applicative to the value of another applicative.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                bimap(bifunctor, transformLeft, transformRight)

                                                                                                                Maps one function over each side of a Bifunctor.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                chain(monad, transformation)

                                                                                                                Transforms a monad with an unary function.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                concat(semigroupLeft, semigroupRight)

                                                                                                                Joins two semigroups.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                empty(monoid)

                                                                                                                Returns the identity object for a monoid.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                map(functor, transformation)

                                                                                                                Transforms the contents of a Functor.

                                                                                                                -
                                                                                                                Experimental
                                                                                                                of(applicative, value)

                                                                                                                Constructs an applicative containing the given value.

                                                                                                                -
                                                                                                                Experimental

                                                                                                                Source Code

                                                                                                                Defined in src/core/fantasy-land/index.js at line 16, column 0
                                                                                                                {
                                                                                                                -  apply: require('./apply'),
                                                                                                                -  concat: require('./concat'),
                                                                                                                -  chain: require('./chain'),
                                                                                                                -  empty: require('./empty'),
                                                                                                                -  map: require('./map'),
                                                                                                                -  of: require('./of'),
                                                                                                                -  equals: require('./equals'),
                                                                                                                -  bimap: require('./bimap'),
                                                                                                                -  curried: require('./curried'),
                                                                                                                -  infix: require('./infix')
                                                                                                                -}
                                                                                                                Stability
                                                                                                                experimental
                                                                                                                Licence
                                                                                                                MIT
                                                                                                                Module
                                                                                                                folktale/src/core/fantasy-land
                                                                                                                Authors
                                                                                                                Authors
                                                                                                                • Quildreen Motta
                                                                                                                Maintainers
                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.infix.html b/docs/api/en/folktale.src.core.fantasy-land.infix.html deleted file mode 100644 index 4e85c55..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.infix.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - module folktale/core/fantasy-land/infix - - - - - -

                                                                                                                  module folktale/core/fantasy-land/infix

                                                                                                                  Method versions of the fantasy-land functions, supporting the -structure::fn(...) syntax.

                                                                                                                  -

                                                                                                                  Documentation

                                                                                                                  Method versions of the fantasy-land functions, supporting the -structure::fn(...) syntax.

                                                                                                                  -

                                                                                                                  Properties

                                                                                                                  Convenience

                                                                                                                  apply: infix(applicativeValue)

                                                                                                                  Applies the function inside an applicative to the value of another applicative.

                                                                                                                  -
                                                                                                                  Experimental
                                                                                                                  bimap: infix(transformLeft, transformRight)

                                                                                                                  Maps one function over each side of a Bifunctor.

                                                                                                                  -
                                                                                                                  Experimental
                                                                                                                  chain: infix(transformation)

                                                                                                                  Transforms a monad with an unary function.

                                                                                                                  -
                                                                                                                  Experimental
                                                                                                                  concat: infix(aSemigroup)

                                                                                                                  Joins two semigroups.

                                                                                                                  -
                                                                                                                  Experimental
                                                                                                                  empty: infix()

                                                                                                                  Returns the identity object for a monoid.

                                                                                                                  -
                                                                                                                  Experimental
                                                                                                                  map: infix(transformation)

                                                                                                                  Transforms the contents of a Functor.

                                                                                                                  -
                                                                                                                  Experimental
                                                                                                                  of: infix(value)

                                                                                                                  Constructs an applicative containing the given value.

                                                                                                                  -
                                                                                                                  Experimental

                                                                                                                  Source Code

                                                                                                                  Defined in src/core/fantasy-land/infix.js at line 17, column 0
                                                                                                                  {
                                                                                                                  -  apply: require('./apply').infix,
                                                                                                                  -  bimap: require('./bimap').infix,
                                                                                                                  -  chain: require('./chain').infix,
                                                                                                                  -  concat: require('./concat').infix,
                                                                                                                  -  empty: require('./empty').infix,
                                                                                                                  -  equals: require('./equals').infix,
                                                                                                                  -  map: require('./map').infix,
                                                                                                                  -  of: require('./of').infix
                                                                                                                  -}
                                                                                                                  Stability
                                                                                                                  experimental
                                                                                                                  Licence
                                                                                                                  MIT
                                                                                                                  Module
                                                                                                                  folktale/src/core/fantasy-land/infix
                                                                                                                  On This Page
                                                                                                                  Authors
                                                                                                                  Authors
                                                                                                                  • Quildreen Motta
                                                                                                                  Maintainers
                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.map.map.html b/docs/api/en/folktale.src.core.fantasy-land.map.map.html deleted file mode 100644 index 9e0e534..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.map.map.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - map - - - - - -

                                                                                                                    map

                                                                                                                    Transforms the contents of a Functor.

                                                                                                                    -

                                                                                                                    Signature

                                                                                                                    map(functor, transformation)
                                                                                                                    Type
                                                                                                                    forall F, a, b:
                                                                                                                    -  (F a, (a) => b) => F b
                                                                                                                    -where F is Functor

                                                                                                                    Documentation

                                                                                                                    Transforms the contents of a Functor.

                                                                                                                    -

                                                                                                                    Properties

                                                                                                                    Convenience

                                                                                                                    curried()

                                                                                                                    Transforms the contents of a Functor.

                                                                                                                    -
                                                                                                                    Experimental
                                                                                                                    infix(transformation)

                                                                                                                    Transforms the contents of a Functor.

                                                                                                                    -
                                                                                                                    Experimental

                                                                                                                    (Uncategorised)

                                                                                                                    Experimental

                                                                                                                    Source Code

                                                                                                                    Defined in src/core/fantasy-land/map.js at line 32, column 0
                                                                                                                    (functor, transformation) =>
                                                                                                                    -  isNew(functor) ?  functor[flMap](transformation)
                                                                                                                    -: isOld(functor) ?  warn(functor.map(transformation))
                                                                                                                    -: /*otherwise*/     unsupported(functor)
                                                                                                                    Stability
                                                                                                                    experimental
                                                                                                                    Licence
                                                                                                                    MIT
                                                                                                                    Module
                                                                                                                    folktale/src/core/fantasy-land/map
                                                                                                                    Authors
                                                                                                                    Authors
                                                                                                                    • @boris-marinov
                                                                                                                    • Quildreen Motta
                                                                                                                    Maintainers
                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.fantasy-land.of.of.html b/docs/api/en/folktale.src.core.fantasy-land.of.of.html deleted file mode 100644 index a9c3eaf..0000000 --- a/docs/api/en/folktale.src.core.fantasy-land.of.of.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - of - - - - - -

                                                                                                                      of

                                                                                                                      Constructs an applicative containing the given value.

                                                                                                                      -

                                                                                                                      Signature

                                                                                                                      of(applicative, value)
                                                                                                                      Type
                                                                                                                      forall F, a:
                                                                                                                      -  (F, a) => F a
                                                                                                                      -where F is Applicative

                                                                                                                      Documentation

                                                                                                                      Constructs an applicative containing the given value.

                                                                                                                      -

                                                                                                                      Properties

                                                                                                                      Convenience

                                                                                                                      curried()

                                                                                                                      Constructs an applicative containing the given value.

                                                                                                                      -
                                                                                                                      Experimental
                                                                                                                      infix(value)

                                                                                                                      Constructs an applicative containing the given value.

                                                                                                                      -
                                                                                                                      Experimental

                                                                                                                      (Uncategorised)

                                                                                                                      Experimental

                                                                                                                      Source Code

                                                                                                                      Defined in src/core/fantasy-land/of.js at line 35, column 0
                                                                                                                      (applicative, value) =>
                                                                                                                      -  isNew(applicative)     ?  applicative[flOf](value)
                                                                                                                      -: isCtorNew(applicative) ?  applicative.constructor[flOf](value)
                                                                                                                      -: isOld(applicative)     ?  warn(applicative.of(value))
                                                                                                                      -: isCtorOld(applicative) ?  warn(applicative.constructor.of(value))
                                                                                                                      -: /*otherwise*/             unsupported(applicative)
                                                                                                                      Stability
                                                                                                                      experimental
                                                                                                                      Licence
                                                                                                                      MIT
                                                                                                                      Module
                                                                                                                      folktale/src/core/fantasy-land/of
                                                                                                                      Authors
                                                                                                                      Authors
                                                                                                                      • @boris-marinov
                                                                                                                      • Quildreen Motta
                                                                                                                      Maintainers
                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.html b/docs/api/en/folktale.src.core.html deleted file mode 100644 index a77db44..0000000 --- a/docs/api/en/folktale.src.core.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - module folktale/core - - - - - -

                                                                                                                        module folktale/core

                                                                                                                        Provides essential functionality for functional programs.

                                                                                                                        -

                                                                                                                        Documentation

                                                                                                                        Provides essential functionality for functional programs.

                                                                                                                        -

                                                                                                                        What's in Core?

                                                                                                                        -

                                                                                                                        This module provides a range of features that are often used as -foundational building blocks in functional programming. It also -provides features for handling some common built-in JavaScript -structures in a functional way.

                                                                                                                        -

                                                                                                                        The operations are divided as follows:

                                                                                                                        -
                                                                                                                          -
                                                                                                                        • Modelling Data: The Core.ADT module provides an -implementation of Tagged Unions with limited pattern matching. -This can be used to model your application's data more accurately, -and thus make it harder to misuse that data;

                                                                                                                          -
                                                                                                                        • -
                                                                                                                        • Combining Functions: The Core.Lambda module provides -operations on functions that allow combining functions together -(like compose) or changing how you apply functions (like curry -or partialise);

                                                                                                                          -
                                                                                                                        • -
                                                                                                                        • Working with Objects as Dictionaries: The Core.Object module -provides operations that let you treat regular JavaScript objects -as dictionaries. Several JavaScript APIs expect that usage of -objects, but the built-in operations don't support this well, -so the Core.Object module addresses that.

                                                                                                                          -
                                                                                                                        • -
                                                                                                                        • Writing generic code with Fantasy-Land: The Core.FantasyLand -module takes care of the differences in the various versions of -the Fantasy Land spec, so you can write generic code that supports -many libraries implementing any version of the spec.

                                                                                                                          -
                                                                                                                        • -
                                                                                                                        -

                                                                                                                        Properties

                                                                                                                        Data Structures

                                                                                                                        adt

                                                                                                                        Provides utilities to define tagged unions.

                                                                                                                        -
                                                                                                                        Experimental

                                                                                                                        Fantasy Land

                                                                                                                        fantasyLand

                                                                                                                        Allows invoking methods of Fantasy Land structures without -worrying about the differences in multiple versions of the spec.

                                                                                                                        -
                                                                                                                        Experimental

                                                                                                                        Lambda Calculus

                                                                                                                        lambda

                                                                                                                        Core.Lambda provides you tools for transforming and combining -functions.

                                                                                                                        -
                                                                                                                        Experimental

                                                                                                                        Utilities for Native Objects

                                                                                                                        object

                                                                                                                        Core.Object provides utilities for working with objects as -dictionaries and records.

                                                                                                                        -
                                                                                                                        Experimental

                                                                                                                        Source Code

                                                                                                                        Defined in src/core/index.js at line 15, column 0
                                                                                                                        {
                                                                                                                        -  lambda: require('./lambda'),
                                                                                                                        -  adt: require('./adt'),
                                                                                                                        -  object: require('./object'),
                                                                                                                        -  fantasyLand: require('./fantasy-land')
                                                                                                                        -}
                                                                                                                        Stability
                                                                                                                        experimental
                                                                                                                        Licence
                                                                                                                        MIT
                                                                                                                        Module
                                                                                                                        folktale/src/core
                                                                                                                        Authors
                                                                                                                        Authors
                                                                                                                        • Quildreen Motta
                                                                                                                        Maintainers
                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.compose.all.html b/docs/api/en/folktale.src.core.lambda.compose.all.html deleted file mode 100644 index 2c7e75c..0000000 --- a/docs/api/en/folktale.src.core.lambda.compose.all.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - all - - - - - -

                                                                                                                          all

                                                                                                                          Conveniently composes multiple functions.

                                                                                                                          -

                                                                                                                          Signature

                                                                                                                          all(...fns)
                                                                                                                          Type
                                                                                                                          (Function...) -> Function

                                                                                                                          Documentation

                                                                                                                          Conveniently composes multiple functions.

                                                                                                                          -

                                                                                                                          Because compose is limited to two functions, composing more than that -is awkward:

                                                                                                                          -
                                                                                                                          const compose = require('folktale/core/lambda/compose')
                                                                                                                          -
                                                                                                                          -const inc    = (x) => x + 1;
                                                                                                                          -const double = (x) => x * 2;
                                                                                                                          -const square = (x) => x * x;
                                                                                                                          -
                                                                                                                          -const incDoubleSquare = compose(inc, compose(double, square));
                                                                                                                          -incDoubleSquare(3);
                                                                                                                          -// ==> 19
                                                                                                                          -

                                                                                                                          In these cases one may use compose.all, which is a variadic convenience -for composing multiple functions:

                                                                                                                          -
                                                                                                                          const incDoubleSquare2 = compose.all(inc, double, square);
                                                                                                                          -incDoubleSquare2(3);
                                                                                                                          -// ==> 19
                                                                                                                          -

                                                                                                                          Properties

                                                                                                                          (Uncategorised)

                                                                                                                          Experimental

                                                                                                                          Source Code

                                                                                                                          function(...fns) {
                                                                                                                          -  /* eslint-disable no-magic-numbers */
                                                                                                                          -  if (fns.length < 1) { // eslint-disable-next-line prefer-rest-params
                                                                                                                          -    throw new TypeError(`compose.all requires at least one argument, ${arguments.length} given.`);
                                                                                                                          -  }
                                                                                                                          -  return fns.reduce(compose);
                                                                                                                          -}
                                                                                                                          Stability
                                                                                                                          experimental
                                                                                                                          Licence
                                                                                                                          MIT
                                                                                                                          Module
                                                                                                                          folktale/src/core/lambda/compose
                                                                                                                          Authors
                                                                                                                          Authors
                                                                                                                          • Quildreen Motta
                                                                                                                          Maintainers
                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.compose.compose.html b/docs/api/en/folktale.src.core.lambda.compose.compose.html deleted file mode 100644 index bb37f4d..0000000 --- a/docs/api/en/folktale.src.core.lambda.compose.compose.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - compose - - - - - -

                                                                                                                            compose

                                                                                                                            Composes two functions.

                                                                                                                            -

                                                                                                                            Signature

                                                                                                                            compose(f, g)(value)
                                                                                                                            Type
                                                                                                                            (('b) => 'c, ('a) => 'b) => (('a) => 'c)

                                                                                                                            Documentation

                                                                                                                            Composes two functions.

                                                                                                                            -

                                                                                                                            Example:

                                                                                                                            -
                                                                                                                            const compose = require('folktale/core/lambda/compose');
                                                                                                                            -
                                                                                                                            -const inc       = (x) => x + 1;
                                                                                                                            -const double    = (x) => x * 2;
                                                                                                                            -const incDouble = compose(double, inc);
                                                                                                                            -
                                                                                                                            -incDouble(3);
                                                                                                                            -// ==> 8
                                                                                                                            -

                                                                                                                            Why Composition Matters?

                                                                                                                            -

                                                                                                                            Composition is a way of creating new functionality by combining -existing functionality. It helps managing complexity in software -projects, since newer functionality can be defined in terms of -existing ones, reducing both the amount of code needed to implement -newer features, and the amount of time one needs to spend to understand -them.

                                                                                                                            -

                                                                                                                            This technique is used very often in regular JavaScript code, when -we feed the results of a function into another function:

                                                                                                                            -
                                                                                                                            const names = [
                                                                                                                            -  'Alissa', 'Max', 'Talib'
                                                                                                                            -];
                                                                                                                            -const upcase = (name) => name.toUpperCase();
                                                                                                                            -
                                                                                                                            -names.map(upcase).join(', ');
                                                                                                                            -// ==> 'ALISSA, MAX, TALIB'
                                                                                                                            -

                                                                                                                            Here names is fed into the map function, which returns an array -of the same names in capitals. This new array is then fed into the -join function, which returns a String where the items are separated -by a comma.

                                                                                                                            -

                                                                                                                            If we need to use .map(upcase).join(', ') in a lot of places, it -makes sense to create a new function that captures that composition, -so we don't have to type it everywhere:

                                                                                                                            -
                                                                                                                            const showNames = (names) =>
                                                                                                                            -  names.map(upcase).join(', ');
                                                                                                                            -

                                                                                                                            Now we can use showNames instead of .map(upcase).join(', '), and -we get the same functionality:

                                                                                                                            -
                                                                                                                            showNames(names);
                                                                                                                            -// ==> 'ALISSA, MAX, TALIB'
                                                                                                                            -

                                                                                                                            The Problem With Methods in JavaScript

                                                                                                                            -

                                                                                                                            JavaScript is a hybrid language, where you can express programs by -using object oriented techniques, functional programming techniques, -and some other paradigms. It's not uncommon to see parts of a program -expressed in OOP, as in the examples from the previous section.

                                                                                                                            -

                                                                                                                            However, objects in JavaScript can't be safely extended. Ideally, we'd -like to write:

                                                                                                                            -
                                                                                                                            names.show();
                                                                                                                            -

                                                                                                                            Instead of:

                                                                                                                            -
                                                                                                                            showNames(names);
                                                                                                                            -

                                                                                                                            Which would be more consistent with the rest of the program. Because -this involves mutating the array, all sorts of problems could happen -so it's better to keep the new functionality as a separate function.

                                                                                                                            -

                                                                                                                            Expressing things in functional programming doesn't have this problem -because functions exist on their own, rather than being part of an -object.

                                                                                                                            -

                                                                                                                            Composition in Functional Programming

                                                                                                                            -

                                                                                                                            In functional programming, functions are the basic building block, -and we compose functions to create bigger things. To do this, we often -have to rephrase the common method calls in terms of regular functions:

                                                                                                                            -
                                                                                                                            const names = [
                                                                                                                            -  'Alissa', 'Max', 'Talib'
                                                                                                                            -];
                                                                                                                            -
                                                                                                                            -const upcase = (name) => name.toUpperCase();
                                                                                                                            -const map    = (transform, items) => items.map(transform);
                                                                                                                            -const join   = (separator, items) => items.join(separator);
                                                                                                                            -

                                                                                                                            With this we can express the composition in terms of regular function -calls:

                                                                                                                            -
                                                                                                                            const showNames = (names) =>
                                                                                                                            -  join(', ', map(upcase, names));
                                                                                                                            -
                                                                                                                            -showNames(names);
                                                                                                                            -// ==> 'ALISSA, MAX, TALIB'
                                                                                                                            -

                                                                                                                            Now, while the way this program expresses its functions is consistent, -we still have to move the whole expression into the function, and -our code is not as easy to follow as before. Rather than reading from -left to right, we have to first read the inside of a function application -before we read what's outside of it.

                                                                                                                            -

                                                                                                                            These issues are not a problem with simple expressions such as these, -and most of the expressions in functional programming tend to be very -simple. But we can improve this by abstracting over the idea of -composition. That is, instead of requiring syntactic composition, by -having people write out the whole expression, we can ask the program -to combine these functions for us. This is what the compose function -does:

                                                                                                                            -
                                                                                                                            const compose = require('folktale/core/lambda/compose');
                                                                                                                            -
                                                                                                                            -const showNames2 = compose(
                                                                                                                            -  capitals => join(', ', capitals),
                                                                                                                            -  names    => map(upcase, names)
                                                                                                                            -);
                                                                                                                            -

                                                                                                                            Instead of reading from inside of a complex expression to the outside, -now you can read each expression on its own, and visualise the flow of -data linearly.

                                                                                                                            -
                                                                                                                            -

                                                                                                                            CONVENIENCE
                                                                                                                            compose does right-to-left composition, so the last function is -applied first. You can use the infix version of compose to avoid -this.

                                                                                                                            -
                                                                                                                            -

                                                                                                                            Currying and Composition

                                                                                                                            -

                                                                                                                            Composing unary functions is trivial, as seen on the first example -of this documentation:

                                                                                                                            -
                                                                                                                            const compose = require('folktale/core/lambda/compose');
                                                                                                                            -
                                                                                                                            -const inc       = (x) => x + 1;
                                                                                                                            -const double    = (x) => x * 2;
                                                                                                                            -const incDouble = compose(double, inc);
                                                                                                                            -

                                                                                                                            But composing functions that take more than one argument doesn't read -as naturally:

                                                                                                                            -
                                                                                                                            const upcase = (name) => name.toUpperCase();
                                                                                                                            -const map    = (transform, items) => items.map(transform);
                                                                                                                            -const join   = (separator, items) => items.join(separator);
                                                                                                                            -
                                                                                                                            -const showNames = compose(
                                                                                                                            -  capitals => join(', ', capitals),
                                                                                                                            -  names    => map(upcase, names)
                                                                                                                            -);
                                                                                                                            -

                                                                                                                            The problem is that compose can only safely compose unary functions, -so you have to do some additional work to place the values in the -"right places" when your function takes more than one argument.

                                                                                                                            -

                                                                                                                            One way to solve this problem is to curry the functions that will be -composed. That is, turn a function of arity N, into N functions of -arity 1:

                                                                                                                            -
                                                                                                                            const upcase2 = (name) => name.toUpperCase();
                                                                                                                            -const map2    = (transform) => (items) => items.map(transform);
                                                                                                                            -const join2   = (separator) => (items) => items.join(separator);
                                                                                                                            -
                                                                                                                            -const showNames2 = compose(join2(', '), map2(upcase2));
                                                                                                                            -

                                                                                                                            Note that with a small change to how map and join are defined, we -can make a much better use of the compose function. This is not -without its drawbacks, however, as now join has to be called as -join(',')(names).

                                                                                                                            -
                                                                                                                            -

                                                                                                                            CONVENIECE
                                                                                                                            Folktale offers a curry function as a convenience for automatically -creating curried versions of existing functions, which also works -around the 1-argument limitation.

                                                                                                                            -

                                                                                                                            See folktale/core/lambda/curry for details.

                                                                                                                            -
                                                                                                                            -

                                                                                                                            Another way to work around this problem is by using the partialise -function provided by Folktale. This function creates a new function -that specifies only parts of the argument for the original function:

                                                                                                                            -
                                                                                                                            const partialise = require('folktale/core/lambda/partialise');
                                                                                                                            -const _          = partialise.hole;
                                                                                                                            -
                                                                                                                            -const upcase3 = (name) => name.toUpperCase();
                                                                                                                            -const map3    = partialise(2, (transform, items) => items.map(transform));
                                                                                                                            -const join3   = partialise(2, (separator, items) => items.join(separator));
                                                                                                                            -
                                                                                                                            -const showNames3 = compose(
                                                                                                                            -  join3(', ', _),
                                                                                                                            -  map3(upcase, _)
                                                                                                                            -);
                                                                                                                            -

                                                                                                                            See folktale/core/lambda/partialise for more information on how the -partialise function works.

                                                                                                                            -

                                                                                                                            Composing More Than Two Functions

                                                                                                                            -

                                                                                                                            The compose operation is limited to composing only two functions. -This might sound limiting, but it ensures that function composition -is well-defined.

                                                                                                                            -

                                                                                                                            Because a lot of functions in JavaScript are expected to be variadic, -and just ignore the additional parameters, you'd get some very -surprising behaviour when trying to pass compose to them. For example, -the following would throw a type error:

                                                                                                                            -
                                                                                                                            const compose = require('folktale/core/lambda/compose');
                                                                                                                            -
                                                                                                                            -const inc    = (x) => x + 1;
                                                                                                                            -const double = (x) => x * 2;
                                                                                                                            -const square = (x) => x * x;
                                                                                                                            -
                                                                                                                            -[inc, double, square].reduce(compose)(3);
                                                                                                                            -// ==> throws TypeError: '1 is not a function'
                                                                                                                            -

                                                                                                                            Because it's equivalent to:

                                                                                                                            -
                                                                                                                            const fns = [inc, double, square];
                                                                                                                            -compose(
                                                                                                                            -  compose(
                                                                                                                            -    square,
                                                                                                                            -    double,
                                                                                                                            -    1,
                                                                                                                            -    fns
                                                                                                                            -  ),
                                                                                                                            -  inc
                                                                                                                            -  0,
                                                                                                                            -  fns
                                                                                                                            -)(3);
                                                                                                                            -

                                                                                                                            If you need to compose more than two functions, you can use the -infix syntax, or the all convenience function.

                                                                                                                            -

                                                                                                                            Composition With The Infix Syntax

                                                                                                                            -

                                                                                                                            With the This-Binding syntax proposed for JavaScript, it's -possible to compose multiple functions in an, arguably, more natural way:

                                                                                                                            -
                                                                                                                             const compose = require('folktale/core/lambda/compose');
                                                                                                                            -
                                                                                                                            - const then  = compose.infix;
                                                                                                                            - const inc   = (x) => x + 1;
                                                                                                                            - const plus4 = inc::then(inc)::then(inc)::then(inc);
                                                                                                                            -
                                                                                                                            - plus4(2);
                                                                                                                            - // ==> 6
                                                                                                                            -

                                                                                                                            Composition With The all Function

                                                                                                                            -

                                                                                                                            If you need to compose more than two functions, you might consider using -the all convenience function instead, which is variadic:

                                                                                                                            -
                                                                                                                            const compose = require('folktale/core/lambda/compose');
                                                                                                                            -
                                                                                                                            -const inc   = (x) => x + 1;
                                                                                                                            -const plus4 = compose.all(inc, inc, inc, inc);
                                                                                                                            -
                                                                                                                            -plus4(2);
                                                                                                                            -// ==> 6
                                                                                                                            -

                                                                                                                            Composition with the all convenience still happens from right to left.

                                                                                                                            -

                                                                                                                            Properties

                                                                                                                            Convenience

                                                                                                                            all(...fns)

                                                                                                                            Conveniently composes multiple functions.

                                                                                                                            -
                                                                                                                            Experimental
                                                                                                                            infix(that)

                                                                                                                            Conveniently composes function with the This-Binding syntax.

                                                                                                                            -
                                                                                                                            Experimental

                                                                                                                            (Uncategorised)

                                                                                                                            Experimental

                                                                                                                            Source Code

                                                                                                                            Defined in src/core/lambda/compose.js at line 21, column 0
                                                                                                                            (f, g) => (value) => f(g(value))
                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.compose.infix.html b/docs/api/en/folktale.src.core.lambda.compose.infix.html deleted file mode 100644 index 20c0310..0000000 --- a/docs/api/en/folktale.src.core.lambda.compose.infix.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - infix - - - - - -

                                                                                                                            infix

                                                                                                                            Conveniently composes function with the This-Binding syntax.

                                                                                                                            -

                                                                                                                            Signature

                                                                                                                            infix(that)
                                                                                                                            Type
                                                                                                                            (('b) => 'c) . (('a) => 'b) => (('a) => 'c)

                                                                                                                            Documentation

                                                                                                                            Conveniently composes function with the This-Binding syntax.

                                                                                                                            -

                                                                                                                            This is a free-method version of compose that applies the this -argument first, then the function it takes as argument. It's meant -to be used with the This-Binding Syntax proposal.

                                                                                                                            -
                                                                                                                            const then   = compose.infix;
                                                                                                                            -const inc    = (x) => x + 1;
                                                                                                                            -const double = (x) => x * 2;
                                                                                                                            -
                                                                                                                            -inc::then(double)(2);  // ==> 6
                                                                                                                            -

                                                                                                                            Properties

                                                                                                                            (Uncategorised)

                                                                                                                            Experimental

                                                                                                                            Source Code

                                                                                                                            function(that) {
                                                                                                                            -  return compose(that, this);
                                                                                                                            -}
                                                                                                                            Stability
                                                                                                                            experimental
                                                                                                                            Licence
                                                                                                                            MIT
                                                                                                                            Module
                                                                                                                            folktale/src/core/lambda/compose
                                                                                                                            Authors
                                                                                                                            Authors
                                                                                                                            • Quildreen Motta
                                                                                                                            Maintainers
                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.constant.constant.html b/docs/api/en/folktale.src.core.lambda.constant.constant.html deleted file mode 100644 index 86fcce2..0000000 --- a/docs/api/en/folktale.src.core.lambda.constant.constant.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - constant - - - - - -

                                                                                                                              constant

                                                                                                                              The constant combinator; always returns the first argument given.

                                                                                                                              -

                                                                                                                              Signature

                                                                                                                              constant(value)
                                                                                                                              Type
                                                                                                                              ('a) => ('b) => 'a

                                                                                                                              Documentation

                                                                                                                              The constant combinator; always returns the first argument given.

                                                                                                                              -

                                                                                                                              Example:

                                                                                                                              -
                                                                                                                              const constant = require('folktale/core/lambda/constant');
                                                                                                                              -
                                                                                                                              -[1, 2, 3].map(constant(0));
                                                                                                                              -// ==> [0, 0, 0]
                                                                                                                              -

                                                                                                                              Why?

                                                                                                                              -

                                                                                                                              Constant combinators can be passed to higher-order operations if you -want to provide a plain value, but the operation expects a function -providing a value:

                                                                                                                              -
                                                                                                                              const constant = require('folktale/core/lambda/constant');
                                                                                                                              -
                                                                                                                              -[1, 2, 3].map(constant(0));
                                                                                                                              -// ==> [0, 0, 0]
                                                                                                                              -

                                                                                                                              For a primitive, there's usually not much of a difference between -using the constant combinator or an arrow function. In fact, for -most cases, using the arrow function is preferred:

                                                                                                                              -
                                                                                                                              [1, 2, 3].map(() => 0);
                                                                                                                              -// ==> [0, 0, 0]
                                                                                                                              -

                                                                                                                              The problem with using arrows is that the value is computed lazily. -That is, it's computed only when the arrow is evaluated, and recomputed -many times if the arrow is evaluated many times. The constant combinator -lets you evaluate something eagerly instead.

                                                                                                                              -

                                                                                                                              You can see the importance of this when effects are involved:

                                                                                                                              -
                                                                                                                              let counter = 0;
                                                                                                                              -const next = () => ++counter;
                                                                                                                              -
                                                                                                                              -['a', 'b', 'c'].map(constant(next()));
                                                                                                                              -// ==> [1, 1, 1]
                                                                                                                              -
                                                                                                                              -counter = 0;
                                                                                                                              -['a', 'b', 'c'].map(_ => next());
                                                                                                                              -// ==> [1, 2, 3]
                                                                                                                              -

                                                                                                                              Expensive pure computations are another place where constant is desirable -over plain arrows, given that one'd rather avoid re-evaluating the -computation unnecessarily.

                                                                                                                              -

                                                                                                                              Properties

                                                                                                                              (Uncategorised)

                                                                                                                              Source Code

                                                                                                                              Defined in src/core/lambda/constant.js at line 21, column 0
                                                                                                                              (value) => (_) => value
                                                                                                                              Stability
                                                                                                                              stable
                                                                                                                              Licence
                                                                                                                              MIT
                                                                                                                              Module
                                                                                                                              folktale/src/core/lambda/constant
                                                                                                                              Authors
                                                                                                                              Authors
                                                                                                                              • Quildreen Motta
                                                                                                                              Maintainers
                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.curry.curry.html b/docs/api/en/folktale.src.core.lambda.curry.curry.html deleted file mode 100644 index 78011d0..0000000 --- a/docs/api/en/folktale.src.core.lambda.curry.curry.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - curry - - - - - -

                                                                                                                                curry

                                                                                                                                Transforms functions of arity N into a chain of N unary functions

                                                                                                                                -

                                                                                                                                Signature

                                                                                                                                curry(arity, fn)
                                                                                                                                Type
                                                                                                                                (Number, (Any...) => 'a) => Any... => 'a or ((Any...) => 'a)

                                                                                                                                Documentation

                                                                                                                                Transforms functions of arity N into a chain of N unary functions

                                                                                                                                -

                                                                                                                                Example:

                                                                                                                                -
                                                                                                                                const curry = require('folktale/core/lambda/curry');
                                                                                                                                -
                                                                                                                                -const property = curry(2, (key, object) => object[key]);
                                                                                                                                -const people = [
                                                                                                                                -  { name: 'Alissa', age: 26 },
                                                                                                                                -  { name: 'Max',    age: 19 },
                                                                                                                                -  { name: 'Talib',  age: 28 }
                                                                                                                                -];
                                                                                                                                -
                                                                                                                                -people.map(property('name'));
                                                                                                                                -// ==> ['Alissa', 'Max', 'Talib']
                                                                                                                                -

                                                                                                                                What is "Currying"?

                                                                                                                                -

                                                                                                                                Currying is the process of transforming a function that takes N arguments -all at once, into a series of functions that take one argument at a time. -This makes it possible to construct new funcionality by specialising part -of the arguments.

                                                                                                                                -

                                                                                                                                For example, the property function takes two arguments: the object that -contains the property, and the name of the property to retrieve:

                                                                                                                                -
                                                                                                                                const property = (object, key) => object[key];
                                                                                                                                -

                                                                                                                                Because of this, every time someone call property they must provide both -arguments:

                                                                                                                                -
                                                                                                                                property({ greeting: 'Hi' }, 'greeting');
                                                                                                                                -// ==> 'Hi'
                                                                                                                                -

                                                                                                                                Some of the time, you only have some of the arguments, however. For example, -if you wanted to create a function that always gets the greeting of a -particular object, you would have to do so manually:

                                                                                                                                -
                                                                                                                                const greeting = (object) => property(object, 'greeting');
                                                                                                                                -
                                                                                                                                -greeting({ greeting: 'Hi' });
                                                                                                                                -// ==> 'Hi'
                                                                                                                                -

                                                                                                                                Currying alleviates the need for constructing these functions manually. If -property was curried, you'd be able to create a new greeting function -by just specifying some of the arguments, like you would do when invoking -the function:

                                                                                                                                -
                                                                                                                                const property2 = (key) => (object) => object[key];
                                                                                                                                -const greeting2 = property2('greeting');
                                                                                                                                -
                                                                                                                                -greeting({ greeting: 'Hi' });
                                                                                                                                -

                                                                                                                                Note that the way we use arguments in a curried function is slightly -different. When designing a function to be curried, you should consider -which parameters are most likely to be fixed, and which parameters will -be provided afterwards. In this case, it's much more likely for someone -to have the name of a property than it is for them to have the object -in which that property lives:

                                                                                                                                -
                                                                                                                                const score = [{ type: 'win' }, { type: 'draw' }];
                                                                                                                                -score.map(property2('type'));
                                                                                                                                -// ==> ['win', 'draw']
                                                                                                                                -

                                                                                                                                Why Use Currying?

                                                                                                                                -

                                                                                                                                Functional programming places a heavy emphasis on function composition, -but sometimes we have functions that don't exactly fit the places we -want to use them. For example, Array.prototype.map expects a function -that takes three arguments:

                                                                                                                                -
                                                                                                                                type Array.prototype.map =
                                                                                                                                -  Array<'element> . (
                                                                                                                                -    ('element, index is Number, Array<'element>) => 'newElement
                                                                                                                                -  ) => Array<'newElement>
                                                                                                                                -

                                                                                                                                That is, given an array of of some element type, our callback, which -receives not only this element, but also the index of that element in -the array, and even the original array, is supposed to return a newElement -to put in the old element's place.

                                                                                                                                -

                                                                                                                                We can use Array.prototype.map to easily transform the data in the -array by some function. To expand a bit on the initial example, suppose -we have an array of people:

                                                                                                                                -
                                                                                                                                const people = [
                                                                                                                                -  { name: 'Alissa', age: 26, pronoun: 'she'  },
                                                                                                                                -  { name: 'Max',    age: 19, pronoun: 'they' },
                                                                                                                                -  { name: 'Talib',  age: 28, pronoun: 'he'   }
                                                                                                                                -];
                                                                                                                                -

                                                                                                                                And then you want to get the name of one of those people. We can use -Array.prototype.map for this:

                                                                                                                                -
                                                                                                                                people.map((element, index, array) => element.name);
                                                                                                                                -// ==> ['Alissa', 'Max', 'Talib']
                                                                                                                                -
                                                                                                                                -

                                                                                                                                NOTE
                                                                                                                                Because functions in JavaScript are variadic, you don't need to -create a function with three parameters here. The following code -is strictly equivalent:

                                                                                                                                -
                                                                                                                                people.map(person => person.name);
                                                                                                                                -// ==> ['Alissa', 'Max', 'Talib']
                                                                                                                                -
                                                                                                                                -

                                                                                                                                This is all well and good, because this is the only place where we use -this kind of functionality. But what if we have very similar functionality -in more places. For example, just like we got the names of these people, -we could get their ages:

                                                                                                                                -
                                                                                                                                people.map(person => person.age);
                                                                                                                                -// ==> [26, 19, 28]
                                                                                                                                -

                                                                                                                                Or the pronoun they use:

                                                                                                                                -
                                                                                                                                people.map(person => person.pronoun);
                                                                                                                                -// ==> ['she', 'they', 'he']
                                                                                                                                -

                                                                                                                                At this point, we're duplicating this functionality in many places. It -would be more productive to move it to a function we can reuse. And this -is easy enough:

                                                                                                                                -
                                                                                                                                const property = (object, key) => object[key];
                                                                                                                                -

                                                                                                                                But this attempt is not really a good one in this case. Now composing -things is even more trouble:

                                                                                                                                -
                                                                                                                                people.map(person => property(person, 'name'));
                                                                                                                                -

                                                                                                                                Ideally, we'd want:

                                                                                                                                -
                                                                                                                                people.map(property);
                                                                                                                                -

                                                                                                                                But property takes two arguments, and Array.prototype.map can only -provide one of them: the object we should retrieve the property from. -Where do we get the other one from? Well, the name of the property is -static. We know exactly what we need from the callsite.

                                                                                                                                -

                                                                                                                                As said in the previous section, thinking about which arguments are likely -to be specified, and what aren't is important when designing curried -functions. For this case, we want to specialise the key, and leave -object to be provided by some other piece of code:

                                                                                                                                -
                                                                                                                                 const property = (key) => (object) => object[key];
                                                                                                                                -
                                                                                                                                - people.map(property('name'));
                                                                                                                                - // ==> ['Alissa', 'Max', 'Talib']
                                                                                                                                -
                                                                                                                                - people.map(property('age'));
                                                                                                                                - // ==> [26, 19, 28]
                                                                                                                                -
                                                                                                                                - people.map(property('pronoun'));
                                                                                                                                - // ==> ['she', 'they', 'he'] 
                                                                                                                                -

                                                                                                                                So, with currying, it becomes much simpler to shape a function so it -fits the expectations of the place where you want to use it. It alleviates -the need of making this translation manually, but it also requires some -prior thought on how these functions are likely to be used.

                                                                                                                                -

                                                                                                                                How Folktale's curry Works?

                                                                                                                                -

                                                                                                                                The curry operation makes it simpler to construct curried functions -that work well with JavaScript, where functions may, and often do, take -more than one argument.

                                                                                                                                -

                                                                                                                                Consider the following example:

                                                                                                                                -
                                                                                                                                const joinedBy = (separator) => (list) => (item) =>
                                                                                                                                -  list.concat([separator, item]);
                                                                                                                                -

                                                                                                                                It's a curried function that takes 3 arguments, one at a time. To invoke -it one must do so like this:

                                                                                                                                -
                                                                                                                                joinedBy(',')(['a'])('b');
                                                                                                                                -// ==> ['a', ',', 'b']
                                                                                                                                -

                                                                                                                                This makes it harder to use it for functions that pass two arguments to -their callbacks, like Array.prototype.reduce, because JavaScript passes -them all at once:

                                                                                                                                -
                                                                                                                                ['b'].reduce(joinedBy(','), ['a']);
                                                                                                                                -// ==> [<function>, <function>]
                                                                                                                                -

                                                                                                                                This is where curry helps. It allows you to curry functions, while -unrolling application of more than one argument:

                                                                                                                                -
                                                                                                                                const curry = require('folktale/core/lambda/curry');
                                                                                                                                -
                                                                                                                                -const joinedBy2 = curry(3, (separator, list, item) =>
                                                                                                                                -  list.concat([separator, item]) 
                                                                                                                                -);
                                                                                                                                -
                                                                                                                                -joinedBy2(',', ['a'], 'b');
                                                                                                                                -// ==> ['a', ',', 'b']
                                                                                                                                -
                                                                                                                                -['b'].reduce(joinedBy2(','), ['a']);
                                                                                                                                -// ==> ['a', ',', 'b']
                                                                                                                                -

                                                                                                                                curry, Under The Hood

                                                                                                                                -

                                                                                                                                How can curry construct functions that support such different styles -of passing arguments? The secret is in how curry does unrolling. A -function constructed by curry takes two arguments:

                                                                                                                                -
                                                                                                                                  -
                                                                                                                                1. The number of arguments that are expected for that function (arity);
                                                                                                                                2. -
                                                                                                                                3. The function that should be called when those arguments are collected.
                                                                                                                                4. -
                                                                                                                                -

                                                                                                                                In return, curry gives you back a function that, at first, only collects -arguments. That is, until we reach the amount of arguments expected (arity), -applying the curryed function gives you back a new function that you -continue to apply:

                                                                                                                                -
                                                                                                                                const curry = require('folktale/core/lambda/curry');
                                                                                                                                -
                                                                                                                                -const f = curry(4, (a, b, c, d) => [a, b, c, d]);
                                                                                                                                -
                                                                                                                                -// Previous arguments: []
                                                                                                                                -const f1 = f();
                                                                                                                                -// New arguments:      []
                                                                                                                                -
                                                                                                                                -// Previous arguments: []
                                                                                                                                -const f2 = f1(1);
                                                                                                                                -// New arguments:      [1]
                                                                                                                                -
                                                                                                                                -// Previous arguments: [1]
                                                                                                                                -const f3 = f2(2, 3);
                                                                                                                                -// New arguments:      [1, 2, 3]
                                                                                                                                -
                                                                                                                                -// Previous arguments: [1, 2, 3]
                                                                                                                                -f3(4);
                                                                                                                                -// ==> [1, 2, 3, 4]
                                                                                                                                -

                                                                                                                                The curried function keeps track of these arguments in an internal array. -This array is not modified when you apply a curried function. Instead, you -get a new function with a separate "internal arguments array":

                                                                                                                                -
                                                                                                                                // Previous arguments: [1]
                                                                                                                                -const f2_a = f2(4);  // => [1, 4]
                                                                                                                                -const f2_b = f2(5);  // => [1, 5]
                                                                                                                                -
                                                                                                                                -f2_a(5, 6); // ==> [1, 4, 5, 6]
                                                                                                                                -f2_b(5, 6); // ==> [1, 5, 5, 6]
                                                                                                                                -

                                                                                                                                Once the curried function has collected all of the arguments it needs to, -it "unrolls" the application. That is, it provides the arguments collected -to the original function:

                                                                                                                                -
                                                                                                                                const plus  = (a, b, c) => a + b + c;
                                                                                                                                -const plus2 = curry(3, plus);
                                                                                                                                -
                                                                                                                                -    plus2(1)(2)(3)
                                                                                                                                -=== plus2(1, 2)(3)
                                                                                                                                -=== plus2(1, 2, 3)
                                                                                                                                -=== plus(1, 2, 3)
                                                                                                                                -=== 1 + 2 + 3;
                                                                                                                                -

                                                                                                                                What happens if a curried function receives more arguments than it expects, -though? If the wrapped function is a regular JavaScript function, it's the -same. curry passes all of the arguments to it, and because JavaScript -functions are variadic, those additional arguments get (usually) ignored:

                                                                                                                                -
                                                                                                                                    plus2(1)(2)(3, 4, 5)
                                                                                                                                -=== plus2(1, 2)(3, 4, 5)
                                                                                                                                -=== plus2(1, 2, 3, 4, 5)
                                                                                                                                -=== plus(1, 2, 3, 4, 5)
                                                                                                                                -=== 1 + 2 + 3;
                                                                                                                                -

                                                                                                                                If the wrapped function is itself a curried function, things get more -interesting though, because the curried functio will, itself, unroll -the rest of the application!

                                                                                                                                -
                                                                                                                                const subtract = curry(2, (x, y) => x - y);
                                                                                                                                -const flip     = curry(3, (f, x, y) => f(y, x));
                                                                                                                                -
                                                                                                                                -    subtract(1)(2)
                                                                                                                                -=== subtract(1, 2)
                                                                                                                                -=== 1 - 2;
                                                                                                                                -
                                                                                                                                -    flip(subtract)(1)(2)
                                                                                                                                -=== flip(subtract, 1)(2)
                                                                                                                                -=== flip(subtract, 1, 2)
                                                                                                                                -=== subtract(2, 1)
                                                                                                                                -=== 2 - 1;
                                                                                                                                -

                                                                                                                                Unrolling makes it possible to compose curried functions naturally, without -getting in the way of regular JavaScript functions.

                                                                                                                                -
                                                                                                                                -

                                                                                                                                NOTE
                                                                                                                                Using curry for real variadic functions is strongly discouraged, given -that it's hard to predict which arguments will end up being provided to -the variadic function.

                                                                                                                                -
                                                                                                                                -

                                                                                                                                Drawbacks of Using curry

                                                                                                                                -

                                                                                                                                While curry certainly helps composing functions, it's important to note -that, because a lot of functions in JavaScript are variadic, and because -people take advantage of this (by relying on the number of arguments -provided for optional parameters or overloading the signature), -composition of such functions is not well-defined, and curry makes -things even less predictable for these cases.

                                                                                                                                -

                                                                                                                                Because of this, the use of curry for variadic functions is strongly -discouraged.

                                                                                                                                -

                                                                                                                                One also must consider the overhead of introducing curry in a codebase. -For most code, this overhead is negligible, but curry should be avoided -in code paths that require more performance.

                                                                                                                                -

                                                                                                                                Properties

                                                                                                                                (Uncategorised)

                                                                                                                                Experimental

                                                                                                                                Source Code

                                                                                                                                Defined in src/core/lambda/curry.js at line 21, column 0
                                                                                                                                (arity, fn) => {
                                                                                                                                -  const curried = (oldArgs) => (...newArgs) => {
                                                                                                                                -    const allArgs  = oldArgs.concat(newArgs);
                                                                                                                                -    const argCount = allArgs.length;
                                                                                                                                -
                                                                                                                                -    return argCount < arity   ?  curried(allArgs)
                                                                                                                                -    :      /* otherwise */       fn(...allArgs);
                                                                                                                                -  };
                                                                                                                                -
                                                                                                                                -  return curried([]);
                                                                                                                                -}
                                                                                                                                Stability
                                                                                                                                experimental
                                                                                                                                Licence
                                                                                                                                MIT
                                                                                                                                Module
                                                                                                                                folktale/src/core/lambda/curry
                                                                                                                                Authors
                                                                                                                                Authors
                                                                                                                                • Quildreen Motta
                                                                                                                                Maintainers
                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.html b/docs/api/en/folktale.src.core.lambda.html deleted file mode 100644 index 2790148..0000000 --- a/docs/api/en/folktale.src.core.lambda.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - module folktale/core/lambda - - - - - -

                                                                                                                                  module folktale/core/lambda

                                                                                                                                  Core.Lambda provides you tools for transforming and combining -functions.

                                                                                                                                  -

                                                                                                                                  Documentation

                                                                                                                                  Core.Lambda provides you tools for transforming and combining -functions.

                                                                                                                                  -

                                                                                                                                  Programming by Combining Functions

                                                                                                                                  -

                                                                                                                                  Functional programming places a heavy emphasis on writing programs -by combining lots of small, focused functions. JavaScript doesn't -really have a good support for this out of the box, so you're left -with composing these functions manually, by defining a new function.

                                                                                                                                  -

                                                                                                                                  This is not so bad in ECMAScript 2015, thanks to the new arrow -function syntax:

                                                                                                                                  -
                                                                                                                                  const people = [
                                                                                                                                  -  { name: 'Alissa' },
                                                                                                                                  -  { name: 'Max' },
                                                                                                                                  -  { name: 'Talib' }
                                                                                                                                  -];
                                                                                                                                  -people.map(person => person.name);
                                                                                                                                  -// ==> ['Alissa', 'Max', 'Talib']
                                                                                                                                  -

                                                                                                                                  But there are times in which arrow functions don't quite cut it. -For example, if one wants to evaluate something eagerly, a constant -combinator makes more sense:

                                                                                                                                  -
                                                                                                                                  const counter = {
                                                                                                                                  -  value: 0,
                                                                                                                                  -  next()  { return ++this.value },
                                                                                                                                  -  reset() { this.value = 0 }
                                                                                                                                  -};
                                                                                                                                  -const constant = require('folktale/core/lambda/constant');
                                                                                                                                  -
                                                                                                                                  -counter.reset();
                                                                                                                                  -[0, 0, 0].map(constant(counter.next()));
                                                                                                                                  -// ==> [1, 1, 1]
                                                                                                                                  -
                                                                                                                                  -// Arrows are evaluated lazily, so they don't work for this
                                                                                                                                  -counter.reset();
                                                                                                                                  -[0, 0, 0].map(_ => counter.next());
                                                                                                                                  -// ==> [1, 2, 3]
                                                                                                                                  -
                                                                                                                                  -// One must store the value somewhere instead
                                                                                                                                  -counter.reset();
                                                                                                                                  -[0, 0, 0].map((x => _ => x)(counter.next()))
                                                                                                                                  -

                                                                                                                                  What's in Core.Lambda?

                                                                                                                                  -

                                                                                                                                  Core.Lambda provides combinators and operations that transform the -signature of a function. The operations in the module are divided -as thus:

                                                                                                                                  -
                                                                                                                                    -
                                                                                                                                  • Combining: contains functions that combines functionality -present in different functions into a single function. Composing -functions is an example.

                                                                                                                                    -
                                                                                                                                  • -
                                                                                                                                  • Combinators: functions that just re-arrange the arguments -they're given. They're convenient ways of writing a particular -operation, but don't have any special behaviour of their own, -nor use anything besides the arguments they're given. Constant -and Identity are common combinators.

                                                                                                                                    -
                                                                                                                                  • -
                                                                                                                                  • Currying and Partialisation: functions that transform -how parameters are provided to a function. Currying allows a -function to take parameters one at a time, whereas partialisation -allows one to provide some of the positional parameters without -executing the function before the rest is provided.

                                                                                                                                    -
                                                                                                                                  • -
                                                                                                                                  -

                                                                                                                                  Properties

                                                                                                                                  Combinators

                                                                                                                                  constant(value)

                                                                                                                                  The constant combinator; always returns the first argument given.

                                                                                                                                  -
                                                                                                                                  identity(value)

                                                                                                                                  The identity combinator; always returns the argument given.

                                                                                                                                  -

                                                                                                                                  Combining

                                                                                                                                  compose(f, g)(value)

                                                                                                                                  Composes two functions.

                                                                                                                                  -

                                                                                                                                  Currying and Partialisation

                                                                                                                                  curry(arity, fn)

                                                                                                                                  Transforms functions of arity N into a chain of N unary functions

                                                                                                                                  -
                                                                                                                                  Experimental
                                                                                                                                  partialise(arity, fn)

                                                                                                                                  Creates a new function where some of the arguments are specified.

                                                                                                                                  -
                                                                                                                                  Experimental

                                                                                                                                  Source Code

                                                                                                                                  Defined in src/core/lambda/index.js at line 15, column 0
                                                                                                                                  {
                                                                                                                                  -  identity: require('./identity'),
                                                                                                                                  -  constant: require('./constant'),
                                                                                                                                  -  curry: require('./curry'),
                                                                                                                                  -  compose: require('./compose'),
                                                                                                                                  -  partialise: require('./partialise')
                                                                                                                                  -}
                                                                                                                                  Stability
                                                                                                                                  experimental
                                                                                                                                  Licence
                                                                                                                                  MIT
                                                                                                                                  Module
                                                                                                                                  folktale/src/core/lambda
                                                                                                                                  Authors
                                                                                                                                  Authors
                                                                                                                                  • Quildreen Motta
                                                                                                                                  Maintainers
                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.identity.identity.html b/docs/api/en/folktale.src.core.lambda.identity.identity.html deleted file mode 100644 index ab4639e..0000000 --- a/docs/api/en/folktale.src.core.lambda.identity.identity.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - identity - - - - - -

                                                                                                                                    identity

                                                                                                                                    The identity combinator; always returns the argument given.

                                                                                                                                    -

                                                                                                                                    Signature

                                                                                                                                    identity(value)
                                                                                                                                    Type
                                                                                                                                    ('a) => 'a

                                                                                                                                    Documentation

                                                                                                                                    The identity combinator; always returns the argument given.

                                                                                                                                    -

                                                                                                                                    Example:

                                                                                                                                    -
                                                                                                                                    const identity = require('folktale/core/lambda/identity');
                                                                                                                                    -
                                                                                                                                    -identity(1);
                                                                                                                                    -// ==> 1
                                                                                                                                    -
                                                                                                                                    -[1, 2, 3].map(identity);
                                                                                                                                    -// ==> [1, 2, 3]
                                                                                                                                    -

                                                                                                                                    Why?

                                                                                                                                    -

                                                                                                                                    There aren't many reasons to use the identity combinator in real -JavaScript code. Readability is the only compelling one. Figuring -out the concept of identity from reading the word identity is -easier than working your way through its implementation.

                                                                                                                                    -

                                                                                                                                    Compare:

                                                                                                                                    -
                                                                                                                                    const identity = require('folktale/core/lambda/identity');
                                                                                                                                    -
                                                                                                                                    -either.bimap(identity, (counter) => counter + 1);
                                                                                                                                    -

                                                                                                                                    With:

                                                                                                                                    -
                                                                                                                                    either.bimap(
                                                                                                                                    -  (failure) => failure,
                                                                                                                                    -  (counter) => counter + 1
                                                                                                                                    -)
                                                                                                                                    -

                                                                                                                                    Properties

                                                                                                                                    (Uncategorised)

                                                                                                                                    Source Code

                                                                                                                                    Defined in src/core/lambda/identity.js at line 21, column 0
                                                                                                                                    (value) => value
                                                                                                                                    Stability
                                                                                                                                    stable
                                                                                                                                    Licence
                                                                                                                                    MIT
                                                                                                                                    Module
                                                                                                                                    folktale/src/core/lambda/identity
                                                                                                                                    Authors
                                                                                                                                    Authors
                                                                                                                                    • Quildreen Motta
                                                                                                                                    Maintainers
                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.partialise.hole.html b/docs/api/en/folktale.src.core.lambda.partialise.hole.html deleted file mode 100644 index ffc8940..0000000 --- a/docs/api/en/folktale.src.core.lambda.partialise.hole.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - hole - - - - - -

                                                                                                                                      hole

                                                                                                                                      Represents a place in an argument list that needs to be filled.

                                                                                                                                      -

                                                                                                                                      Documentation

                                                                                                                                      Represents a place in an argument list that needs to be filled.

                                                                                                                                      -

                                                                                                                                      Properties

                                                                                                                                      Source Code

                                                                                                                                      hole
                                                                                                                                      Stability
                                                                                                                                      experimental
                                                                                                                                      Since
                                                                                                                                      v2.0.0
                                                                                                                                      Licence
                                                                                                                                      MIT
                                                                                                                                      Module
                                                                                                                                      folktale/src/core/lambda/partialise
                                                                                                                                      On This Page
                                                                                                                                      Authors
                                                                                                                                      Authors
                                                                                                                                      • Quildreen Motta
                                                                                                                                      Maintainers
                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.lambda.partialise.partialise.html b/docs/api/en/folktale.src.core.lambda.partialise.partialise.html deleted file mode 100644 index a1ab56e..0000000 --- a/docs/api/en/folktale.src.core.lambda.partialise.partialise.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - partialise - - - - - -

                                                                                                                                        partialise

                                                                                                                                        Creates a new function where some of the arguments are specified.

                                                                                                                                        -

                                                                                                                                        Signature

                                                                                                                                        partialise(arity, fn)
                                                                                                                                        Type
                                                                                                                                        (Number, (Any... => Any)) => ((hole | Any)...) => Any :: (throw TypeError)

                                                                                                                                        Documentation

                                                                                                                                        Creates a new function where some of the arguments are specified.

                                                                                                                                        -

                                                                                                                                        Example:

                                                                                                                                        -
                                                                                                                                        const partialise = require('folktale/core/lambda/partialise');
                                                                                                                                        -
                                                                                                                                        -const clamp = (min, max, number) =>
                                                                                                                                        -  number < min ?  min
                                                                                                                                        -: number > max ?  max
                                                                                                                                        -:                 number;
                                                                                                                                        -
                                                                                                                                        -const _      = partialise.hole;
                                                                                                                                        -const clamp_ = partialise(3, clamp);
                                                                                                                                        -
                                                                                                                                        -const atLeast = clamp_(_, Infinity, _);
                                                                                                                                        -const atMost  = clamp_(-Infinity, _, _);
                                                                                                                                        -
                                                                                                                                        -atLeast(3, 2); // ==> 3
                                                                                                                                        -atLeast(3, 5); // ==> 5
                                                                                                                                        -
                                                                                                                                        -atMost(5, 3);  // ==> 3
                                                                                                                                        -atMost(5, 10); // ==> 5
                                                                                                                                        -

                                                                                                                                        Why Partialisation

                                                                                                                                        -

                                                                                                                                        With higher-order programming, one often wants to specialise some of -the arguments of a function before passing it to another function. -This kind of configuration is often done by creating a new function -manually:

                                                                                                                                        -
                                                                                                                                        const plus = (a, b) => a + b;
                                                                                                                                        -const add5 = (x) => plus(5, x);
                                                                                                                                        -
                                                                                                                                        -[1, 2, 3].map(add5);
                                                                                                                                        -// ==> [6, 7, 8]
                                                                                                                                        -

                                                                                                                                        And for most cases this is reasonable. For functions that take more -parameters, this can be cumbersome, however. The partialise function -allows creating a new function by specialising some of the arguments, -and filling the remaining ones when the function is called.

                                                                                                                                        -

                                                                                                                                        Places where the caller of the function should fill are specified as -hole, which is a special constant used by partialise:

                                                                                                                                        -
                                                                                                                                        const partialise = require('folktale/core/lambda/partialise');
                                                                                                                                        -
                                                                                                                                        -const _ = partialise.hole;
                                                                                                                                        -const partialAdd5 = partialise(2, plus)(5, _);
                                                                                                                                        -[1, 2, 3].map(partialAdd5);
                                                                                                                                        -// ==> [6, 7, 8]
                                                                                                                                        -

                                                                                                                                        Relation to Currying

                                                                                                                                        -

                                                                                                                                        Partial application and currying are related concepts. Currying -refers to transforming a function of arity N, into N functions of -arity 1. Partial application, on the other hand, refers to -fixing some (but not all) arguments of a function.

                                                                                                                                        -

                                                                                                                                        Both concepts are used to improve function composition, where the -shape of the function you have does not reflect the shape of the -function expected by function you're calling. So, in essence, these -techniques transform the shape of your function to make them "fit" -some API.

                                                                                                                                        -

                                                                                                                                        partialise and curry differ on how they achieve this, however. -While curry creates N functions, and lets you specify arguments -one by one, partialise requires you to specify all arguments at -once, distinguishing which ones are fixed, and which ones have to -be provided (using "holes").

                                                                                                                                        -

                                                                                                                                        Because of this, curry can be more natural, but it requires that -the APIs be designed thinking about currying before hand, and it -often interacts poorly with JavaScript, due to the use of variadic -functions. partialise does not have such problems.

                                                                                                                                        -

                                                                                                                                        How partialise Works?

                                                                                                                                        -

                                                                                                                                        The partialise function transforms regular functions into -functions that can accept holes for arguments that are not -defined yet. Whenever a partial function receives a hole as -an argument, it constructs a new function so the holes can -be filled later:

                                                                                                                                        -
                                                                                                                                        const partialise = require('folktale/core/lambda/partialise');
                                                                                                                                        -
                                                                                                                                        -const clamp = (min, max, number) =>
                                                                                                                                        -  number < min ?  min
                                                                                                                                        -: number > max ?  max
                                                                                                                                        -:                 number
                                                                                                                                        -
                                                                                                                                        -const partialClamp = partialise(3, clamp);
                                                                                                                                        -

                                                                                                                                        In the example above, partialClamp is a function that takes -arguments that may or may not be holes. A hole is a special -constant defined by partialise itself. It's convenient to -bind such constant to the _ binding:

                                                                                                                                        -
                                                                                                                                        const _ = partialise.hole;
                                                                                                                                        -

                                                                                                                                        A partial function is considered saturated when, among the -arguments provided to it, no hole exists. When a partial function -is saturated, its original behaviour is executed:

                                                                                                                                        -
                                                                                                                                        partialClamp(3, 5, 6);  // ==> 5
                                                                                                                                        -

                                                                                                                                        If a partial function is not saturated, then it its execution -results in a new partial function:

                                                                                                                                        -
                                                                                                                                        const atLeast = partialClamp(_, Infinity, _);
                                                                                                                                        -atLeast(5, 3); // ==> 5
                                                                                                                                        -
                                                                                                                                        -const atLeast5 = atLeast(5, _);
                                                                                                                                        -atLeast5(3); // ==> 5
                                                                                                                                        -

                                                                                                                                        Note that to prevent confusing behaviour, Folktale's partialise -forces you to always pass the exact number of arguments that the -partial function expects. Passing more or less arguments to a -partial function is a TypeError. This ensures that all new partial -functions can properly invoke the original behaviour when saturated, -rather than returning previous unsaturated functions.

                                                                                                                                        -

                                                                                                                                        Drawbacks of Using partialise

                                                                                                                                        -

                                                                                                                                        partialise is a convenience function for transforming the shape -of functions, and it relies on variadic application, as well as -doing a fair bit of processing before each call to determine -saturation. Combined, these make partialise a poor choice for -any code that needs to be performant.

                                                                                                                                        -

                                                                                                                                        Properties

                                                                                                                                        Special Values

                                                                                                                                        hole

                                                                                                                                        Represents a place in an argument list that needs to be filled.

                                                                                                                                        -
                                                                                                                                        Experimental

                                                                                                                                        (Uncategorised)

                                                                                                                                        Experimental

                                                                                                                                        Source Code

                                                                                                                                        Defined in src/core/lambda/partialise.js at line 24, column 0
                                                                                                                                        (arity, fn) => (...args) => { 
                                                                                                                                        -  /* eslint-disable no-magic-numbers */
                                                                                                                                        -  if (args.length < arity) {
                                                                                                                                        -    throw new TypeError(`The partial function takes at least ${arity} arguments, but was given ${args.length}.`);
                                                                                                                                        -  }
                                                                                                                                        -
                                                                                                                                        -  // Figure out if we have holes
                                                                                                                                        -  let holes = 0;
                                                                                                                                        -  for (let i = 0; i < args.length; ++i) {
                                                                                                                                        -    if (args[i] === hole) {
                                                                                                                                        -      holes += 1;
                                                                                                                                        -    }
                                                                                                                                        -  }
                                                                                                                                        -
                                                                                                                                        -
                                                                                                                                        -  if (holes > 0) {
                                                                                                                                        -    return partialise(holes, (...newArgs) => {
                                                                                                                                        -      let realArgs = [];
                                                                                                                                        -      let argIndex = 0;
                                                                                                                                        -
                                                                                                                                        -      for (let i = 0; i < args.length; ++i) {
                                                                                                                                        -        const arg = args[i];
                                                                                                                                        -        if (arg === hole) {
                                                                                                                                        -          realArgs.push(newArgs[argIndex]);
                                                                                                                                        -          argIndex += 1;
                                                                                                                                        -        } else {
                                                                                                                                        -          realArgs.push(arg);
                                                                                                                                        -        }
                                                                                                                                        -      }
                                                                                                                                        -
                                                                                                                                        -      return fn(...realArgs);
                                                                                                                                        -    });
                                                                                                                                        -  } else {
                                                                                                                                        -    return fn(...args);
                                                                                                                                        -  }
                                                                                                                                        -}
                                                                                                                                        Stability
                                                                                                                                        experimental
                                                                                                                                        Since
                                                                                                                                        v2.0.0
                                                                                                                                        Licence
                                                                                                                                        MIT
                                                                                                                                        Module
                                                                                                                                        folktale/src/core/lambda/partialise
                                                                                                                                        Authors
                                                                                                                                        Authors
                                                                                                                                        • Quildreen Motta
                                                                                                                                        Maintainers
                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.from-pairs.fromPairs.html b/docs/api/en/folktale.src.core.object.from-pairs.fromPairs.html deleted file mode 100644 index 7901dfe..0000000 --- a/docs/api/en/folktale.src.core.object.from-pairs.fromPairs.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - fromPairs - - - - - -

                                                                                                                                          fromPairs

                                                                                                                                          Constructs an object from an array of (key, value) pairs.

                                                                                                                                          -

                                                                                                                                          Signature

                                                                                                                                          fromPairs(pairs)
                                                                                                                                          Type
                                                                                                                                          (Array (String or Symbol, 'a)) => Object 'a

                                                                                                                                          Documentation

                                                                                                                                          Constructs an object from an array of (key, value) pairs.

                                                                                                                                          -

                                                                                                                                          The resulting object is a plain JavaScript object, inheriting from -Object.prototype.

                                                                                                                                          -

                                                                                                                                          The pairs are added to the object with Object.defineProperty, so no setters -defined in Object.prototype will be triggered during the process. All -properties are enumerable, writable, and configurable.

                                                                                                                                          -

                                                                                                                                          Example:

                                                                                                                                          -
                                                                                                                                          const fromPairs = require('folktale/core/object/from-pairs');
                                                                                                                                          -
                                                                                                                                          -fromPairs([['x', 10], ['y', 20]]);
                                                                                                                                          -// ==> { x: 10, y: 20 }
                                                                                                                                          -

                                                                                                                                          Caveats

                                                                                                                                          -

                                                                                                                                          Properties are inserted in the object in the same order of the array. In an -ECMAScript 2015-compliant engine this means that the following equivalence -holds:

                                                                                                                                          -
                                                                                                                                          const fromPairs = require('folktale/core/object/from-pairs');
                                                                                                                                          -
                                                                                                                                          -Object.keys(fromPairs(xs)) === xs.map(([k, v]) => k)
                                                                                                                                          -

                                                                                                                                          However, in engines that don't conform to ECMAScript 2015, this equivalence -is not guaranteed.

                                                                                                                                          -

                                                                                                                                          Properties

                                                                                                                                          (Uncategorised)

                                                                                                                                          Source Code

                                                                                                                                          Defined in src/core/object/from-pairs.js at line 25, column 0
                                                                                                                                          (pairs) =>
                                                                                                                                          -        pairs.reduce((r, [k, v]) => define(r, k, { value: v,
                                                                                                                                          -                                                   writable: true,
                                                                                                                                          -                                                   enumerable: true,
                                                                                                                                          -                                                   configurable: true
                                                                                                                                          -                                                  }),
                                                                                                                                          -                     {})
                                                                                                                                          Stability
                                                                                                                                          stable
                                                                                                                                          Licence
                                                                                                                                          MIT
                                                                                                                                          Module
                                                                                                                                          folktale/src/core/object/from-pairs
                                                                                                                                          Authors
                                                                                                                                          Authors
                                                                                                                                          • Quildreen Motta
                                                                                                                                          Maintainers
                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.html b/docs/api/en/folktale.src.core.object.html deleted file mode 100644 index b077d52..0000000 --- a/docs/api/en/folktale.src.core.object.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - module folktale/core/object - - - - - -

                                                                                                                                            module folktale/core/object

                                                                                                                                            Core.Object provides utilities for working with objects as -dictionaries and records.

                                                                                                                                            -

                                                                                                                                            Documentation

                                                                                                                                            Core.Object provides utilities for working with objects as -dictionaries and records.

                                                                                                                                            -

                                                                                                                                            Why?

                                                                                                                                            -

                                                                                                                                            JS historically lacked data structures designed specifically for -representing records and dictionaries, and objects just doubled -as those for the common use cases. While JS has added Map and -Set structures natively, using objects as records and dictionaries -is still common place, and there aren't many tools to use them -for those use cases natively.

                                                                                                                                            -

                                                                                                                                            For example, these objects are used as options for configuring -operations, like babylon's parse operation, or Node's readFile. -They're used to represent headers in most HTTP libraries, or to -represent environment variables in Node, etc.

                                                                                                                                            -

                                                                                                                                            Folktale's Core.Object primarily aims to provide common tools for -using objects as dictionaries. In doing so, most of the operations -in this module are only concerned about own, enumerable properties, -and don't respect the original object's shape. That is, a -transformation such as:

                                                                                                                                            -
                                                                                                                                            toPairs(fromPairs(object))
                                                                                                                                            -

                                                                                                                                            Doesn't return a value necessarily equivalent to object. Because -all transformations are pure, objects get a new identity, they also -lose all symbols and non-enumerable properties, as well as the -[[Prototype]] field.

                                                                                                                                            -

                                                                                                                                            What's in Core.Object?

                                                                                                                                            -

                                                                                                                                            Currently Core.Object provides operations for converting from and to -objects, and transforming objects. These operations are categorised -as follows:

                                                                                                                                            -
                                                                                                                                              -
                                                                                                                                            • Converting: Operations that convert the data in the object -to other types.

                                                                                                                                              -
                                                                                                                                            • -
                                                                                                                                            • Transforming: Operations that transform the data in the -object, giving you a new object.

                                                                                                                                              -
                                                                                                                                            • -
                                                                                                                                            -

                                                                                                                                            Properties

                                                                                                                                            Combining

                                                                                                                                            toPairs(object)

                                                                                                                                            Returns pairs of (key, value) for all own enumerable properties in an object.

                                                                                                                                            -

                                                                                                                                            Converting

                                                                                                                                            fromPairs(pairs)

                                                                                                                                            Constructs an object from an array of (key, value) pairs.

                                                                                                                                            -
                                                                                                                                            values(object)

                                                                                                                                            Returns the values for all own enumerable properties in an object.

                                                                                                                                            -

                                                                                                                                            Transforming

                                                                                                                                            mapEntries(object, transform, define)

                                                                                                                                            Transforms own properties of an object using a mapping function.

                                                                                                                                            -
                                                                                                                                            mapValues(object, transformation)

                                                                                                                                            Transforms values of an object with an unary function.

                                                                                                                                            -

                                                                                                                                            Source Code

                                                                                                                                            Defined in src/core/object/index.js at line 15, column 0
                                                                                                                                            {
                                                                                                                                            -  mapEntries: require('./map-entries'),
                                                                                                                                            -  mapValues: require('./map-values'),
                                                                                                                                            -  values: require('./values'),
                                                                                                                                            -  toPairs: require('./to-pairs'),
                                                                                                                                            -  fromPairs: require('./from-pairs')
                                                                                                                                            -}
                                                                                                                                            Stability
                                                                                                                                            experimental
                                                                                                                                            Licence
                                                                                                                                            MIT
                                                                                                                                            Module
                                                                                                                                            folktale/src/core/object
                                                                                                                                            Authors
                                                                                                                                            Authors
                                                                                                                                            • Quildreen Motta
                                                                                                                                            Maintainers
                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.map-entries.mapEntries.html b/docs/api/en/folktale.src.core.object.map-entries.mapEntries.html deleted file mode 100644 index 05bfc75..0000000 --- a/docs/api/en/folktale.src.core.object.map-entries.mapEntries.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - mapEntries - - - - - -

                                                                                                                                              mapEntries

                                                                                                                                              Transforms own properties of an object using a mapping function.

                                                                                                                                              -

                                                                                                                                              Signature

                                                                                                                                              mapEntries(object, transform, define)
                                                                                                                                              Type
                                                                                                                                              (
                                                                                                                                              -  object    : Object 'a,
                                                                                                                                              -  transform : ((String, 'a)) => (String, 'b),
                                                                                                                                              -  define    : (('x : Object 'b), String, 'b) => Object 'b :: mutates 'x
                                                                                                                                              -) => Object 'b

                                                                                                                                              Documentation

                                                                                                                                              Transforms own properties of an object using a mapping function.

                                                                                                                                              -

                                                                                                                                              The transformation takes a [key, value] pair, and is expected to return -a new [key, value] pair. The resulting object has not only its values -transformed, but also its keys.

                                                                                                                                              -

                                                                                                                                              Example:

                                                                                                                                              -
                                                                                                                                              const mapEntries = require('folktale/core/object/map-entries');
                                                                                                                                              -
                                                                                                                                              -const pair = { x: 10, y: 20 };
                                                                                                                                              -mapEntries(
                                                                                                                                              -  pair,
                                                                                                                                              -  ([key, value]) => [key.toUpperCase(), value * 2],
                                                                                                                                              -  (result, key, value) => {
                                                                                                                                              -    result[key] = value;
                                                                                                                                              -    return result;
                                                                                                                                              -  }
                                                                                                                                              -);
                                                                                                                                              -// ==> { X: 20, Y: 40 }
                                                                                                                                              -

                                                                                                                                              Handling collisions

                                                                                                                                              -

                                                                                                                                              Since the mapping function returns a [key, value] pair, it's possible -that some of the returned keys collide with another. Since there's no -single answer that is correct for all cases when handling these collisions, -mapEntries expects an additional function that's used to define the -properties in the resulting object, and this function is expected to -deal with the collisions.

                                                                                                                                              -

                                                                                                                                              A definition function takes the result object, a property name, and -a value, and is expected to return a new object containing the provided -key/value pair, if it can be attached to the result object. This function -may mutate the object, but pure functions are also supported.

                                                                                                                                              -

                                                                                                                                              Specialised forms of this function exist to cover common cases. -mapEntries.overwrite will have later key/value pairs overwrite earlier -ones with the same key, while mapEntries.unique will throw whenever -a collision happens.

                                                                                                                                              -

                                                                                                                                              Caveats

                                                                                                                                              -

                                                                                                                                              mapEntries will not preserve the shape of the original object. -It treats objects as plain maps from String to some value. It ignores -things like prototypical delegation, symbols, and non-enumerable -properties.

                                                                                                                                              -

                                                                                                                                              Properties

                                                                                                                                              Transforming

                                                                                                                                              overwrite(object, transform)

                                                                                                                                              Transforms own properties of an object using a mapping function.

                                                                                                                                              -
                                                                                                                                              unique(object, transform)

                                                                                                                                              Transforms own properties of an object using a mapping function.

                                                                                                                                              -

                                                                                                                                              (Uncategorised)

                                                                                                                                              Source Code

                                                                                                                                              Defined in src/core/object/map-entries.js at line 27, column 0
                                                                                                                                              (object, transform, define) =>
                                                                                                                                              -        Object.keys(object).reduce((result, key) => {
                                                                                                                                              -          const [newKey, newValue] = transform([key, object[key]]);
                                                                                                                                              -          return define(result, newKey, newValue);
                                                                                                                                              -        }, {})
                                                                                                                                              Stability
                                                                                                                                              stable
                                                                                                                                              Licence
                                                                                                                                              MIT
                                                                                                                                              Module
                                                                                                                                              folktale/src/core/object/map-entries
                                                                                                                                              Authors
                                                                                                                                              Authors
                                                                                                                                              • Quildreen Motta
                                                                                                                                              Maintainers
                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.map-entries.overwrite.html b/docs/api/en/folktale.src.core.object.map-entries.overwrite.html deleted file mode 100644 index 2f0c556..0000000 --- a/docs/api/en/folktale.src.core.object.map-entries.overwrite.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - overwrite - - - - - -

                                                                                                                                                overwrite

                                                                                                                                                Transforms own properties of an object using a mapping function.

                                                                                                                                                -

                                                                                                                                                Signature

                                                                                                                                                overwrite(object, transform)
                                                                                                                                                Type
                                                                                                                                                (Object 'a, ((String, 'a)) => (String, 'b)) => Object 'b

                                                                                                                                                Documentation

                                                                                                                                                Transforms own properties of an object using a mapping function.

                                                                                                                                                -

                                                                                                                                                This function is a specialised form of mapEntries that overwrites -duplicated keys when a collision happens.

                                                                                                                                                -

                                                                                                                                                Caveats

                                                                                                                                                -

                                                                                                                                                Because this function takes an object and maps over it, the result of a -transformation where keys collide is not defined in ECMAScript 5 and older, -as those engines don't define an ordering for key/value pairs in objects. -In ECMAScript 2015 properties that were inserted later will win over -properties that were inserted earlier.

                                                                                                                                                -

                                                                                                                                                Properties

                                                                                                                                                (Uncategorised)

                                                                                                                                                Source Code

                                                                                                                                                (object, transform) =>
                                                                                                                                                -  mapEntries(object, transform, (result, key, value) => {
                                                                                                                                                -    result[key] = value;
                                                                                                                                                -    return result;
                                                                                                                                                -  })
                                                                                                                                                Stability
                                                                                                                                                stable
                                                                                                                                                Licence
                                                                                                                                                MIT
                                                                                                                                                Module
                                                                                                                                                folktale/src/core/object/map-entries
                                                                                                                                                Authors
                                                                                                                                                Authors
                                                                                                                                                • Quildreen Motta
                                                                                                                                                Maintainers
                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.map-entries.unique.html b/docs/api/en/folktale.src.core.object.map-entries.unique.html deleted file mode 100644 index bfeeef0..0000000 --- a/docs/api/en/folktale.src.core.object.map-entries.unique.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - unique - - - - - -

                                                                                                                                                  unique

                                                                                                                                                  Transforms own properties of an object using a mapping function.

                                                                                                                                                  -

                                                                                                                                                  Signature

                                                                                                                                                  unique(object, transform)
                                                                                                                                                  Type
                                                                                                                                                  (Object 'a, ((String, 'a)) => (String, 'b)) => Object 'b :: throws Error

                                                                                                                                                  Documentation

                                                                                                                                                  Transforms own properties of an object using a mapping function.

                                                                                                                                                  -

                                                                                                                                                  This function is a specialised form of mapEntries that throws -when a key collision happens. Throwing makes this function potentially -unsafe to use, however it guarantees a consistent behaviour across -different ECMAScript versions and VMs.

                                                                                                                                                  -

                                                                                                                                                  Properties

                                                                                                                                                  (Uncategorised)

                                                                                                                                                  Source Code

                                                                                                                                                  (object, transform) =>
                                                                                                                                                  -  mapEntries(object, transform, (result, key, value) => {
                                                                                                                                                  -    if (result::hasOwnProperty(key)) {
                                                                                                                                                  -      throw new Error(`The property ${key} already exists in the resulting object.`);
                                                                                                                                                  -    }
                                                                                                                                                  -    result[key] = value;
                                                                                                                                                  -    return result;
                                                                                                                                                  -  })
                                                                                                                                                  Stability
                                                                                                                                                  stable
                                                                                                                                                  Licence
                                                                                                                                                  MIT
                                                                                                                                                  Module
                                                                                                                                                  folktale/src/core/object/map-entries
                                                                                                                                                  Authors
                                                                                                                                                  Authors
                                                                                                                                                  • Quildreen Motta
                                                                                                                                                  Maintainers
                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.map-values.infix.html b/docs/api/en/folktale.src.core.object.map-values.infix.html deleted file mode 100644 index f84190a..0000000 --- a/docs/api/en/folktale.src.core.object.map-values.infix.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - infix - - - - - -

                                                                                                                                                    infix

                                                                                                                                                    Conveniently transforms values in an object using the This-Binding syntax.

                                                                                                                                                    -

                                                                                                                                                    Signature

                                                                                                                                                    infix(transformation)
                                                                                                                                                    Type
                                                                                                                                                    (Object 'a) . (('a) => 'b) => Object 'b

                                                                                                                                                    Documentation

                                                                                                                                                    Conveniently transforms values in an object using the This-Binding syntax.

                                                                                                                                                    -

                                                                                                                                                    This is a free-method version of mapValues that applies the this -argument first, then the function it takes as argument. It's meant to -be used with the This-Binding Syntax proposal:

                                                                                                                                                    -
                                                                                                                                                    const map = require('folktale/core/object/map-values').infix;
                                                                                                                                                    -
                                                                                                                                                    -const pair = { x: 10, y: 20 };
                                                                                                                                                    -pair::map(x => x * 2);
                                                                                                                                                    -// ==> { x: 20, y: 40 }
                                                                                                                                                    -

                                                                                                                                                    Properties

                                                                                                                                                    (Uncategorised)

                                                                                                                                                    Experimental

                                                                                                                                                    Source Code

                                                                                                                                                    function(transformation) {
                                                                                                                                                    -  return mapValues(this, transformation);
                                                                                                                                                    -}
                                                                                                                                                    Stability
                                                                                                                                                    experimental
                                                                                                                                                    Licence
                                                                                                                                                    MIT
                                                                                                                                                    Module
                                                                                                                                                    folktale/src/core/object/map-values
                                                                                                                                                    Authors
                                                                                                                                                    Authors
                                                                                                                                                    • Quildreen Motta
                                                                                                                                                    Maintainers
                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.map-values.mapValues.html b/docs/api/en/folktale.src.core.object.map-values.mapValues.html deleted file mode 100644 index b80e1ab..0000000 --- a/docs/api/en/folktale.src.core.object.map-values.mapValues.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - mapValues - - - - - -

                                                                                                                                                      mapValues

                                                                                                                                                      Transforms values of an object with an unary function.

                                                                                                                                                      -

                                                                                                                                                      Signature

                                                                                                                                                      mapValues(object, transformation)
                                                                                                                                                      Type
                                                                                                                                                      (Object 'a, ('a) => 'b) => Object 'b

                                                                                                                                                      Documentation

                                                                                                                                                      Transforms values of an object with an unary function.

                                                                                                                                                      -

                                                                                                                                                      The transformation works on the values of each own, enumerable -property of the given object. Inherited and non-enumerable -properties are ignored by this function.

                                                                                                                                                      -

                                                                                                                                                      Example:

                                                                                                                                                      -
                                                                                                                                                      const mapValues = require('folktale/core/object/map-values');
                                                                                                                                                      -
                                                                                                                                                      -const pair = { x: 10, y: 20 };
                                                                                                                                                      -mapValues(pair, x => x * 2);
                                                                                                                                                      -// ==> { x: 20, y: 40 }
                                                                                                                                                      -

                                                                                                                                                      Caveats

                                                                                                                                                      -

                                                                                                                                                      mapValues will not preserve the shape of the original object. -It treats objects as plain maps from String to some value, and -ignores things like prototypical delegation, symbols, and non-enumerable -properties.

                                                                                                                                                      -

                                                                                                                                                      Properties

                                                                                                                                                      Convenience

                                                                                                                                                      infix(transformation)

                                                                                                                                                      Conveniently transforms values in an object using the This-Binding syntax.

                                                                                                                                                      -
                                                                                                                                                      Experimental

                                                                                                                                                      (Uncategorised)

                                                                                                                                                      Experimental

                                                                                                                                                      Source Code

                                                                                                                                                      Defined in src/core/object/map-values.js at line 21, column 0
                                                                                                                                                      (object, transformation) => {
                                                                                                                                                      -  const keys = Object.keys(object);
                                                                                                                                                      -  const result = {};
                                                                                                                                                      -
                                                                                                                                                      -  for (let i = 0; i < keys.length; ++i) {
                                                                                                                                                      -    const key = keys[i];
                                                                                                                                                      -    result[key] = transformation(object[key]);
                                                                                                                                                      -  }
                                                                                                                                                      -
                                                                                                                                                      -  return result;
                                                                                                                                                      -}
                                                                                                                                                      Stability
                                                                                                                                                      stable
                                                                                                                                                      Licence
                                                                                                                                                      MIT
                                                                                                                                                      Module
                                                                                                                                                      folktale/src/core/object/map-values
                                                                                                                                                      Authors
                                                                                                                                                      Authors
                                                                                                                                                      • Quildreen Motta
                                                                                                                                                      Maintainers
                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.to-pairs.toPairs.html b/docs/api/en/folktale.src.core.object.to-pairs.toPairs.html deleted file mode 100644 index 35abb46..0000000 --- a/docs/api/en/folktale.src.core.object.to-pairs.toPairs.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - toPairs - - - - - -

                                                                                                                                                        toPairs

                                                                                                                                                        Returns pairs of (key, value) for all own enumerable properties in an object.

                                                                                                                                                        -

                                                                                                                                                        Signature

                                                                                                                                                        toPairs(object)
                                                                                                                                                        Type
                                                                                                                                                        (Object 'a) => Array (String or Symbol, 'a)

                                                                                                                                                        Documentation

                                                                                                                                                        Returns pairs of (key, value) for all own enumerable properties in an object.

                                                                                                                                                        -

                                                                                                                                                        Example:

                                                                                                                                                        -
                                                                                                                                                        const toPairs = require('folktale/core/object/to-pairs');
                                                                                                                                                        -
                                                                                                                                                        -const pair = { x: 10, y: 20 };
                                                                                                                                                        -toPairs(pair);
                                                                                                                                                        -// ==> [['x', 10], ['y', 20]]
                                                                                                                                                        -// (in ES5- VMs this may be [['y', 20], ['x', 10]])
                                                                                                                                                        -

                                                                                                                                                        Why?

                                                                                                                                                        -

                                                                                                                                                        Objects in JavaScript are commonly used as dictionaries, but natively -there are no operations to work with them in that way. This function -allows one to extract the (key, value) pairs from an object:

                                                                                                                                                        -
                                                                                                                                                        const toPairs = require('folktale/core/object/to-pairs');
                                                                                                                                                        -
                                                                                                                                                        -const pair = { x: 10, y: 20 };
                                                                                                                                                        -toPairs(pair);
                                                                                                                                                        -// ==> [['x', 10], ['y', 20]]
                                                                                                                                                        -// or  [['y', 20], ['x', 10]]
                                                                                                                                                        -

                                                                                                                                                        Inherited properties, and those that are not marked as enumerable, are -not returned in the resulting array:

                                                                                                                                                        -
                                                                                                                                                        const p1 = { z: 2 };
                                                                                                                                                        -const pair2 = Object.create(p1);
                                                                                                                                                        -pair2.x = 10; pair2.y = 20;
                                                                                                                                                        -
                                                                                                                                                        -toPairs(pair2);
                                                                                                                                                        -// ==> [['x', 10], ['y', 20]]
                                                                                                                                                        -// or  [['y', 20], ['x', 10]]
                                                                                                                                                        -
                                                                                                                                                        -// non-enumerable property x
                                                                                                                                                        -Object.defineProperty(p1, 'x', { value: 1 });
                                                                                                                                                        -
                                                                                                                                                        -toPairs(p1);
                                                                                                                                                        -// ==> [['z', 2]]
                                                                                                                                                        -

                                                                                                                                                        Caveats

                                                                                                                                                        -

                                                                                                                                                        While ECMAScript 2015 specifies that objects are ordered using -insertion order, you're not guaranteed to get that behaviour in -any non-ES2015 engine, so for all effects it's better to treat -the result of this operation as an unordered collection.

                                                                                                                                                        -

                                                                                                                                                        Properties

                                                                                                                                                        (Uncategorised)

                                                                                                                                                        Source Code

                                                                                                                                                        Defined in src/core/object/to-pairs.js at line 22, column 0
                                                                                                                                                        (object) => Object.keys(object).map(k => [k, object[k]])
                                                                                                                                                        Stability
                                                                                                                                                        stable
                                                                                                                                                        Licence
                                                                                                                                                        MIT
                                                                                                                                                        Module
                                                                                                                                                        folktale/src/core/object/to-pairs
                                                                                                                                                        Authors
                                                                                                                                                        Authors
                                                                                                                                                        • Quildreen Motta
                                                                                                                                                        Maintainers
                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.core.object.values.values.html b/docs/api/en/folktale.src.core.object.values.values.html deleted file mode 100644 index 9d38914..0000000 --- a/docs/api/en/folktale.src.core.object.values.values.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - values - - - - - -

                                                                                                                                                          values

                                                                                                                                                          Returns the values for all own enumerable properties in an object.

                                                                                                                                                          -

                                                                                                                                                          Signature

                                                                                                                                                          values(object)
                                                                                                                                                          Type
                                                                                                                                                          (Object 'a) => Array 'a

                                                                                                                                                          Documentation

                                                                                                                                                          Returns the values for all own enumerable properties in an object.

                                                                                                                                                          -

                                                                                                                                                          Example:

                                                                                                                                                          -
                                                                                                                                                          const values = require('folktale/core/object/values');
                                                                                                                                                          -
                                                                                                                                                          -const pair = { x: 10, y: 20 };
                                                                                                                                                          -values(pair);
                                                                                                                                                          -// ==> [10, 20] 
                                                                                                                                                          -// (In ES5- VMs this may be [20, 10])
                                                                                                                                                          -

                                                                                                                                                          Why?

                                                                                                                                                          -

                                                                                                                                                          Objects in JavaScript are commonly used as dictionaries, but natively -there are no operations to work with them in that way. This function -allows one to extract the values from an object:

                                                                                                                                                          -
                                                                                                                                                          const values = require('folktale/core/object/values');
                                                                                                                                                          -
                                                                                                                                                          -const pair = { x: 10, y: 20 };
                                                                                                                                                          -values(pair);
                                                                                                                                                          -// ==> [10, 20]  
                                                                                                                                                          -// or  [20, 10]
                                                                                                                                                          -

                                                                                                                                                          Inherited properties, and those that are not marked as enumerable, are -not returned in the resulting array:

                                                                                                                                                          -
                                                                                                                                                          const p1 = { z: 2 };
                                                                                                                                                          -const pair2 = Object.create(p1);
                                                                                                                                                          -pair2.x = 10; pair2.y = 20;
                                                                                                                                                          -
                                                                                                                                                          -values(pair2);
                                                                                                                                                          -// ==> [10, 20] 
                                                                                                                                                          -// or  [20, 10]
                                                                                                                                                          -
                                                                                                                                                          -// non-enumerable property x
                                                                                                                                                          -Object.defineProperty(p1, 'x', { value: 1 });
                                                                                                                                                          -
                                                                                                                                                          -values(p1);
                                                                                                                                                          -// ==> [2]
                                                                                                                                                          -

                                                                                                                                                          Caveats

                                                                                                                                                          -

                                                                                                                                                          While ECMAScript 2015 specifies that objects are ordered using -insertion order, you're not guaranteed to get that behaviour in -any non-ES2015 engine, so for all effects it's better to treat -the result of this operation as an unordered collection.

                                                                                                                                                          -

                                                                                                                                                          Properties

                                                                                                                                                          (Uncategorised)

                                                                                                                                                          Source Code

                                                                                                                                                          Defined in src/core/object/values.js at line 21, column 0
                                                                                                                                                          (object) => Object.keys(object).map(k => object[k])
                                                                                                                                                          Stability
                                                                                                                                                          stable
                                                                                                                                                          Licence
                                                                                                                                                          MIT
                                                                                                                                                          Module
                                                                                                                                                          folktale/src/core/object/values
                                                                                                                                                          Authors
                                                                                                                                                          Authors
                                                                                                                                                          • Quildreen Motta
                                                                                                                                                          Maintainers
                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.either-to-maybe.eitherToMaybe.html b/docs/api/en/folktale.src.data.conversions.either-to-maybe.eitherToMaybe.html deleted file mode 100644 index 2fcac51..0000000 --- a/docs/api/en/folktale.src.data.conversions.either-to-maybe.eitherToMaybe.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - eitherToMaybe - - - - - -

                                                                                                                                                            eitherToMaybe

                                                                                                                                                            Converts an Either structure to a Maybe structure. Lefts map to Nothings, -Rights map to Justs.

                                                                                                                                                            -

                                                                                                                                                            Signature

                                                                                                                                                            eitherToMaybe(anEither)
                                                                                                                                                            Type
                                                                                                                                                            forall a, b:
                                                                                                                                                            -  (Either a b) => Maybe b

                                                                                                                                                            Documentation

                                                                                                                                                            Converts an Either structure to a Maybe structure. Lefts map to Nothings, -Rights map to Justs.

                                                                                                                                                            -

                                                                                                                                                            Not that Left values are lost in the conversion process, since failures -in Maybe (the Nothing tag) don't have a value.

                                                                                                                                                            -

                                                                                                                                                            Example:

                                                                                                                                                            -
                                                                                                                                                            const eitherToMaybe = require('folktale/data/conversions/either-to-maybe');
                                                                                                                                                            -const { Left, Right } = require('folktale/data/either');
                                                                                                                                                            -const { Just, Nothing } = require('folktale/data/maybe');
                                                                                                                                                            -
                                                                                                                                                            -eitherToMaybe(Left(1));  // ==> Nothing()
                                                                                                                                                            -eitherToMaybe(Right(1)); // ==> Just(1) 
                                                                                                                                                            -

                                                                                                                                                            Properties

                                                                                                                                                            (Uncategorised)

                                                                                                                                                            A Number.

                                                                                                                                                            -
                                                                                                                                                            Experimental
                                                                                                                                                            Experimental

                                                                                                                                                            Source Code

                                                                                                                                                            Defined in src/data/conversions/either-to-maybe.js at line 27, column 0
                                                                                                                                                            (anEither) =>
                                                                                                                                                            -  anEither.matchWith({
                                                                                                                                                            -    Left:  () => Nothing(),
                                                                                                                                                            -    Right: ({ value }) => Just(value)
                                                                                                                                                            -  })
                                                                                                                                                            Stability
                                                                                                                                                            experimental
                                                                                                                                                            Licence
                                                                                                                                                            MIT
                                                                                                                                                            Module
                                                                                                                                                            folktale/src/data/conversions/either-to-maybe
                                                                                                                                                            Authors
                                                                                                                                                            Authors
                                                                                                                                                            • @boris-marinov
                                                                                                                                                            Maintainers
                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.either-to-validation.eitherToValidation.html b/docs/api/en/folktale.src.data.conversions.either-to-validation.eitherToValidation.html deleted file mode 100644 index 71b29a7..0000000 --- a/docs/api/en/folktale.src.data.conversions.either-to-validation.eitherToValidation.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - eitherToValidation - - - - - -

                                                                                                                                                              eitherToValidation

                                                                                                                                                              Converts an Either to a Validation. Lefts map to Failures, Rights map -to Successes.

                                                                                                                                                              -

                                                                                                                                                              Signature

                                                                                                                                                              eitherToValidation(anEither)
                                                                                                                                                              Type
                                                                                                                                                              forall a, b:
                                                                                                                                                              -  (Either a b) => Validation a b

                                                                                                                                                              Documentation

                                                                                                                                                              Converts an Either to a Validation. Lefts map to Failures, Rights map -to Successes.

                                                                                                                                                              -

                                                                                                                                                              Example:

                                                                                                                                                              -
                                                                                                                                                              const eitherToValidation = require('folktale/data/conversions/either-to-validation');
                                                                                                                                                              -const { Left, Right } = require('folktale/data/either');
                                                                                                                                                              -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                              -
                                                                                                                                                              -eitherToValidation(Left(1));  // ==> Failure(1)
                                                                                                                                                              -eitherToValidation(Right(1)); // ==> Success(1)
                                                                                                                                                              -

                                                                                                                                                              Properties

                                                                                                                                                              (Uncategorised)

                                                                                                                                                              A Number.

                                                                                                                                                              -
                                                                                                                                                              Experimental
                                                                                                                                                              Experimental

                                                                                                                                                              Source Code

                                                                                                                                                              Defined in src/data/conversions/either-to-validation.js at line 27, column 0
                                                                                                                                                              (anEither) =>
                                                                                                                                                              -  anEither.matchWith({
                                                                                                                                                              -    Left:  ({ value }) => Failure(value),
                                                                                                                                                              -    Right: ({ value }) => Success(value)
                                                                                                                                                              -  })
                                                                                                                                                              Stability
                                                                                                                                                              experimental
                                                                                                                                                              Licence
                                                                                                                                                              MIT
                                                                                                                                                              Module
                                                                                                                                                              folktale/src/data/conversions/either-to-validation
                                                                                                                                                              Authors
                                                                                                                                                              Authors
                                                                                                                                                              • @boris-marinov
                                                                                                                                                              Maintainers
                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.html b/docs/api/en/folktale.src.data.conversions.html deleted file mode 100644 index d96eebc..0000000 --- a/docs/api/en/folktale.src.data.conversions.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - module folktale/data/conversions - - - - - -

                                                                                                                                                                module folktale/data/conversions

                                                                                                                                                                Provides functions to convert from and to different data -structures.

                                                                                                                                                                -

                                                                                                                                                                Documentation

                                                                                                                                                                Provides functions to convert from and to different data -structures.

                                                                                                                                                                -

                                                                                                                                                                Properties

                                                                                                                                                                Converting from Maybe

                                                                                                                                                                maybeToResult(aMaybe, failureValue)

                                                                                                                                                                Converts a Maybe to an Result. Nothings map to Errors, Justs map to -Oks.

                                                                                                                                                                -
                                                                                                                                                                Experimental
                                                                                                                                                                maybeToValidation(aMaybe, failureValue)

                                                                                                                                                                Converts a Maybe to a Validation. Nothings map to Failures, Justs map -to Successes.

                                                                                                                                                                -
                                                                                                                                                                Experimental

                                                                                                                                                                Converting from Result

                                                                                                                                                                resultToMaybe(aResult)

                                                                                                                                                                Converts an Result structure to a Maybe structure. Errors map to Nothings, -Oks map to Justs.

                                                                                                                                                                -
                                                                                                                                                                Experimental
                                                                                                                                                                resultToValidation(aResult)

                                                                                                                                                                Converts an Result to a Validation. Errors map to Failures, Oks map -to Successes.

                                                                                                                                                                -
                                                                                                                                                                Experimental

                                                                                                                                                                Converting from Validation

                                                                                                                                                                validationToMaybe(aValidation)

                                                                                                                                                                Converts a Validation to a Maybe. Failures map to Nothings, -Successes map to Justs.

                                                                                                                                                                -
                                                                                                                                                                Experimental
                                                                                                                                                                validationToResult(aValidation)

                                                                                                                                                                Converts a Validation to an Result. Failures map to Errors, -Successes map to Oks.

                                                                                                                                                                -
                                                                                                                                                                Experimental

                                                                                                                                                                Converting from nullables

                                                                                                                                                                nullableToMaybe(a)

                                                                                                                                                                Converts a nullable value to a maybe. null and undefined map to -Nothing, any other value maps to Justs.

                                                                                                                                                                -
                                                                                                                                                                Experimental
                                                                                                                                                                nullableToResult(a)

                                                                                                                                                                Converts a nullable value to a Result. null and undefined map to -Errors, any other value maps to Oks.

                                                                                                                                                                -
                                                                                                                                                                Experimental
                                                                                                                                                                nullableToValidation(a)

                                                                                                                                                                Converts a nullable value to a Validation. null and undefined -map to Failures, any other type maps to Successes.

                                                                                                                                                                -
                                                                                                                                                                Experimental

                                                                                                                                                                Source Code

                                                                                                                                                                Defined in src/data/conversions/index.js at line 16, column 0
                                                                                                                                                                {
                                                                                                                                                                -  resultToValidation: require('./result-to-validation'),
                                                                                                                                                                -  resultToMaybe: require('./result-to-maybe'),
                                                                                                                                                                -  validationToResult: require('./validation-to-result'),
                                                                                                                                                                -  validationToMaybe: require('./validation-to-maybe'),
                                                                                                                                                                -  maybeToValidation: require('./maybe-to-validation'),
                                                                                                                                                                -  maybeToResult: require('./maybe-to-result'),
                                                                                                                                                                -  nullableToValidation: require('./nullable-to-validation'),
                                                                                                                                                                -  nullableToResult: require('./nullable-to-result'),
                                                                                                                                                                -  nullableToMaybe: require('./nullable-to-maybe')
                                                                                                                                                                -}
                                                                                                                                                                Stability
                                                                                                                                                                experimental
                                                                                                                                                                Licence
                                                                                                                                                                MIT
                                                                                                                                                                Module
                                                                                                                                                                folktale/src/data/conversions
                                                                                                                                                                Authors
                                                                                                                                                                Authors
                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                Maintainers
                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.maybe-to-either.maybeToEither.html b/docs/api/en/folktale.src.data.conversions.maybe-to-either.maybeToEither.html deleted file mode 100644 index b76b3e8..0000000 --- a/docs/api/en/folktale.src.data.conversions.maybe-to-either.maybeToEither.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - maybeToEither - - - - - -

                                                                                                                                                                  maybeToEither

                                                                                                                                                                  Converts a Maybe to an Either. Nothings map to Lefts, Justs map to -Rights.

                                                                                                                                                                  -

                                                                                                                                                                  Signature

                                                                                                                                                                  maybeToEither(aMaybe, failureValue)
                                                                                                                                                                  Type
                                                                                                                                                                  forall a, b:
                                                                                                                                                                  -  (Maybe a, b) => Either b a

                                                                                                                                                                  Documentation

                                                                                                                                                                  Converts a Maybe to an Either. Nothings map to Lefts, Justs map to -Rights.

                                                                                                                                                                  -

                                                                                                                                                                  Note that since Maybes don't hold a value for failures in the Nothing tag, -you must provide one to this function.

                                                                                                                                                                  -

                                                                                                                                                                  Example:

                                                                                                                                                                  -
                                                                                                                                                                  const maybeToEither = require('folktale/data/conversions/maybe-to-either');
                                                                                                                                                                  -const { Left, Right } = require('folktale/data/either');
                                                                                                                                                                  -const { Nothing, Just } = require('folktale/data/maybe');
                                                                                                                                                                  -
                                                                                                                                                                  -maybeToEither(Nothing(), 2); // ==> Left(2)
                                                                                                                                                                  -maybeToEither(Just(1), 2);   // ==> Right(1)
                                                                                                                                                                  -

                                                                                                                                                                  Properties

                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                  A Number.

                                                                                                                                                                  -
                                                                                                                                                                  Experimental
                                                                                                                                                                  Experimental

                                                                                                                                                                  Source Code

                                                                                                                                                                  Defined in src/data/conversions/maybe-to-either.js at line 27, column 0
                                                                                                                                                                  (aMaybe, failureValue) =>
                                                                                                                                                                  -  aMaybe.matchWith({
                                                                                                                                                                  -    Nothing: () => Left(failureValue),
                                                                                                                                                                  -    Just:    ({ value }) => Right(value)
                                                                                                                                                                  -  })
                                                                                                                                                                  Stability
                                                                                                                                                                  experimental
                                                                                                                                                                  Licence
                                                                                                                                                                  MIT
                                                                                                                                                                  Module
                                                                                                                                                                  folktale/src/data/conversions/maybe-to-either
                                                                                                                                                                  Authors
                                                                                                                                                                  Authors
                                                                                                                                                                  • @boris-marinov
                                                                                                                                                                  Maintainers
                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.maybe-to-result.maybeToResult.html b/docs/api/en/folktale.src.data.conversions.maybe-to-result.maybeToResult.html deleted file mode 100644 index 5fa7755..0000000 --- a/docs/api/en/folktale.src.data.conversions.maybe-to-result.maybeToResult.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - maybeToResult - - - - - -

                                                                                                                                                                    maybeToResult

                                                                                                                                                                    Converts a Maybe to an Result. Nothings map to Errors, Justs map to -Oks.

                                                                                                                                                                    -

                                                                                                                                                                    Signature

                                                                                                                                                                    maybeToResult(aMaybe, failureValue)
                                                                                                                                                                    Type
                                                                                                                                                                    forall a, b:
                                                                                                                                                                    -  (Maybe a, b) => Result b a

                                                                                                                                                                    Documentation

                                                                                                                                                                    Converts a Maybe to an Result. Nothings map to Errors, Justs map to -Oks.

                                                                                                                                                                    -

                                                                                                                                                                    Note that since Maybes don't hold a value for failures in the Nothing tag, -you must provide one to this function.

                                                                                                                                                                    -

                                                                                                                                                                    Example:

                                                                                                                                                                    -
                                                                                                                                                                    const maybeToResult = require('folktale/data/conversions/maybe-to-result');
                                                                                                                                                                    -const { Error, Ok } = require('folktale/data/result');
                                                                                                                                                                    -const { Nothing, Just } = require('folktale/data/maybe');
                                                                                                                                                                    -
                                                                                                                                                                    -maybeToResult(Nothing(), 2); // ==> Error(2)
                                                                                                                                                                    -maybeToResult(Just(1), 2);   // ==> Ok(1)
                                                                                                                                                                    -

                                                                                                                                                                    Properties

                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                    Experimental

                                                                                                                                                                    Source Code

                                                                                                                                                                    Defined in src/data/conversions/maybe-to-result.js at line 24, column 0
                                                                                                                                                                    (aMaybe, failureValue) =>
                                                                                                                                                                    -  aMaybe.matchWith({
                                                                                                                                                                    -    Nothing: () => Error(failureValue),
                                                                                                                                                                    -    Just: ({ value }) => Ok(value)
                                                                                                                                                                    -  })
                                                                                                                                                                    Stability
                                                                                                                                                                    experimental
                                                                                                                                                                    Licence
                                                                                                                                                                    MIT
                                                                                                                                                                    Module
                                                                                                                                                                    folktale/src/data/conversions/maybe-to-result
                                                                                                                                                                    Authors
                                                                                                                                                                    Authors
                                                                                                                                                                    • @boris-marinov
                                                                                                                                                                    Maintainers
                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.maybe-to-validation.maybeToValidation.html b/docs/api/en/folktale.src.data.conversions.maybe-to-validation.maybeToValidation.html deleted file mode 100644 index 71f4507..0000000 --- a/docs/api/en/folktale.src.data.conversions.maybe-to-validation.maybeToValidation.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - maybeToValidation - - - - - -

                                                                                                                                                                      maybeToValidation

                                                                                                                                                                      Converts a Maybe to a Validation. Nothings map to Failures, Justs map -to Successes.

                                                                                                                                                                      -

                                                                                                                                                                      Signature

                                                                                                                                                                      maybeToValidation(aMaybe, failureValue)
                                                                                                                                                                      Type
                                                                                                                                                                      forall a, b:
                                                                                                                                                                      -  (Maybe a, b) => Validation b a

                                                                                                                                                                      Documentation

                                                                                                                                                                      Converts a Maybe to a Validation. Nothings map to Failures, Justs map -to Successes.

                                                                                                                                                                      -

                                                                                                                                                                      Note that since Maybe failures can't hold a value in the Nothing tag, you -must provide one for the validation.

                                                                                                                                                                      -

                                                                                                                                                                      Example:

                                                                                                                                                                      -
                                                                                                                                                                      const maybeToValidation = require('folktale/data/conversions/maybe-to-validation');
                                                                                                                                                                      -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                      -const { Nothing, Just } = require('folktale/data/maybe');
                                                                                                                                                                      -
                                                                                                                                                                      -maybeToValidation(Nothing(), 2);  // ==> Failure(2)
                                                                                                                                                                      -maybeToValidation(Just(1), 2);    // ==> Success(1)
                                                                                                                                                                      -

                                                                                                                                                                      Properties

                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                      Experimental

                                                                                                                                                                      Source Code

                                                                                                                                                                      Defined in src/data/conversions/maybe-to-validation.js at line 24, column 0
                                                                                                                                                                      (aMaybe, failureValue) =>
                                                                                                                                                                      -  aMaybe.matchWith({
                                                                                                                                                                      -    Nothing: () => Failure(failureValue),
                                                                                                                                                                      -    Just:    ({ value }) => Success(value)
                                                                                                                                                                      -  })
                                                                                                                                                                      Stability
                                                                                                                                                                      experimental
                                                                                                                                                                      Licence
                                                                                                                                                                      MIT
                                                                                                                                                                      Module
                                                                                                                                                                      folktale/src/data/conversions/maybe-to-validation
                                                                                                                                                                      Authors
                                                                                                                                                                      Authors
                                                                                                                                                                      • @boris-marinov
                                                                                                                                                                      Maintainers
                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.nullable-to-either.nullableToEither.html b/docs/api/en/folktale.src.data.conversions.nullable-to-either.nullableToEither.html deleted file mode 100644 index 92f328f..0000000 --- a/docs/api/en/folktale.src.data.conversions.nullable-to-either.nullableToEither.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - nullableToEither - - - - - -

                                                                                                                                                                        nullableToEither

                                                                                                                                                                        Converts a nullable value to an either. null and undefined map to -Lefts, any other value maps to Rights.

                                                                                                                                                                        -

                                                                                                                                                                        Signature

                                                                                                                                                                        nullableToEither(a)
                                                                                                                                                                        Type
                                                                                                                                                                        forall a:
                                                                                                                                                                        -  (a or None) => Either None a

                                                                                                                                                                        Documentation

                                                                                                                                                                        Converts a nullable value to an either. null and undefined map to -Lefts, any other value maps to Rights.

                                                                                                                                                                        -

                                                                                                                                                                        A nullable is a value that may be any type, or null/undefined.

                                                                                                                                                                        -

                                                                                                                                                                        Example:

                                                                                                                                                                        -
                                                                                                                                                                        const nullableToEither = require('folktale/data/conversions/nullable-to-either');
                                                                                                                                                                        -const { Left, Right } = require('folktale/data/either');
                                                                                                                                                                        -
                                                                                                                                                                        -nullableToEither(undefined);  // ==> Left(undefined)
                                                                                                                                                                        -nullableToEither(null);       // ==> Left(null)
                                                                                                                                                                        -nullableToEither(1);          // ==> Right(1)
                                                                                                                                                                        -

                                                                                                                                                                        Properties

                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                        A Number.

                                                                                                                                                                        -
                                                                                                                                                                        Experimental
                                                                                                                                                                        Experimental

                                                                                                                                                                        Source Code

                                                                                                                                                                        Defined in src/data/conversions/nullable-to-either.js at line 27, column 0
                                                                                                                                                                        (a) =>
                                                                                                                                                                        -  a != null ? Right(a)
                                                                                                                                                                        -  :/*else*/   Left(a)
                                                                                                                                                                        Stability
                                                                                                                                                                        experimental
                                                                                                                                                                        Licence
                                                                                                                                                                        MIT
                                                                                                                                                                        Module
                                                                                                                                                                        folktale/src/data/conversions/nullable-to-either
                                                                                                                                                                        Authors
                                                                                                                                                                        Authors
                                                                                                                                                                        • @boris-marinov
                                                                                                                                                                        Maintainers
                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.nullable-to-maybe.nullableToMaybe.html b/docs/api/en/folktale.src.data.conversions.nullable-to-maybe.nullableToMaybe.html deleted file mode 100644 index b9a8172..0000000 --- a/docs/api/en/folktale.src.data.conversions.nullable-to-maybe.nullableToMaybe.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - nullableToMaybe - - - - - -

                                                                                                                                                                          nullableToMaybe

                                                                                                                                                                          Converts a nullable value to a maybe. null and undefined map to -Nothing, any other value maps to Justs.

                                                                                                                                                                          -

                                                                                                                                                                          Signature

                                                                                                                                                                          nullableToMaybe(a)
                                                                                                                                                                          Type
                                                                                                                                                                          forall a:
                                                                                                                                                                          -  (a or None) => Maybe a

                                                                                                                                                                          Documentation

                                                                                                                                                                          Converts a nullable value to a maybe. null and undefined map to -Nothing, any other value maps to Justs.

                                                                                                                                                                          -

                                                                                                                                                                          A nullable is a value that may be any type, or null/undefined. Since -Nothing can't hold values, it's not possible to differentiate whether -the original value was null or undefined after the conversion.

                                                                                                                                                                          -

                                                                                                                                                                          Example:

                                                                                                                                                                          -
                                                                                                                                                                          const nullableToMaybe = require('folktale/data/conversions/nullable-to-maybe');
                                                                                                                                                                          -const { Nothing, Just } = require('folktale/data/maybe');
                                                                                                                                                                          -
                                                                                                                                                                          -nullableToMaybe(undefined);  // ==> Nothing()
                                                                                                                                                                          -nullableToMaybe(null);       // ==> Nothing()
                                                                                                                                                                          -nullableToMaybe(1);          // ==> Just(1)
                                                                                                                                                                          -

                                                                                                                                                                          Properties

                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                          Experimental

                                                                                                                                                                          Source Code

                                                                                                                                                                          Defined in src/data/conversions/nullable-to-maybe.js at line 24, column 0
                                                                                                                                                                          (a) =>
                                                                                                                                                                          -  a != null ? Just(a)
                                                                                                                                                                          -  :/*else*/   Nothing()
                                                                                                                                                                          Stability
                                                                                                                                                                          experimental
                                                                                                                                                                          Licence
                                                                                                                                                                          MIT
                                                                                                                                                                          Module
                                                                                                                                                                          folktale/src/data/conversions/nullable-to-maybe
                                                                                                                                                                          Authors
                                                                                                                                                                          Authors
                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                          Maintainers
                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.nullable-to-result.nullableToResult.html b/docs/api/en/folktale.src.data.conversions.nullable-to-result.nullableToResult.html deleted file mode 100644 index 8a5363b..0000000 --- a/docs/api/en/folktale.src.data.conversions.nullable-to-result.nullableToResult.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - nullableToResult - - - - - -

                                                                                                                                                                            nullableToResult

                                                                                                                                                                            Converts a nullable value to a Result. null and undefined map to -Errors, any other value maps to Oks.

                                                                                                                                                                            -

                                                                                                                                                                            Signature

                                                                                                                                                                            nullableToResult(a)
                                                                                                                                                                            Type
                                                                                                                                                                            forall a:
                                                                                                                                                                            -  (a or None) => Result None a

                                                                                                                                                                            Documentation

                                                                                                                                                                            Converts a nullable value to a Result. null and undefined map to -Errors, any other value maps to Oks.

                                                                                                                                                                            -

                                                                                                                                                                            A nullable is a value that may be any type, or null/undefined.

                                                                                                                                                                            -

                                                                                                                                                                            Example:

                                                                                                                                                                            -
                                                                                                                                                                            const nullableToResult = require('folktale/data/conversions/nullable-to-result');
                                                                                                                                                                            -const { Error, Ok } = require('folktale/data/result');
                                                                                                                                                                            -
                                                                                                                                                                            -nullableToResult(undefined);  // ==> Error(undefined)
                                                                                                                                                                            -nullableToResult(null);       // ==> Error(null)
                                                                                                                                                                            -nullableToResult(1);          // ==> Ok(1)
                                                                                                                                                                            -

                                                                                                                                                                            Properties

                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                            Experimental

                                                                                                                                                                            Source Code

                                                                                                                                                                            Defined in src/data/conversions/nullable-to-result.js at line 24, column 0
                                                                                                                                                                            (a) =>
                                                                                                                                                                            -  a != null ? Ok(a)
                                                                                                                                                                            -  :/*else*/   Error(a)
                                                                                                                                                                            Stability
                                                                                                                                                                            experimental
                                                                                                                                                                            Licence
                                                                                                                                                                            MIT
                                                                                                                                                                            Module
                                                                                                                                                                            folktale/src/data/conversions/nullable-to-result
                                                                                                                                                                            Authors
                                                                                                                                                                            Authors
                                                                                                                                                                            • @boris-marinov
                                                                                                                                                                            Maintainers
                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.nullable-to-validation.nullableToValidation.html b/docs/api/en/folktale.src.data.conversions.nullable-to-validation.nullableToValidation.html deleted file mode 100644 index 4de4f2e..0000000 --- a/docs/api/en/folktale.src.data.conversions.nullable-to-validation.nullableToValidation.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - nullableToValidation - - - - - -

                                                                                                                                                                              nullableToValidation

                                                                                                                                                                              Converts a nullable value to a Validation. null and undefined -map to Failures, any other type maps to Successes.

                                                                                                                                                                              -

                                                                                                                                                                              Signature

                                                                                                                                                                              nullableToValidation(a)
                                                                                                                                                                              Type
                                                                                                                                                                              forall a:
                                                                                                                                                                              -  (a or None) => Validation None a

                                                                                                                                                                              Documentation

                                                                                                                                                                              Converts a nullable value to a Validation. null and undefined -map to Failures, any other type maps to Successes.

                                                                                                                                                                              -

                                                                                                                                                                              A nullable is a value that may be any type, or null/undefined.

                                                                                                                                                                              -

                                                                                                                                                                              Example:

                                                                                                                                                                              -
                                                                                                                                                                              const nullableToValidation = require('folktale/data/conversions/nullable-to-validation');
                                                                                                                                                                              -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                              -
                                                                                                                                                                              -nullableToValidation(undefined); // ==> Failure(undefined)
                                                                                                                                                                              -nullableToValidation(null);      // ==> Failure(null)
                                                                                                                                                                              -nullableToValidation(1);         // ==> Success(1)
                                                                                                                                                                              -

                                                                                                                                                                              Properties

                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                              Experimental

                                                                                                                                                                              Source Code

                                                                                                                                                                              Defined in src/data/conversions/nullable-to-validation.js at line 24, column 0
                                                                                                                                                                              (a) =>
                                                                                                                                                                              -  a != null ? Success(a)
                                                                                                                                                                              -  :/*else*/   Failure(a)
                                                                                                                                                                              Stability
                                                                                                                                                                              experimental
                                                                                                                                                                              Licence
                                                                                                                                                                              MIT
                                                                                                                                                                              Module
                                                                                                                                                                              folktale/src/data/conversions/nullable-to-validation
                                                                                                                                                                              Authors
                                                                                                                                                                              Authors
                                                                                                                                                                              • @boris-marinov
                                                                                                                                                                              Maintainers
                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.result-to-maybe.resultToMaybe.html b/docs/api/en/folktale.src.data.conversions.result-to-maybe.resultToMaybe.html deleted file mode 100644 index 0624574..0000000 --- a/docs/api/en/folktale.src.data.conversions.result-to-maybe.resultToMaybe.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - resultToMaybe - - - - - -

                                                                                                                                                                                resultToMaybe

                                                                                                                                                                                Converts an Result structure to a Maybe structure. Errors map to Nothings, -Oks map to Justs.

                                                                                                                                                                                -

                                                                                                                                                                                Signature

                                                                                                                                                                                resultToMaybe(aResult)
                                                                                                                                                                                Type
                                                                                                                                                                                forall a, b:
                                                                                                                                                                                -  (Result a b) => Maybe b

                                                                                                                                                                                Documentation

                                                                                                                                                                                Converts an Result structure to a Maybe structure. Errors map to Nothings, -Oks map to Justs.

                                                                                                                                                                                -

                                                                                                                                                                                Not that Error values are lost in the conversion process, since failures -in Maybe (the Nothing tag) don't have a value.

                                                                                                                                                                                -

                                                                                                                                                                                Example:

                                                                                                                                                                                -
                                                                                                                                                                                const resultToMaybe = require('folktale/data/conversions/result-to-maybe');
                                                                                                                                                                                -const { Error, Ok } = require('folktale/data/result');
                                                                                                                                                                                -const { Just, Nothing } = require('folktale/data/maybe');
                                                                                                                                                                                -
                                                                                                                                                                                -resultToMaybe(Error(1));  // ==> Nothing()
                                                                                                                                                                                -resultToMaybe(Ok(1)); // ==> Just(1) 
                                                                                                                                                                                -

                                                                                                                                                                                Properties

                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                Experimental

                                                                                                                                                                                Source Code

                                                                                                                                                                                Defined in src/data/conversions/result-to-maybe.js at line 24, column 0
                                                                                                                                                                                (aResult) =>
                                                                                                                                                                                -  aResult.matchWith({
                                                                                                                                                                                -    Error: ({ value }) => Nothing(),
                                                                                                                                                                                -    Ok: ({ value }) => Just(value)
                                                                                                                                                                                -  })
                                                                                                                                                                                Stability
                                                                                                                                                                                experimental
                                                                                                                                                                                Licence
                                                                                                                                                                                MIT
                                                                                                                                                                                Module
                                                                                                                                                                                folktale/src/data/conversions/result-to-maybe
                                                                                                                                                                                Authors
                                                                                                                                                                                Authors
                                                                                                                                                                                • @boris-marinov
                                                                                                                                                                                Maintainers
                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.result-to-validation.resultToValidation.html b/docs/api/en/folktale.src.data.conversions.result-to-validation.resultToValidation.html deleted file mode 100644 index 460f9f2..0000000 --- a/docs/api/en/folktale.src.data.conversions.result-to-validation.resultToValidation.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - resultToValidation - - - - - -

                                                                                                                                                                                  resultToValidation

                                                                                                                                                                                  Converts an Result to a Validation. Errors map to Failures, Oks map -to Successes.

                                                                                                                                                                                  -

                                                                                                                                                                                  Signature

                                                                                                                                                                                  resultToValidation(aResult)
                                                                                                                                                                                  Type
                                                                                                                                                                                  forall a, b:
                                                                                                                                                                                  -  (Result a b) => Validation a b

                                                                                                                                                                                  Documentation

                                                                                                                                                                                  Converts an Result to a Validation. Errors map to Failures, Oks map -to Successes.

                                                                                                                                                                                  -

                                                                                                                                                                                  Example:

                                                                                                                                                                                  -
                                                                                                                                                                                  const resultToValidation = require('folktale/data/conversions/result-to-validation');
                                                                                                                                                                                  -const { Error, Ok } = require('folktale/data/result');
                                                                                                                                                                                  -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                                  -
                                                                                                                                                                                  -resultToValidation(Error(1));  // ==> Failure(1)
                                                                                                                                                                                  -resultToValidation(Ok(1)); // ==> Success(1)
                                                                                                                                                                                  -

                                                                                                                                                                                  Properties

                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                  Experimental

                                                                                                                                                                                  Source Code

                                                                                                                                                                                  Defined in src/data/conversions/result-to-validation.js at line 24, column 0
                                                                                                                                                                                  (aResult) =>
                                                                                                                                                                                  -  aResult.matchWith({
                                                                                                                                                                                  -    Error: ({ value }) => Failure(value),
                                                                                                                                                                                  -    Ok: ({ value }) => Success(value)
                                                                                                                                                                                  -  })
                                                                                                                                                                                  Stability
                                                                                                                                                                                  experimental
                                                                                                                                                                                  Licence
                                                                                                                                                                                  MIT
                                                                                                                                                                                  Module
                                                                                                                                                                                  folktale/src/data/conversions/result-to-validation
                                                                                                                                                                                  Authors
                                                                                                                                                                                  Authors
                                                                                                                                                                                  • @boris-marinov
                                                                                                                                                                                  Maintainers
                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.validation-to-either.validationToEither.html b/docs/api/en/folktale.src.data.conversions.validation-to-either.validationToEither.html deleted file mode 100644 index 0f3a47c..0000000 --- a/docs/api/en/folktale.src.data.conversions.validation-to-either.validationToEither.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - validationToEither - - - - - -

                                                                                                                                                                                    validationToEither

                                                                                                                                                                                    Converts a Validation to an Either. Failures map to Lefts, -Successes map to Rights.

                                                                                                                                                                                    -

                                                                                                                                                                                    Signature

                                                                                                                                                                                    validationToEither(aValidation)
                                                                                                                                                                                    Type
                                                                                                                                                                                    forall a, b:
                                                                                                                                                                                    -   (Validation a b) => Either a b

                                                                                                                                                                                    Documentation

                                                                                                                                                                                    Converts a Validation to an Either. Failures map to Lefts, -Successes map to Rights.

                                                                                                                                                                                    -

                                                                                                                                                                                    Example:

                                                                                                                                                                                    -
                                                                                                                                                                                    const validationToEither = require('folktale/data/conversions/validation-to-either');
                                                                                                                                                                                    -const { Left, Right } = require('folktale/data/either');
                                                                                                                                                                                    -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                                    -
                                                                                                                                                                                    -validationToEither(Failure(1));  // ==> Left(1)
                                                                                                                                                                                    -validationToEither(Success(1));  // ==> Right(1) 
                                                                                                                                                                                    -

                                                                                                                                                                                    Properties

                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                    A Number.

                                                                                                                                                                                    -
                                                                                                                                                                                    Experimental
                                                                                                                                                                                    Experimental

                                                                                                                                                                                    Source Code

                                                                                                                                                                                    Defined in src/data/conversions/validation-to-either.js at line 28, column 0
                                                                                                                                                                                    (aValidation) =>
                                                                                                                                                                                    -  aValidation.matchWith({
                                                                                                                                                                                    -    Failure: ({ value }) => Left(value),
                                                                                                                                                                                    -    Success: ({ value }) => Right(value)
                                                                                                                                                                                    -  })
                                                                                                                                                                                    Stability
                                                                                                                                                                                    experimental
                                                                                                                                                                                    Licence
                                                                                                                                                                                    MIT
                                                                                                                                                                                    Module
                                                                                                                                                                                    folktale/src/data/conversions/validation-to-either
                                                                                                                                                                                    Authors
                                                                                                                                                                                    Authors
                                                                                                                                                                                    • @boris-marinov
                                                                                                                                                                                    Maintainers
                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.validation-to-maybe.validationToMaybe.html b/docs/api/en/folktale.src.data.conversions.validation-to-maybe.validationToMaybe.html deleted file mode 100644 index 3d1e4e8..0000000 --- a/docs/api/en/folktale.src.data.conversions.validation-to-maybe.validationToMaybe.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - validationToMaybe - - - - - -

                                                                                                                                                                                      validationToMaybe

                                                                                                                                                                                      Converts a Validation to a Maybe. Failures map to Nothings, -Successes map to Justs.

                                                                                                                                                                                      -

                                                                                                                                                                                      Signature

                                                                                                                                                                                      validationToMaybe(aValidation)
                                                                                                                                                                                      Type
                                                                                                                                                                                      forall a, b:
                                                                                                                                                                                      -  (Validation a b) => Maybe b

                                                                                                                                                                                      Documentation

                                                                                                                                                                                      Converts a Validation to a Maybe. Failures map to Nothings, -Successes map to Justs.

                                                                                                                                                                                      -

                                                                                                                                                                                      Failure values are lost in the process, since the Nothing tag can't -hold any values.

                                                                                                                                                                                      -

                                                                                                                                                                                      Example:

                                                                                                                                                                                      -
                                                                                                                                                                                      const validationToMaybe = require('folktale/data/conversions/validation-to-maybe');
                                                                                                                                                                                      -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                                      -const { Nothing, Just } = require('folktale/data/maybe');
                                                                                                                                                                                      -
                                                                                                                                                                                      -validationToMaybe(Failure(1));  // ==> Nothing()
                                                                                                                                                                                      -validationToMaybe(Success(1));  // ==> Just(1)
                                                                                                                                                                                      -

                                                                                                                                                                                      Properties

                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                      Experimental

                                                                                                                                                                                      Source Code

                                                                                                                                                                                      Defined in src/data/conversions/validation-to-maybe.js at line 24, column 0
                                                                                                                                                                                      (aValidation) =>
                                                                                                                                                                                      -  aValidation.matchWith({
                                                                                                                                                                                      -    Failure:  () => Nothing(),
                                                                                                                                                                                      -    Success:  ({ value }) => Just(value)
                                                                                                                                                                                      -  })
                                                                                                                                                                                      Stability
                                                                                                                                                                                      experimental
                                                                                                                                                                                      Licence
                                                                                                                                                                                      MIT
                                                                                                                                                                                      Module
                                                                                                                                                                                      folktale/src/data/conversions/validation-to-maybe
                                                                                                                                                                                      Authors
                                                                                                                                                                                      Authors
                                                                                                                                                                                      • @boris-marinov
                                                                                                                                                                                      Maintainers
                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.conversions.validation-to-result.validationToResult.html b/docs/api/en/folktale.src.data.conversions.validation-to-result.validationToResult.html deleted file mode 100644 index 8e4cc39..0000000 --- a/docs/api/en/folktale.src.data.conversions.validation-to-result.validationToResult.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - validationToResult - - - - - -

                                                                                                                                                                                        validationToResult

                                                                                                                                                                                        Converts a Validation to an Result. Failures map to Errors, -Successes map to Oks.

                                                                                                                                                                                        -

                                                                                                                                                                                        Signature

                                                                                                                                                                                        validationToResult(aValidation)
                                                                                                                                                                                        Type
                                                                                                                                                                                        forall a, b:
                                                                                                                                                                                        -   (Validation a b) => Result a b

                                                                                                                                                                                        Documentation

                                                                                                                                                                                        Converts a Validation to an Result. Failures map to Errors, -Successes map to Oks.

                                                                                                                                                                                        -

                                                                                                                                                                                        Example:

                                                                                                                                                                                        -
                                                                                                                                                                                        const validationToResult = require('folktale/data/conversions/validation-to-result');
                                                                                                                                                                                        -const { Error, Ok } = require('folktale/data/result');
                                                                                                                                                                                        -const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                                        -
                                                                                                                                                                                        -validationToResult(Failure(1));  // ==> Error(1)
                                                                                                                                                                                        -validationToResult(Success(1));  // ==> Ok(1) 
                                                                                                                                                                                        -

                                                                                                                                                                                        Properties

                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                        Experimental

                                                                                                                                                                                        Source Code

                                                                                                                                                                                        Defined in src/data/conversions/validation-to-result.js at line 24, column 0
                                                                                                                                                                                        (aValidation) =>
                                                                                                                                                                                        -  aValidation.matchWith({
                                                                                                                                                                                        -    Failure: ({ value }) => Error(value),
                                                                                                                                                                                        -    Success: ({ value }) => Ok(value)
                                                                                                                                                                                        -  })
                                                                                                                                                                                        Stability
                                                                                                                                                                                        experimental
                                                                                                                                                                                        Licence
                                                                                                                                                                                        MIT
                                                                                                                                                                                        Module
                                                                                                                                                                                        folktale/src/data/conversions/validation-to-result
                                                                                                                                                                                        Authors
                                                                                                                                                                                        Authors
                                                                                                                                                                                        • @boris-marinov
                                                                                                                                                                                        Maintainers
                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.Left.html b/docs/api/en/folktale.src.data.either.Left.html deleted file mode 100644 index 1b6cd78..0000000 --- a/docs/api/en/folktale.src.data.either.Left.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Left - - - - - -

                                                                                                                                                                                          Left

                                                                                                                                                                                          Constructs an Either containing a Left value.

                                                                                                                                                                                          -

                                                                                                                                                                                          Signature

                                                                                                                                                                                          Left(value)
                                                                                                                                                                                          Type
                                                                                                                                                                                          forall a, b: (a) => Either a b

                                                                                                                                                                                          Documentation

                                                                                                                                                                                          Constructs an Either containing a Left value.

                                                                                                                                                                                          -

                                                                                                                                                                                          Properties

                                                                                                                                                                                          Comparing and Testing

                                                                                                                                                                                          hasInstance(value)

                                                                                                                                                                                          Checks if a value belongs to this Variant.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental

                                                                                                                                                                                          Debug Representation

                                                                                                                                                                                          inspect: toString()

                                                                                                                                                                                          Returns a textual representation of the Variant.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental
                                                                                                                                                                                          toString()

                                                                                                                                                                                          Returns a textual representation of the Variant.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental

                                                                                                                                                                                          Internal

                                                                                                                                                                                          get constructor

                                                                                                                                                                                          The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental
                                                                                                                                                                                          prototype

                                                                                                                                                                                          The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental

                                                                                                                                                                                          State and Configuration

                                                                                                                                                                                          get tag

                                                                                                                                                                                          The unique tag for this variant within the ADT.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental
                                                                                                                                                                                          get type

                                                                                                                                                                                          The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental

                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                          A String.

                                                                                                                                                                                          -
                                                                                                                                                                                          Experimental

                                                                                                                                                                                          Source Code

                                                                                                                                                                                          Left(value)  { return { value } }
                                                                                                                                                                                          Stability
                                                                                                                                                                                          experimental
                                                                                                                                                                                          Licence
                                                                                                                                                                                          MIT
                                                                                                                                                                                          Module
                                                                                                                                                                                          folktale/src/data/either
                                                                                                                                                                                          Authors
                                                                                                                                                                                          Authors
                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                          Maintainers
                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.Right.html b/docs/api/en/folktale.src.data.either.Right.html deleted file mode 100644 index 006a727..0000000 --- a/docs/api/en/folktale.src.data.either.Right.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Right - - - - - -

                                                                                                                                                                                            Right

                                                                                                                                                                                            Constructs an Either containing a Right value.

                                                                                                                                                                                            -

                                                                                                                                                                                            Signature

                                                                                                                                                                                            Right(value)
                                                                                                                                                                                            Type
                                                                                                                                                                                            forall a, b: (b) => Either a b

                                                                                                                                                                                            Documentation

                                                                                                                                                                                            Constructs an Either containing a Right value.

                                                                                                                                                                                            -

                                                                                                                                                                                            Properties

                                                                                                                                                                                            Comparing and Testing

                                                                                                                                                                                            hasInstance(value)

                                                                                                                                                                                            Checks if a value belongs to this Variant.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental

                                                                                                                                                                                            Debug Representation

                                                                                                                                                                                            inspect: toString()

                                                                                                                                                                                            Returns a textual representation of the Variant.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental
                                                                                                                                                                                            toString()

                                                                                                                                                                                            Returns a textual representation of the Variant.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental

                                                                                                                                                                                            Internal

                                                                                                                                                                                            get constructor

                                                                                                                                                                                            The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental
                                                                                                                                                                                            prototype

                                                                                                                                                                                            The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental

                                                                                                                                                                                            State and Configuration

                                                                                                                                                                                            get tag

                                                                                                                                                                                            The unique tag for this variant within the ADT.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental
                                                                                                                                                                                            get type

                                                                                                                                                                                            The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental

                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                            A String.

                                                                                                                                                                                            -
                                                                                                                                                                                            Experimental

                                                                                                                                                                                            Source Code

                                                                                                                                                                                            Right(value) { return { value } }
                                                                                                                                                                                            Stability
                                                                                                                                                                                            experimental
                                                                                                                                                                                            Licence
                                                                                                                                                                                            MIT
                                                                                                                                                                                            Module
                                                                                                                                                                                            folktale/src/data/either
                                                                                                                                                                                            Authors
                                                                                                                                                                                            Authors
                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                            Maintainers
                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.constructor.html b/docs/api/en/folktale.src.data.either.constructor.html deleted file mode 100644 index fb981bc..0000000 --- a/docs/api/en/folktale.src.data.either.constructor.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Left - - - - - -

                                                                                                                                                                                              Left

                                                                                                                                                                                              Constructs an Either containing a Left value.

                                                                                                                                                                                              -

                                                                                                                                                                                              Signature

                                                                                                                                                                                              Left(value)
                                                                                                                                                                                              Type
                                                                                                                                                                                              forall a, b: (a) => Either a b

                                                                                                                                                                                              Documentation

                                                                                                                                                                                              Constructs an Either containing a Left value.

                                                                                                                                                                                              -

                                                                                                                                                                                              Properties

                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                              A Number.

                                                                                                                                                                                              -
                                                                                                                                                                                              Experimental

                                                                                                                                                                                              A String.

                                                                                                                                                                                              -
                                                                                                                                                                                              Experimental
                                                                                                                                                                                              Experimental

                                                                                                                                                                                              Source Code

                                                                                                                                                                                              Left(value)  { return { value } }
                                                                                                                                                                                              Stability
                                                                                                                                                                                              experimental
                                                                                                                                                                                              Licence
                                                                                                                                                                                              MIT
                                                                                                                                                                                              Module
                                                                                                                                                                                              folktale/src/data/either
                                                                                                                                                                                              Authors
                                                                                                                                                                                              Authors
                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.apply.html b/docs/api/en/folktale.src.data.either.either.apply.html deleted file mode 100644 index 0b4f640..0000000 --- a/docs/api/en/folktale.src.data.either.either.apply.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - apply - - - - - -

                                                                                                                                                                                                apply

                                                                                                                                                                                                Applies a function in an Either to the value of another. Both Eithers -must be Right.

                                                                                                                                                                                                -

                                                                                                                                                                                                Signature

                                                                                                                                                                                                apply(anEither)
                                                                                                                                                                                                Type
                                                                                                                                                                                                forall a, b, c:
                                                                                                                                                                                                -  (Either a ((b) => c)).(Either a b) => Either a c

                                                                                                                                                                                                Documentation

                                                                                                                                                                                                Applies a function in an Either to the value of another. Both Eithers -must be Right.

                                                                                                                                                                                                -

                                                                                                                                                                                                Example:

                                                                                                                                                                                                -
                                                                                                                                                                                                const inc = (x) => x + 1;
                                                                                                                                                                                                -
                                                                                                                                                                                                -Right(inc).apply(Right(1));  // ==> Either.Right(2)
                                                                                                                                                                                                -Right(inc).apply(Left(1));   // ==> Either.Left(1)
                                                                                                                                                                                                -Left(inc).apply(Left(1));    // ==> Either.Left(inc) 
                                                                                                                                                                                                -

                                                                                                                                                                                                Properties

                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                A Number.

                                                                                                                                                                                                -
                                                                                                                                                                                                Experimental

                                                                                                                                                                                                A String.

                                                                                                                                                                                                -
                                                                                                                                                                                                Experimental
                                                                                                                                                                                                Experimental

                                                                                                                                                                                                Source Code

                                                                                                                                                                                                Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                {
                                                                                                                                                                                                -    Left(anEither) {
                                                                                                                                                                                                -      assertEither('Either.Left#apply', anEither);
                                                                                                                                                                                                -      return this;
                                                                                                                                                                                                -    },
                                                                                                                                                                                                -
                                                                                                                                                                                                -    Right(anEither) {
                                                                                                                                                                                                -      assertEither('Either.Right#apply', anEither);
                                                                                                                                                                                                -      return anEither.map(this.value);
                                                                                                                                                                                                -    }
                                                                                                                                                                                                -  }
                                                                                                                                                                                                Stability
                                                                                                                                                                                                experimental
                                                                                                                                                                                                Licence
                                                                                                                                                                                                MIT
                                                                                                                                                                                                Module
                                                                                                                                                                                                folktale/src/data/either/either
                                                                                                                                                                                                Authors
                                                                                                                                                                                                Authors
                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.bimap.html b/docs/api/en/folktale.src.data.either.either.bimap.html deleted file mode 100644 index d8d923f..0000000 --- a/docs/api/en/folktale.src.data.either.either.bimap.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - bimap - - - - - -

                                                                                                                                                                                                  bimap

                                                                                                                                                                                                  Transforms each side of an either with a function.

                                                                                                                                                                                                  -

                                                                                                                                                                                                  Signature

                                                                                                                                                                                                  bimap(leftTransformation, rightTransformation)
                                                                                                                                                                                                  Type
                                                                                                                                                                                                  (Either a b).((a) => c, (b) => d) => Either c d

                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                  Transforms each side of an either with a function.

                                                                                                                                                                                                  -

                                                                                                                                                                                                  Example:

                                                                                                                                                                                                  -
                                                                                                                                                                                                  const inc = (x) => x + 1;
                                                                                                                                                                                                  -const dec = (x) => x - 1;
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -Left(1).bimap(inc, dec);   // ==> Either.Left(inc(1))
                                                                                                                                                                                                  -Right(1).bimap(inc, dec);  // ==> Either.Right(dec(1))
                                                                                                                                                                                                  -

                                                                                                                                                                                                  Properties

                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                  A Number.

                                                                                                                                                                                                  -
                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                  A String.

                                                                                                                                                                                                  -
                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                  Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                  {
                                                                                                                                                                                                  -    Left(f, g) {
                                                                                                                                                                                                  -      assertFunction('Either.Left#bimap', f);
                                                                                                                                                                                                  -      assertFunction('Either.Left#bimap', g);
                                                                                                                                                                                                  -      return Left(f(this.value));
                                                                                                                                                                                                  -    },
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -    Right(f, g) {
                                                                                                                                                                                                  -      assertFunction('Either.Right#bimap', f);
                                                                                                                                                                                                  -      assertFunction('Either.Right#bimap', g);
                                                                                                                                                                                                  -      return Right(g(this.value));
                                                                                                                                                                                                  -    }
                                                                                                                                                                                                  -  }
                                                                                                                                                                                                  Stability
                                                                                                                                                                                                  experimental
                                                                                                                                                                                                  Licence
                                                                                                                                                                                                  MIT
                                                                                                                                                                                                  Module
                                                                                                                                                                                                  folktale/src/data/either/either
                                                                                                                                                                                                  Authors
                                                                                                                                                                                                  Authors
                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.chain.html b/docs/api/en/folktale.src.data.either.either.chain.html deleted file mode 100644 index c59d30e..0000000 --- a/docs/api/en/folktale.src.data.either.either.chain.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - chain - - - - - -

                                                                                                                                                                                                    chain

                                                                                                                                                                                                    Transform the Right side of eithers into another Either.

                                                                                                                                                                                                    -

                                                                                                                                                                                                    Signature

                                                                                                                                                                                                    chain(transformation)
                                                                                                                                                                                                    Type
                                                                                                                                                                                                    forall a, b, c:
                                                                                                                                                                                                    -  (Either a b).((b) => Either a c) => Either a c

                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                    Transform the Right side of eithers into another Either.

                                                                                                                                                                                                    -

                                                                                                                                                                                                    Example:

                                                                                                                                                                                                    -
                                                                                                                                                                                                    Left(1).chain(x => Right(x + 1));  // ==> Either.Left(1)
                                                                                                                                                                                                    -Right(1).chain(x => Right(x + 1)); // ==> Either.Right(2)
                                                                                                                                                                                                    -Right(1).chain(x => Left(x + 1));  // ==> Either.Left(2)
                                                                                                                                                                                                    -

                                                                                                                                                                                                    Properties

                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                    A Number.

                                                                                                                                                                                                    -
                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                    A String.

                                                                                                                                                                                                    -
                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                    Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                    {
                                                                                                                                                                                                    -    Left(f) {
                                                                                                                                                                                                    -      assertFunction('Either.Left#chain', f);
                                                                                                                                                                                                    -      return this;
                                                                                                                                                                                                    -    },
                                                                                                                                                                                                    -
                                                                                                                                                                                                    -    Right(f) {
                                                                                                                                                                                                    -      assertFunction('Either.Right#chain', f);
                                                                                                                                                                                                    -      return f(this.value);
                                                                                                                                                                                                    -    }
                                                                                                                                                                                                    -  }
                                                                                                                                                                                                    Stability
                                                                                                                                                                                                    experimental
                                                                                                                                                                                                    Licence
                                                                                                                                                                                                    MIT
                                                                                                                                                                                                    Module
                                                                                                                                                                                                    folktale/src/data/either/either
                                                                                                                                                                                                    Authors
                                                                                                                                                                                                    Authors
                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.fold.html b/docs/api/en/folktale.src.data.either.either.fold.html deleted file mode 100644 index 99137d5..0000000 --- a/docs/api/en/folktale.src.data.either.either.fold.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - fold - - - - - -

                                                                                                                                                                                                      fold

                                                                                                                                                                                                      Applies a function to each side of an Either.

                                                                                                                                                                                                      -

                                                                                                                                                                                                      Signature

                                                                                                                                                                                                      fold(leftTransformation, rightTransformation)
                                                                                                                                                                                                      Type
                                                                                                                                                                                                      forall a, b, c:
                                                                                                                                                                                                      -  (Either a b).((a) => c, (b) => c) => c

                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                      Applies a function to each side of an Either.

                                                                                                                                                                                                      -

                                                                                                                                                                                                      Example:

                                                                                                                                                                                                      -
                                                                                                                                                                                                      const inc = (x) => x + 1;
                                                                                                                                                                                                      -const dec = (x) => x - 1;
                                                                                                                                                                                                      -
                                                                                                                                                                                                      -Left(1).fold(inc, dec);  // ==> inc(1)
                                                                                                                                                                                                      -Right(1).fold(inc, dec); // ==> dec(1)
                                                                                                                                                                                                      -

                                                                                                                                                                                                      Properties

                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                      A Number.

                                                                                                                                                                                                      -
                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                      A String.

                                                                                                                                                                                                      -
                                                                                                                                                                                                      Experimental
                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                      Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                      {
                                                                                                                                                                                                      -    Left(f, g) {
                                                                                                                                                                                                      -      assertFunction('Either.Left#fold', f);
                                                                                                                                                                                                      -      assertFunction('Either.Left#fold', g);
                                                                                                                                                                                                      -      return f(this.value);
                                                                                                                                                                                                      -    },
                                                                                                                                                                                                      -
                                                                                                                                                                                                      -    Right(f, g) {
                                                                                                                                                                                                      -      assertFunction('Either.Right#fold', f);
                                                                                                                                                                                                      -      assertFunction('Either.Right#fold', g);
                                                                                                                                                                                                      -      return g(this.value);
                                                                                                                                                                                                      -    }
                                                                                                                                                                                                      -  }
                                                                                                                                                                                                      Stability
                                                                                                                                                                                                      experimental
                                                                                                                                                                                                      Licence
                                                                                                                                                                                                      MIT
                                                                                                                                                                                                      Module
                                                                                                                                                                                                      folktale/src/data/either/either
                                                                                                                                                                                                      Authors
                                                                                                                                                                                                      Authors
                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.get.html b/docs/api/en/folktale.src.data.either.either.get.html deleted file mode 100644 index 6149c49..0000000 --- a/docs/api/en/folktale.src.data.either.either.get.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - get - - - - - -

                                                                                                                                                                                                        get

                                                                                                                                                                                                        Extracts the value of a Right either.

                                                                                                                                                                                                        -

                                                                                                                                                                                                        Signature

                                                                                                                                                                                                        get()
                                                                                                                                                                                                        Type
                                                                                                                                                                                                        forall a, b: (Either a b).() => b :: throws TypeError

                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                        Extracts the value of a Right either.

                                                                                                                                                                                                        -

                                                                                                                                                                                                        Note that this method throws when called with a Left. In general -it's recommended to use .getOrElse instead, where you can provide -a failure value.

                                                                                                                                                                                                        -

                                                                                                                                                                                                        Example:

                                                                                                                                                                                                        -
                                                                                                                                                                                                        Right(1).get();  // ==> 1
                                                                                                                                                                                                        -

                                                                                                                                                                                                        Properties

                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                        A String.

                                                                                                                                                                                                        -
                                                                                                                                                                                                        Experimental
                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                        Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                        {
                                                                                                                                                                                                        -    Left() {
                                                                                                                                                                                                        -      throw new TypeError(`Can't extract the value of a Left.
                                                                                                                                                                                                        -
                                                                                                                                                                                                        -Left does not contain a normal value - it contains an error.
                                                                                                                                                                                                        -You might consider switching from Either#get to Either#getOrElse, or some other method
                                                                                                                                                                                                        -that is not partial.
                                                                                                                                                                                                        -      `);
                                                                                                                                                                                                        -    },
                                                                                                                                                                                                        -
                                                                                                                                                                                                        -    Right() {
                                                                                                                                                                                                        -      return this.value;
                                                                                                                                                                                                        -    }
                                                                                                                                                                                                        -  }
                                                                                                                                                                                                        Stability
                                                                                                                                                                                                        experimental
                                                                                                                                                                                                        Licence
                                                                                                                                                                                                        MIT
                                                                                                                                                                                                        Module
                                                                                                                                                                                                        folktale/src/data/either/either
                                                                                                                                                                                                        Authors
                                                                                                                                                                                                        Authors
                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.getOrElse.html b/docs/api/en/folktale.src.data.either.either.getOrElse.html deleted file mode 100644 index d7d125e..0000000 --- a/docs/api/en/folktale.src.data.either.either.getOrElse.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - getOrElse - - - - - -

                                                                                                                                                                                                          getOrElse

                                                                                                                                                                                                          Extracts the value of a Right either, or returns a fallback value -if given a Left.

                                                                                                                                                                                                          -

                                                                                                                                                                                                          Signature

                                                                                                                                                                                                          getOrElse(default)
                                                                                                                                                                                                          Type
                                                                                                                                                                                                          forall a, b: (Either a b).(b) => b

                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                          Extracts the value of a Right either, or returns a fallback value -if given a Left.

                                                                                                                                                                                                          -

                                                                                                                                                                                                          Example:

                                                                                                                                                                                                          -
                                                                                                                                                                                                          Left(1).getOrElse(2);  // ==> 2
                                                                                                                                                                                                          -Right(1).getOrElse(2); // ==> 1
                                                                                                                                                                                                          -

                                                                                                                                                                                                          Properties

                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                          A Number.

                                                                                                                                                                                                          -
                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                          A String.

                                                                                                                                                                                                          -
                                                                                                                                                                                                          Experimental
                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                          Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                          {
                                                                                                                                                                                                          -    Left(default_) {
                                                                                                                                                                                                          -      return default_;
                                                                                                                                                                                                          -    },
                                                                                                                                                                                                          -
                                                                                                                                                                                                          -    Right(default_) {
                                                                                                                                                                                                          -      return this.value;
                                                                                                                                                                                                          -    }
                                                                                                                                                                                                          -  }
                                                                                                                                                                                                          Stability
                                                                                                                                                                                                          experimental
                                                                                                                                                                                                          Licence
                                                                                                                                                                                                          MIT
                                                                                                                                                                                                          Module
                                                                                                                                                                                                          folktale/src/data/either/either
                                                                                                                                                                                                          Authors
                                                                                                                                                                                                          Authors
                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.leftMap.html b/docs/api/en/folktale.src.data.either.either.leftMap.html deleted file mode 100644 index b920fc4..0000000 --- a/docs/api/en/folktale.src.data.either.either.leftMap.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - leftMap - - - - - -

                                                                                                                                                                                                            leftMap

                                                                                                                                                                                                            Transforms the value of Left eithers.

                                                                                                                                                                                                            -

                                                                                                                                                                                                            Signature

                                                                                                                                                                                                            leftMap(transformation)
                                                                                                                                                                                                            Type
                                                                                                                                                                                                            forall a, b, c:
                                                                                                                                                                                                            -  (Either a b).((a) => c) => Either c b

                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                            Transforms the value of Left eithers.

                                                                                                                                                                                                            -

                                                                                                                                                                                                            Example:

                                                                                                                                                                                                            -
                                                                                                                                                                                                            Left(1).leftMap(x => x + 1);   // ==> Either.Left(2)
                                                                                                                                                                                                            -Right(1).leftMap(x => x + 1);  // ==> Either.Right(1)
                                                                                                                                                                                                            -

                                                                                                                                                                                                            Properties

                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                            A Number.

                                                                                                                                                                                                            -
                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                            A String.

                                                                                                                                                                                                            -
                                                                                                                                                                                                            Experimental
                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                            Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                            {
                                                                                                                                                                                                            -    Left(f) {
                                                                                                                                                                                                            -      assertFunction('Either.Left#leftMap', f);
                                                                                                                                                                                                            -      return Left(f(this.value));
                                                                                                                                                                                                            -    },
                                                                                                                                                                                                            -
                                                                                                                                                                                                            -    Right(f) {
                                                                                                                                                                                                            -      assertFunction('Either.Right#leftMap', f);
                                                                                                                                                                                                            -      return this;
                                                                                                                                                                                                            -    }
                                                                                                                                                                                                            -  }
                                                                                                                                                                                                            Stability
                                                                                                                                                                                                            experimental
                                                                                                                                                                                                            Licence
                                                                                                                                                                                                            MIT
                                                                                                                                                                                                            Module
                                                                                                                                                                                                            folktale/src/data/either/either
                                                                                                                                                                                                            Authors
                                                                                                                                                                                                            Authors
                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.map.html b/docs/api/en/folktale.src.data.either.either.map.html deleted file mode 100644 index 08e1368..0000000 --- a/docs/api/en/folktale.src.data.either.either.map.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - map - - - - - -

                                                                                                                                                                                                              map

                                                                                                                                                                                                              Transforms the Right side of an Either.

                                                                                                                                                                                                              -

                                                                                                                                                                                                              Signature

                                                                                                                                                                                                              map(transformation)
                                                                                                                                                                                                              Type
                                                                                                                                                                                                              forall a, b, c:
                                                                                                                                                                                                              -  (Either a b).((b) => c) => Either a c

                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                              Transforms the Right side of an Either.

                                                                                                                                                                                                              -

                                                                                                                                                                                                              Example:

                                                                                                                                                                                                              -
                                                                                                                                                                                                              Left(1).map(x => x + 1);  // ==> Either.Left(1)
                                                                                                                                                                                                              -Right(1).map(x => x + 1); // ==> Either.Right(2)
                                                                                                                                                                                                              -

                                                                                                                                                                                                              Properties

                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                              A Number.

                                                                                                                                                                                                              -
                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                              A String.

                                                                                                                                                                                                              -
                                                                                                                                                                                                              Experimental
                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                              Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                              {
                                                                                                                                                                                                              -    Left(f) {
                                                                                                                                                                                                              -      assertFunction('Either.Left#map', f);
                                                                                                                                                                                                              -      return this;
                                                                                                                                                                                                              -    },
                                                                                                                                                                                                              -
                                                                                                                                                                                                              -    Right(f) {
                                                                                                                                                                                                              -      assertFunction('Either.Right#map', f);
                                                                                                                                                                                                              -      return Right(f(this.value));
                                                                                                                                                                                                              -    }
                                                                                                                                                                                                              -  }
                                                                                                                                                                                                              Stability
                                                                                                                                                                                                              experimental
                                                                                                                                                                                                              Licence
                                                                                                                                                                                                              MIT
                                                                                                                                                                                                              Module
                                                                                                                                                                                                              folktale/src/data/either/either
                                                                                                                                                                                                              Authors
                                                                                                                                                                                                              Authors
                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.merge.html b/docs/api/en/folktale.src.data.either.either.merge.html deleted file mode 100644 index 00963b7..0000000 --- a/docs/api/en/folktale.src.data.either.either.merge.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - merge - - - - - -

                                                                                                                                                                                                                merge

                                                                                                                                                                                                                Returns the value of an Either regardless of its tag.

                                                                                                                                                                                                                -

                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                merge()
                                                                                                                                                                                                                Type
                                                                                                                                                                                                                forall a, b: (Either a b).() => a or b

                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                Returns the value of an Either regardless of its tag.

                                                                                                                                                                                                                -

                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                -
                                                                                                                                                                                                                Left(1).merge();  // ==> 1
                                                                                                                                                                                                                -Right(2).merge(); // ==> 2
                                                                                                                                                                                                                -

                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                A String.

                                                                                                                                                                                                                -
                                                                                                                                                                                                                Experimental
                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                                {
                                                                                                                                                                                                                -    Left() {
                                                                                                                                                                                                                -      return this.value;
                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                -
                                                                                                                                                                                                                -    Right() {
                                                                                                                                                                                                                -      return this.value;
                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                Stability
                                                                                                                                                                                                                experimental
                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                Module
                                                                                                                                                                                                                folktale/src/data/either/either
                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.of.html b/docs/api/en/folktale.src.data.either.either.of.html deleted file mode 100644 index 423a0a2..0000000 --- a/docs/api/en/folktale.src.data.either.either.of.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - of - - - - - -

                                                                                                                                                                                                                  of

                                                                                                                                                                                                                  Constructs an Either holding a Right value.

                                                                                                                                                                                                                  -

                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                  of(value)
                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                  forall a, b: (b) => Either a b

                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                  Constructs an Either holding a Right value.

                                                                                                                                                                                                                  -

                                                                                                                                                                                                                  Example:

                                                                                                                                                                                                                  -
                                                                                                                                                                                                                  Either.of(1);  // ==> Either.Right(1)
                                                                                                                                                                                                                  -

                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                  A Number.

                                                                                                                                                                                                                  -
                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                  A String.

                                                                                                                                                                                                                  -
                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                  Defined in src/data/either/either.js at line 385, column 22
                                                                                                                                                                                                                  of(value) {
                                                                                                                                                                                                                  -    return Right(value);
                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                  Stability
                                                                                                                                                                                                                  experimental
                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                  folktale/src/data/either/either
                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.orElse.html b/docs/api/en/folktale.src.data.either.either.orElse.html deleted file mode 100644 index ed2f6c4..0000000 --- a/docs/api/en/folktale.src.data.either.either.orElse.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - orElse - - - - - -

                                                                                                                                                                                                                    orElse

                                                                                                                                                                                                                    Transforms a Left either into a new Either.

                                                                                                                                                                                                                    -

                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                    orElse(handler)
                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                    forall a, b, c:
                                                                                                                                                                                                                    -  (Either a b).((a) => Either c b) => Either c b

                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                    Transforms a Left either into a new Either.

                                                                                                                                                                                                                    -

                                                                                                                                                                                                                    Example:

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                    Left(1).orElse(x => Right(2));  // ==> Either.Right(2)
                                                                                                                                                                                                                    -Right(1).orElse(x => Right(2)); // ==> Either.Right(1)
                                                                                                                                                                                                                    -

                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                    A Number.

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                    A String.

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                    Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                                    {
                                                                                                                                                                                                                    -    Left(handler) {
                                                                                                                                                                                                                    -      assertFunction('Either.Left#orElse', handler);
                                                                                                                                                                                                                    -      return handler(this.value);
                                                                                                                                                                                                                    -    },
                                                                                                                                                                                                                    -
                                                                                                                                                                                                                    -    Right(handler) {
                                                                                                                                                                                                                    -      assertFunction('Either.Right#orElse', handler);
                                                                                                                                                                                                                    -      return this;
                                                                                                                                                                                                                    -    }
                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                    Stability
                                                                                                                                                                                                                    experimental
                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                    folktale/src/data/either/either
                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.swap.html b/docs/api/en/folktale.src.data.either.either.swap.html deleted file mode 100644 index c396c0f..0000000 --- a/docs/api/en/folktale.src.data.either.either.swap.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - swap - - - - - -

                                                                                                                                                                                                                      swap

                                                                                                                                                                                                                      Transform Lefts into Rights, and vice-versa.

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                      swap()
                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                      forall a, b: (Either a b).() => Either b a

                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                      Transform Lefts into Rights, and vice-versa.

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Example:

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      Left(1).swap();   // ==> Either.Right(1)
                                                                                                                                                                                                                      -Right(1).swap();  // ==> Either.Left(1)
                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                      A String.

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      Experimental
                                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                      Defined in src/data/either/either.js at line 48, column 19
                                                                                                                                                                                                                      {
                                                                                                                                                                                                                      -    Left() { 
                                                                                                                                                                                                                      -      return Right(this.value); 
                                                                                                                                                                                                                      -    },
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      -    Right() {
                                                                                                                                                                                                                      -      return Left(this.value);
                                                                                                                                                                                                                      -    }
                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                      Stability
                                                                                                                                                                                                                      experimental
                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                      folktale/src/data/either/either
                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.toMaybe.html b/docs/api/en/folktale.src.data.either.either.toMaybe.html deleted file mode 100644 index 9d9a65a..0000000 --- a/docs/api/en/folktale.src.data.either.either.toMaybe.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - toMaybe - - - - - -

                                                                                                                                                                                                                        toMaybe

                                                                                                                                                                                                                        Transforms an Either to a Maybe. Left values are lost in the process.

                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                        toMaybe()
                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                        forall a, b: (Either a b).() => Maybe b

                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                        Transforms an Either to a Maybe. Left values are lost in the process.

                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Example:

                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        const { Nothing, Just } = require('folktale/data/maybe');
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        -Either.Left(1).toMaybe();  // ==> Nothing()
                                                                                                                                                                                                                        -Either.Right(1).toMaybe(); // ==> Just(1)
                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                        A String.

                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        Experimental
                                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                        Defined in src/data/either/either.js at line 385, column 22
                                                                                                                                                                                                                        toMaybe() {
                                                                                                                                                                                                                        -    return require('folktale/data/conversions/either-to-maybe')(this);
                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                        Stability
                                                                                                                                                                                                                        experimental
                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                        folktale/src/data/either/either
                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.either.toValidation.html b/docs/api/en/folktale.src.data.either.either.toValidation.html deleted file mode 100644 index 9d114e9..0000000 --- a/docs/api/en/folktale.src.data.either.either.toValidation.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - toValidation - - - - - -

                                                                                                                                                                                                                          toValidation

                                                                                                                                                                                                                          Transforms an Either into a Validation.

                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                          toValidation()
                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                          forall a, b: (Either a b).() => Validation a b

                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                          Transforms an Either into a Validation.

                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Example:

                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          const { Failure, Success } = require('folktale/data/validation');
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          -Either.Left(1).toValidation();   // ==> Failure(1)
                                                                                                                                                                                                                          -Either.Right(1).toValidation();  // ==> Success(1)
                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                          A String.

                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          Experimental
                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                          Defined in src/data/either/either.js at line 385, column 22
                                                                                                                                                                                                                          toValidation() {
                                                                                                                                                                                                                          -    return require('folktale/data/conversions/either-to-validation')(this);
                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                          Stability
                                                                                                                                                                                                                          experimental
                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                          folktale/src/data/either/either
                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.fromJSON.html b/docs/api/en/folktale.src.data.either.fromJSON.html deleted file mode 100644 index f10cdd8..0000000 --- a/docs/api/en/folktale.src.data.either.fromJSON.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - fromJSON - - - - - -

                                                                                                                                                                                                                            fromJSON

                                                                                                                                                                                                                            Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                            fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)
                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                            type JSONSerialisation = {
                                                                                                                                                                                                                            -  "@@type":  String,
                                                                                                                                                                                                                            -  "@@tag":   String,
                                                                                                                                                                                                                            -  "@@value": Object Any
                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                            -type JSONParser = {
                                                                                                                                                                                                                            -  fromJSON: (JSONSerialisation, Array JSONParser) => Variant
                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            -(JSONSerialisation, Array JSONParser) => Variant

                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                            Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            Example:

                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            const { data, setoid } = require('folktale/core/adt');
                                                                                                                                                                                                                            -const Id = data('Id', {
                                                                                                                                                                                                                            -  Id(value){ return { value } }
                                                                                                                                                                                                                            -}).derive(serialize, setoid);
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            -Id.Id(1).toJSON();
                                                                                                                                                                                                                            -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            -Id.fromJSON(Id.Id(1).toJSON());
                                                                                                                                                                                                                            -// ==> Id.Id(1)
                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                            A Number.

                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            Experimental
                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                            function(value, parsers = { [typeName]: adt }, keysIndicateType = false) {
                                                                                                                                                                                                                            -    const valueTypeName = value[typeJsonKey];
                                                                                                                                                                                                                            -    const valueTagName = value[tagJsonKey];
                                                                                                                                                                                                                            -    const valueContents = value[valueJsonKey];
                                                                                                                                                                                                                            -    assertType(typeName, valueTypeName);
                                                                                                                                                                                                                            -    const parsersByType = keysIndicateType ? parsers
                                                                                                                                                                                                                            -          : /*otherwise*/                    indexByType(values(parsers));
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            -    const parsedValue = mapValues(valueContents, parseValue(parsersByType));
                                                                                                                                                                                                                            -    return Object.assign(Object.create(adt[valueTagName].prototype), parsedValue);
                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                            Stability
                                                                                                                                                                                                                            experimental
                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                            folktale/src/data/either
                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                            • @boris-marinov
                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.html b/docs/api/en/folktale.src.data.either.html deleted file mode 100644 index 8d08c2a..0000000 --- a/docs/api/en/folktale.src.data.either.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - module folktale/data/either - - - - - -

                                                                                                                                                                                                                              module folktale/data/either

                                                                                                                                                                                                                              Provides the Either data structure.

                                                                                                                                                                                                                              -

                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                              Provides the Either data structure.

                                                                                                                                                                                                                              -

                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                              Comparing and Testing

                                                                                                                                                                                                                              hasInstance(value)

                                                                                                                                                                                                                              Checks if a value belongs to this ADT.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Constructing

                                                                                                                                                                                                                              Left(value)

                                                                                                                                                                                                                              Constructs an Either containing a Left value.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental
                                                                                                                                                                                                                              Right(value)

                                                                                                                                                                                                                              Constructs an Either containing a Right value.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental
                                                                                                                                                                                                                              of(value)

                                                                                                                                                                                                                              Constructs an Either holding a Right value.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Converting

                                                                                                                                                                                                                              toMaybe()

                                                                                                                                                                                                                              Transforms an Either to a Maybe. Left values are lost in the process.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental
                                                                                                                                                                                                                              toValidation()

                                                                                                                                                                                                                              Transforms an Either into a Validation.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Converting from Maybe

                                                                                                                                                                                                                              fromMaybe: maybeToEither(aMaybe, failureValue)

                                                                                                                                                                                                                              Converts a Maybe to an Either. Nothings map to Lefts, Justs map to -Rights.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Converting from Validation

                                                                                                                                                                                                                              fromValidation: validationToEither(aValidation)

                                                                                                                                                                                                                              Converts a Validation to an Either. Failures map to Lefts, -Successes map to Rights.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Converting from nullables

                                                                                                                                                                                                                              fromNullable: nullableToEither(a)

                                                                                                                                                                                                                              Converts a nullable value to an either. null and undefined map to -Lefts, any other value maps to Rights.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Debug Representation

                                                                                                                                                                                                                              inspect: toString()

                                                                                                                                                                                                                              Returns a textual representation of the ADT.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental
                                                                                                                                                                                                                              toString()

                                                                                                                                                                                                                              Returns a textual representation of the ADT.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Fantasy Land

                                                                                                                                                                                                                              fantasy-land/of(value)

                                                                                                                                                                                                                              Fantasy Land's Applicative of

                                                                                                                                                                                                                              -

                                                                                                                                                                                                                              Handling exceptions

                                                                                                                                                                                                                              try: _try(f)

                                                                                                                                                                                                                              Runs a function that may raise an exception, trapping it, and returning -an Either representing the result.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Members

                                                                                                                                                                                                                              variants

                                                                                                                                                                                                                              The variants present in this ADT.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Serialisation

                                                                                                                                                                                                                              fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

                                                                                                                                                                                                                              Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                              Defined in src/data/either/index.js at line 20, column 0
                                                                                                                                                                                                                              {
                                                                                                                                                                                                                              -  ...require('./either'),
                                                                                                                                                                                                                              -  try: require('./try'),
                                                                                                                                                                                                                              -  fromNullable: require('folktale/data/conversions/nullable-to-either'),
                                                                                                                                                                                                                              -  fromValidation: require('folktale/data/conversions/validation-to-either'),
                                                                                                                                                                                                                              -  fromMaybe: require('folktale/data/conversions/maybe-to-either')
                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.inspect.html b/docs/api/en/folktale.src.data.either.inspect.html deleted file mode 100644 index 32094ac..0000000 --- a/docs/api/en/folktale.src.data.either.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

                                                                                                                                                                                                                              toString

                                                                                                                                                                                                                              Returns a textual representation of the ADT.

                                                                                                                                                                                                                              -

                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                              toString()
                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                              () => String

                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                              Returns a textual representation of the ADT.

                                                                                                                                                                                                                              -

                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                              () => typeName
                                                                                                                                                                                                                              Stability
                                                                                                                                                                                                                              experimental
                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                              folktale/src/data/either
                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                              • @boris-marinov
                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.either.try.try.html b/docs/api/en/folktale.src.data.either.try.try.html deleted file mode 100644 index 41b7b42..0000000 --- a/docs/api/en/folktale.src.data.either.try.try.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - _try - - - - - -

                                                                                                                                                                                                                                _try

                                                                                                                                                                                                                                Runs a function that may raise an exception, trapping it, and returning -an Either representing the result.

                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                _try(f)
                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                forall a, b: (() => b :: throws a) => Either a b

                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                Runs a function that may raise an exception, trapping it, and returning -an Either representing the result.

                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                function succ(nat) {
                                                                                                                                                                                                                                -  if (nat < 0) {
                                                                                                                                                                                                                                -    throw `Not a natural number: ${nat}`;
                                                                                                                                                                                                                                -  } else {
                                                                                                                                                                                                                                -    return nat + 1;
                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                -const { Left, Right } = require('folktale/data/either');
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                -_try(() => succ(-1));  // ==> Left('Not a natural number: -1')
                                                                                                                                                                                                                                -_try(() => succ(1));   // ==> Right(2)
                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                A Number.

                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                Experimental
                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                Defined in src/data/either/try.js at line 31, column 0
                                                                                                                                                                                                                                (f) => {
                                                                                                                                                                                                                                -  try {
                                                                                                                                                                                                                                -    return Right(f());
                                                                                                                                                                                                                                -  } catch (e) {
                                                                                                                                                                                                                                -    return Left(e);
                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                Stability
                                                                                                                                                                                                                                experimental
                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                folktale/src/data/either/try
                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                • @boris-marinov
                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._deferred._Deferred.html b/docs/api/en/folktale.src.data.future._deferred._Deferred.html deleted file mode 100644 index 0976cc6..0000000 --- a/docs/api/en/folktale.src.data.future._deferred._Deferred.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - Deferred - - - - - -

                                                                                                                                                                                                                                  Deferred

                                                                                                                                                                                                                                  Deferreds allow creating containers for eventual values.

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                  Deferred()

                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                  Deferreds allow creating containers for eventual values.

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  A deferred is a low-level structure to construct containers of -eventual values, and fill them with a value at a later point in -time. Most uses of deferred are better addressed by the Task -object.

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Example:

                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  const delay = (ms) => {
                                                                                                                                                                                                                                  -  const deferred = new Deferred();
                                                                                                                                                                                                                                  -  setTimeout(() => deferred.resolve(), ms);
                                                                                                                                                                                                                                  -  return deferred.promise();
                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  -delay(100).then(() => {
                                                                                                                                                                                                                                  -  // do something after 100 ms
                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Why not use Deferreds?

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  As mentioned above, a deferred is a low-level structure. While -it does allow cancellation and converting to a higher-level -structure (like Future or Promise), it does not provide important -facilities for asynchronous concurrency, like resource handling.

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  In this sense, a Task provides a simpler interface and more -guarantees for processes that must allocate resources and -collect them afterwards. For example, a cancellable delay -would look like this with a Task:

                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  const { task } = require('folktale/data/task');
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  -const delay = (ms) => task(resolver => {
                                                                                                                                                                                                                                  -  return setTimeout(() => resolver.resolve(), ms);
                                                                                                                                                                                                                                  -}, {
                                                                                                                                                                                                                                  -  onCancelled: (timer) => { clearTimeout(timer) }
                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  -const execution = delay(100).run();
                                                                                                                                                                                                                                  -execution.promise().then(() => {
                                                                                                                                                                                                                                  -  // do something after 100 ms
                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                  -execution.cancel(); // cancels the execution and collects the timer
                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                  Defined in src/data/future/_deferred.js at line 99, column 0
                                                                                                                                                                                                                                  function Deferred() {
                                                                                                                                                                                                                                  -  define(this, '_state', Pending());
                                                                                                                                                                                                                                  -  define(this, '_listeners', []);
                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                  folktale/src/data/future/_deferred
                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state.0.html b/docs/api/en/folktale.src.data.future._execution-state.0.html deleted file mode 100644 index 82826a3..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state.0.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Pending - - - - - -

                                                                                                                                                                                                                                    Pending

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                    Pending()

                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Static properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Internal

                                                                                                                                                                                                                                    get constructor

                                                                                                                                                                                                                                    The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    prototype

                                                                                                                                                                                                                                    The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    State and Configuration

                                                                                                                                                                                                                                    get tag

                                                                                                                                                                                                                                    The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    get type

                                                                                                                                                                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Instance (prototype) properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Comparing and testing

                                                                                                                                                                                                                                    equals(value)

                                                                                                                                                                                                                                    Compares two setoids structurally.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Extending ADTs

                                                                                                                                                                                                                                    derive(...derivations)

                                                                                                                                                                                                                                    Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    ExperimentalInherited

                                                                                                                                                                                                                                    Fantasy Land

                                                                                                                                                                                                                                    fantasy-land/equals(that)

                                                                                                                                                                                                                                    Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Members

                                                                                                                                                                                                                                    variants

                                                                                                                                                                                                                                    The variants present in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Testing and Comparing

                                                                                                                                                                                                                                    get isPending

                                                                                                                                                                                                                                    True if a value belongs to the ADT variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Deprecated

                                                                                                                                                                                                                                    Transforming

                                                                                                                                                                                                                                    matchWith(pattern)

                                                                                                                                                                                                                                    Selects an operation based on this Variant's tag.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                    Cancelled()

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Pending()

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Rejected(reason)

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Resolved(value)

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    constructor: Pending()

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                    Pending() {
                                                                                                                                                                                                                                    -    return {};
                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state.Cancelled.html b/docs/api/en/folktale.src.data.future._execution-state.Cancelled.html deleted file mode 100644 index fa61970..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state.Cancelled.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Cancelled - - - - - -

                                                                                                                                                                                                                                    Cancelled

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                    Cancelled()

                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Static properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Internal

                                                                                                                                                                                                                                    get constructor

                                                                                                                                                                                                                                    The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    prototype

                                                                                                                                                                                                                                    The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    State and Configuration

                                                                                                                                                                                                                                    get tag

                                                                                                                                                                                                                                    The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    get type

                                                                                                                                                                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Instance (prototype) properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Comparing and testing

                                                                                                                                                                                                                                    equals(value)

                                                                                                                                                                                                                                    Compares two setoids structurally.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Extending ADTs

                                                                                                                                                                                                                                    derive(...derivations)

                                                                                                                                                                                                                                    Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    ExperimentalInherited

                                                                                                                                                                                                                                    Fantasy Land

                                                                                                                                                                                                                                    fantasy-land/equals(that)

                                                                                                                                                                                                                                    Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Members

                                                                                                                                                                                                                                    variants

                                                                                                                                                                                                                                    The variants present in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Testing and Comparing

                                                                                                                                                                                                                                    get isCancelled

                                                                                                                                                                                                                                    True if a value belongs to the ADT variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Deprecated

                                                                                                                                                                                                                                    Transforming

                                                                                                                                                                                                                                    matchWith(pattern)

                                                                                                                                                                                                                                    Selects an operation based on this Variant's tag.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                    Cancelled()

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Pending()

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Rejected(reason)

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Resolved(value)

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    constructor: Cancelled()

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                    Cancelled() {
                                                                                                                                                                                                                                    -    return {};
                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state.Rejected.html b/docs/api/en/folktale.src.data.future._execution-state.Rejected.html deleted file mode 100644 index 1b51272..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state.Rejected.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Rejected - - - - - -

                                                                                                                                                                                                                                    Rejected

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                    Rejected(reason)

                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Static properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Internal

                                                                                                                                                                                                                                    get constructor

                                                                                                                                                                                                                                    The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    prototype

                                                                                                                                                                                                                                    The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    State and Configuration

                                                                                                                                                                                                                                    get tag

                                                                                                                                                                                                                                    The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    get type

                                                                                                                                                                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Instance (prototype) properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Comparing and testing

                                                                                                                                                                                                                                    equals(value)

                                                                                                                                                                                                                                    Compares two setoids structurally.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Extending ADTs

                                                                                                                                                                                                                                    derive(...derivations)

                                                                                                                                                                                                                                    Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    ExperimentalInherited

                                                                                                                                                                                                                                    Fantasy Land

                                                                                                                                                                                                                                    fantasy-land/equals(that)

                                                                                                                                                                                                                                    Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Members

                                                                                                                                                                                                                                    variants

                                                                                                                                                                                                                                    The variants present in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Testing and Comparing

                                                                                                                                                                                                                                    get isRejected

                                                                                                                                                                                                                                    True if a value belongs to the ADT variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Deprecated

                                                                                                                                                                                                                                    Transforming

                                                                                                                                                                                                                                    matchWith(pattern)

                                                                                                                                                                                                                                    Selects an operation based on this Variant's tag.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                    Cancelled()

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Pending()

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Rejected(reason)

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Resolved(value)

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    constructor: Rejected(reason)

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                    Rejected(reason) {
                                                                                                                                                                                                                                    -    return { reason };
                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state.Resolved.html b/docs/api/en/folktale.src.data.future._execution-state.Resolved.html deleted file mode 100644 index 330d691..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state.Resolved.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Resolved - - - - - -

                                                                                                                                                                                                                                    Resolved

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                    Resolved(value)

                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Static properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Internal

                                                                                                                                                                                                                                    get constructor

                                                                                                                                                                                                                                    The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    prototype

                                                                                                                                                                                                                                    The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    State and Configuration

                                                                                                                                                                                                                                    get tag

                                                                                                                                                                                                                                    The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    get type

                                                                                                                                                                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Instance (prototype) properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Comparing and testing

                                                                                                                                                                                                                                    equals(value)

                                                                                                                                                                                                                                    Compares two setoids structurally.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Extending ADTs

                                                                                                                                                                                                                                    derive(...derivations)

                                                                                                                                                                                                                                    Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    ExperimentalInherited

                                                                                                                                                                                                                                    Fantasy Land

                                                                                                                                                                                                                                    fantasy-land/equals(that)

                                                                                                                                                                                                                                    Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Members

                                                                                                                                                                                                                                    variants

                                                                                                                                                                                                                                    The variants present in this ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited

                                                                                                                                                                                                                                    Testing and Comparing

                                                                                                                                                                                                                                    get isResolved

                                                                                                                                                                                                                                    True if a value belongs to the ADT variant.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Deprecated

                                                                                                                                                                                                                                    Transforming

                                                                                                                                                                                                                                    matchWith(pattern)

                                                                                                                                                                                                                                    Selects an operation based on this Variant's tag.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                    Cancelled()

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Pending()

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Rejected(reason)

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    Resolved(value)

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Inherited
                                                                                                                                                                                                                                    constructor: Resolved(value)

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                    Resolved(value) {
                                                                                                                                                                                                                                    -    return { value };
                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state._ExecutionState.html b/docs/api/en/folktale.src.data.future._execution-state._ExecutionState.html deleted file mode 100644 index 01c09fc..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state._ExecutionState.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - ExecutionState - - - - - -

                                                                                                                                                                                                                                    ExecutionState

                                                                                                                                                                                                                                    Describes the current state of a task execution/deferred/future.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                    Describes the current state of a task execution/deferred/future.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                    Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                    Returns a textual representation of the ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                    Extending ADTs

                                                                                                                                                                                                                                    derive(...derivations)

                                                                                                                                                                                                                                    Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    ExperimentalInherited

                                                                                                                                                                                                                                    Members

                                                                                                                                                                                                                                    variants

                                                                                                                                                                                                                                    The variants present in this ADT.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                    Cancelled()

                                                                                                                                                                                                                                    Resolved as cancelled.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Pending()

                                                                                                                                                                                                                                    Not yet resolved.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Rejected(reason)

                                                                                                                                                                                                                                    Resolved as a failure, with a reason.

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Resolved(value)

                                                                                                                                                                                                                                    Resolved successfully, with a value.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                    Defined in src/data/future/_execution-state.js at line 19, column 0
                                                                                                                                                                                                                                    data('folktale:ExecutionState', {
                                                                                                                                                                                                                                    -  /*~
                                                                                                                                                                                                                                    -   * Not yet resolved.
                                                                                                                                                                                                                                    -   */
                                                                                                                                                                                                                                    -  Pending() {
                                                                                                                                                                                                                                    -    return {};
                                                                                                                                                                                                                                    -  },
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    -  /*~
                                                                                                                                                                                                                                    -   * Resolved as cancelled.
                                                                                                                                                                                                                                    -   */
                                                                                                                                                                                                                                    -  Cancelled() {
                                                                                                                                                                                                                                    -    return {};
                                                                                                                                                                                                                                    -  },
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    -  /*~
                                                                                                                                                                                                                                    -   * Resolved successfully, with a value.
                                                                                                                                                                                                                                    -   */
                                                                                                                                                                                                                                    -  Resolved(value) {
                                                                                                                                                                                                                                    -    return { value };
                                                                                                                                                                                                                                    -  },
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    -  /*~
                                                                                                                                                                                                                                    -   * Resolved as a failure, with a reason.
                                                                                                                                                                                                                                    -   */
                                                                                                                                                                                                                                    -  Rejected(reason) {
                                                                                                                                                                                                                                    -    return { reason };
                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                    -}).derive(show, setoid)
                                                                                                                                                                                                                                    Stability
                                                                                                                                                                                                                                    deprecated
                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                    folktale/src/data/future/_execution-state
                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state.constructor.html b/docs/api/en/folktale.src.data.future._execution-state.constructor.html deleted file mode 100644 index 68640a5..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state.constructor.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Pending - - - - - -

                                                                                                                                                                                                                                      Pending

                                                                                                                                                                                                                                      Not yet resolved.

                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                      Pending()

                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                      Not yet resolved.

                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                      Pending() {
                                                                                                                                                                                                                                      -    return {};
                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                      folktale/src/data/future/_execution-state
                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._execution-state.inspect.html b/docs/api/en/folktale.src.data.future._execution-state.inspect.html deleted file mode 100644 index 47034e2..0000000 --- a/docs/api/en/folktale.src.data.future._execution-state.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

                                                                                                                                                                                                                                        toString

                                                                                                                                                                                                                                        Returns a textual representation of the Variant.

                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                        toString()
                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                        () => String

                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                        Returns a textual representation of the Variant.

                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                        () => variantName
                                                                                                                                                                                                                                        Stability
                                                                                                                                                                                                                                        experimental
                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                        folktale/src/data/future/_execution-state
                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                        • @boris-marinov
                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._future._Future.html b/docs/api/en/folktale.src.data.future._future._Future.html deleted file mode 100644 index 3a6c477..0000000 --- a/docs/api/en/folktale.src.data.future._future._Future.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - Future - - - - - -

                                                                                                                                                                                                                                          Future

                                                                                                                                                                                                                                          Represents an eventual value, like Promise, but without a recursive -.then.

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                          Represents an eventual value, like Promise, but without a recursive -.then.

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          Note that Future only allows users to create resolved futures. In -order to create Futures that are resolved asynchronously one must -use the Deferred or Task objects.

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                          Constructing futures

                                                                                                                                                                                                                                          of(value)

                                                                                                                                                                                                                                          Constructs a future containing a successful value.

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          Experimental
                                                                                                                                                                                                                                          rejected(reason)

                                                                                                                                                                                                                                          Constructs a future containing a single rejected value.

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                          Fantasy Land

                                                                                                                                                                                                                                          ap(that)

                                                                                                                                                                                                                                          Fantasy Land's Apply ap

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          fantasy-land/ap(that)

                                                                                                                                                                                                                                          Fantasy Land's Apply ap

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          fantasy-land/of(value)

                                                                                                                                                                                                                                          Fantasy Land's Applicative of

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                          Defined in src/data/future/_future.js at line 32, column 0
                                                                                                                                                                                                                                          class Future {
                                                                                                                                                                                                                                          -  constructor() {
                                                                                                                                                                                                                                          -    define(this, '_state', Pending());
                                                                                                                                                                                                                                          -    define(this, '_listeners', []);
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  // ---[ State and configuration ]------------------------------------
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * The current state of the future.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * isRequired: true
                                                                                                                                                                                                                                          -   * category: State and configuration
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   get (Future 'f 's) => ExecutionState 'f 's
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  get _state() {
                                                                                                                                                                                                                                          -    throw new TypeError('Future.prototype._state should be implemented in an inherited object.');
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * A list of listeners to notify when the future is resolved.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * isRequired: true
                                                                                                                                                                                                                                          -   * category: State and configuration
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   get (Future 'f 's) => Array (DeferredListener 'f 's)
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  get _listeners() {
                                                                                                                                                                                                                                          -    throw new TypeError('Future.prototype._listeners should be implemented in an inherited object.');
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  // ---[ Reacting to Future events ]----------------------------------
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Attaches a listener to be invoked when the Future resolves.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const Future = require('folktale/data/future');
                                                                                                                                                                                                                                          -   *     let result = null;
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     Future.of(1).listen({
                                                                                                                                                                                                                                          -   *       onCancelled: ()      => { result = 'cancelled' },
                                                                                                                                                                                                                                          -   *       onResolved:  (value) => { result = `resolved: ${value}` },
                                                                                                                                                                                                                                          -   *       onRejected:  (value) => { result = `rejected: ${value}` }
                                                                                                                                                                                                                                          -   *     });
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     result; // ==> 'resolved: 1'
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Reacting to Future events
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(DeferredListener 'f 's) => Future 'f 's
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  listen(pattern) {
                                                                                                                                                                                                                                          -    this._state.matchWith({
                                                                                                                                                                                                                                          -      Pending:   ()           => this._listeners.push(pattern),
                                                                                                                                                                                                                                          -      Cancelled: ()           => pattern.onCancelled(), 
                                                                                                                                                                                                                                          -      Resolved:  ({ value })  => pattern.onResolved(value),
                                                                                                                                                                                                                                          -      Rejected:  ({ reason }) => pattern.onRejected(reason)
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -    return this;
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  // --[ Transforming Futures ]----------------------------------------
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Transforms resolved futures into new futures.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const Future = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     Future.of(1).chain(x => Future.of(x + 1));        // => Future.of(2)
                                                                                                                                                                                                                                          -   *     Future.rejected(1).chain(x => Future.of(x + 1));  // => Future.rejected(1)
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Transforming futures
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(('s) => Future 's2) => Future 'f 's2
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  chain(transformation) {
                                                                                                                                                                                                                                          -    let deferred = new Deferred();
                                                                                                                                                                                                                                          -    this.listen({
                                                                                                                                                                                                                                          -      onCancelled: ()     => deferred.cancel(),
                                                                                                                                                                                                                                          -      onRejected:  reason => deferred.reject(reason),
                                                                                                                                                                                                                                          -      onResolved:  value  => {
                                                                                                                                                                                                                                          -        transformation(value).listen({
                                                                                                                                                                                                                                          -          onCancelled: ()     => deferred.cancel(),
                                                                                                                                                                                                                                          -          onRejected:  reason => deferred.reject(reason),
                                                                                                                                                                                                                                          -          onResolved:  value2 => deferred.resolve(value2)
                                                                                                                                                                                                                                          -        });
                                                                                                                                                                                                                                          -      }
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -    return deferred.future();
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Transforms the value inside of a resolved future.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const Future = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     Future.of(1).map(x => x + 1);        // => Future.of(2)
                                                                                                                                                                                                                                          -   *     Future.rejected(1).map(x => x + 1);  // => Future.rejected(1)
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Transforming futures
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(('s) => 's2) => Future 'f 's2
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  map(transformation) {
                                                                                                                                                                                                                                          -    return this.chain(value => Future.of(transformation(value)));
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Applies a function contained in the future to the value of another future.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const Future = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const inc = (x) => x + 1;
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     Future.of(inc).apply(Future.of(1));        // => Future.of(2)
                                                                                                                                                                                                                                          -   *     Future.of(inc).apply(Future.rejected(1));  // => Future.rejected(1)
                                                                                                                                                                                                                                          -   *     Future.rejected(inc).apply(Future.of(1));  // => Future.rejected(inc)  
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Transforming futures
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(Future 'f (('s) => 's2)) => Future 'f 's2
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  apply(future) {
                                                                                                                                                                                                                                          -    return this.chain(fn => future.map(fn));
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Transforms the rejection or success of a future.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const Future = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const inc = (x) => x + 1;
                                                                                                                                                                                                                                          -   *     const dec = (x) => x - 1;
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     Future.of(1).bimap(inc, dec);        // => Future.of(dec(1))
                                                                                                                                                                                                                                          -   *     Future.rejected(1).bimap(inc, dec);  // => Future.rejected(inc(1))
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Transforming futures
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(('f) => 'f2, ('s) => 's2) => Future 'f2 's2
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  bimap(rejectionTransformation, successTransformation) {
                                                                                                                                                                                                                                          -    let deferred = new Deferred();
                                                                                                                                                                                                                                          -    this.listen({
                                                                                                                                                                                                                                          -      onCancelled: ()     => deferred.cancel(),
                                                                                                                                                                                                                                          -      onRejected:  reason => deferred.reject(rejectionTransformation(reason)),
                                                                                                                                                                                                                                          -      onResolved:  value  => deferred.resolve(successTransformation(value))
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -    return deferred.future();
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Transform the values of rejected futures.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const { of, rejected } = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     of(1).mapRejection(x => x + 1);        // => of(1)
                                                                                                                                                                                                                                          -   *     rejected(1).mapRejection(x => x + 1);  // => rejected(2)
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Transforming values
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(('f) => 'f2) => Future 'f2 's
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  mapRejection(transformation) {
                                                                                                                                                                                                                                          -    return this.bimap(transformation, x => x);
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  // ---[ Recovering from errors ]-------------------------------------
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Transforms a rejected future into a new future.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const { of, rejected } = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     of(1).recover(x => of(x + 1));             // => of(1)
                                                                                                                                                                                                                                          -   *     rejected(1).recover(x => of(x + 1));       // => of(2)
                                                                                                                                                                                                                                          -   *     rejected(1).recover(x => rejected(x + 1)); // => rejected(2)
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Recovering from errors
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).(('f) => Future 'f2 's2) => Future 'f2 's
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  recover(handler) {
                                                                                                                                                                                                                                          -    let deferred = new Deferred();
                                                                                                                                                                                                                                          -    this.listen({
                                                                                                                                                                                                                                          -      onCancelled: ()     => deferred.cancel(),
                                                                                                                                                                                                                                          -      onResolved:  value  => deferred.resolve(value),
                                                                                                                                                                                                                                          -      onRejected:  reason => {
                                                                                                                                                                                                                                          -        handler(reason).listen({
                                                                                                                                                                                                                                          -          onCancelled: ()        => deferred.cancel(),
                                                                                                                                                                                                                                          -          onResolved:  value     => deferred.resolve(value),
                                                                                                                                                                                                                                          -          onRejected:  newReason => deferred.reject(newReason)
                                                                                                                                                                                                                                          -        });
                                                                                                                                                                                                                                          -      }
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -    return deferred.future();
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Returns a future that eventually transforms its state by invoking
                                                                                                                                                                                                                                          -   * a function for that state. The function must return a new Future.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const { of, rejected } = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const pattern = {
                                                                                                                                                                                                                                          -   *       Cancelled: ()      => of('cancelled'),
                                                                                                                                                                                                                                          -   *       Resolved:  (value) => of(`resolved: ${value}`),
                                                                                                                                                                                                                                          -   *       Rejected:  (value) => of(`rejected: ${value}`)
                                                                                                                                                                                                                                          -   *     };
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     of(1).willMatchWith(pattern);        // => of('resolved: 1')
                                                                                                                                                                                                                                          -   *     rejected(1).willMatchWith(pattern);  // => of('rejected: 1')
                                                                                                                                                                                                                                          -   *  
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Pattern matching
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   forall a, b, c, d:
                                                                                                                                                                                                                                          -   *     type Pattern = { r |
                                                                                                                                                                                                                                          -   *       Cancelled: ()  => Future c d,
                                                                                                                                                                                                                                          -   *       Resolved:  (b) => Future c d,
                                                                                                                                                                                                                                          -   *       Rejected:  (a) => Future c d
                                                                                                                                                                                                                                          -   *     }
                                                                                                                                                                                                                                          -   *     
                                                                                                                                                                                                                                          -   *     (Future a b).(Pattern) => Future c d 
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  willMatchWith(pattern) {
                                                                                                                                                                                                                                          -    let deferred = new Deferred();
                                                                                                                                                                                                                                          -    const resolve = (handler) => (value) => handler(value).listen({
                                                                                                                                                                                                                                          -      onCancelled: ()       => deferred.cancel(),
                                                                                                                                                                                                                                          -      onResolved:  (value)  => deferred.resolve(value),
                                                                                                                                                                                                                                          -      onRejected:  (reason) => deferred.reject(reason) 
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -    this.listen({
                                                                                                                                                                                                                                          -      onCancelled: resolve(pattern.Cancelled),
                                                                                                                                                                                                                                          -      onResolved:  resolve(pattern.Resolved),
                                                                                                                                                                                                                                          -      onRejected:  resolve(pattern.Rejected)
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -    return deferred.future();
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Transforms rejected futures in successes, and vice-versa.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const { of, rejected } = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     of(1).swap();         // => rejected(1)
                                                                                                                                                                                                                                          -   *     rejected(1).swap();   // => of(1)
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Recovering from errors
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).() => Future 's 'f
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  swap() {
                                                                                                                                                                                                                                          -    let deferred = new Deferred();
                                                                                                                                                                                                                                          -    this.listen({
                                                                                                                                                                                                                                          -      onCancelled: ()     => deferred.cancel(),
                                                                                                                                                                                                                                          -      onRejected:  reason => deferred.resolve(reason),
                                                                                                                                                                                                                                          -      onResolved:  value  => deferred.reject(value) 
                                                                                                                                                                                                                                          -    });
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -    return deferred.future();
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  // ---[ Debugging ]--------------------------------------------------
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Returns a textual representation of this object for debugging.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ## Example::
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     const { of, rejected } = require('folktale/data/future');
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   *     of(1).toString(); 
                                                                                                                                                                                                                                          -   *     // ==> 'folktale:Future(folktale:ExecutionState.Resolved({ value: 1 }), 0 listeners)'
                                                                                                                                                                                                                                          -   *     
                                                                                                                                                                                                                                          -   *     rejected(1).toString();
                                                                                                                                                                                                                                          -   *     // ==> 'folktale:Future(folktale:ExecutionState.Rejected({ reason: 1 }), 0 listeners)'
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Debugging
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).() => String
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  toString() {
                                                                                                                                                                                                                                          -    const listeners = this._listeners.length;
                                                                                                                                                                                                                                          -    const state     = this._state;
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -    return `folktale:Future(${state}, ${listeners} listeners)`;
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -  /*~
                                                                                                                                                                                                                                          -   * Returns a textual representation of this object for Node's REPL.
                                                                                                                                                                                                                                          -   * 
                                                                                                                                                                                                                                          -   * ---
                                                                                                                                                                                                                                          -   * category: Debugging
                                                                                                                                                                                                                                          -   * stability: experimental
                                                                                                                                                                                                                                          -   * type: |
                                                                                                                                                                                                                                          -   *   (Future 'f 's).() => String
                                                                                                                                                                                                                                          -   */
                                                                                                                                                                                                                                          -  inspect() {
                                                                                                                                                                                                                                          -    return this.toString();
                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                          -}
                                                                                                                                                                                                                                          Stability
                                                                                                                                                                                                                                          experimental
                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                          folktale/src/data/future/_future
                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._future.of.html b/docs/api/en/folktale.src.data.future._future.of.html deleted file mode 100644 index 7abc823..0000000 --- a/docs/api/en/folktale.src.data.future._future.of.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - of - - - - - -

                                                                                                                                                                                                                                            of

                                                                                                                                                                                                                                            Constructs a future containing a successful value.

                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                            of(value)
                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                            forall a, b:
                                                                                                                                                                                                                                            -  (Future).(b) => Future a b

                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                            Constructs a future containing a successful value.

                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                            Defined in src/data/future/_future.js at line 382, column 22
                                                                                                                                                                                                                                            of(value) {
                                                                                                                                                                                                                                            -    let result = new Future();
                                                                                                                                                                                                                                            -    result._state = Resolved(value);
                                                                                                                                                                                                                                            -    return result;
                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                            Stability
                                                                                                                                                                                                                                            experimental
                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                            folktale/src/data/future/_future
                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future._future.rejected.html b/docs/api/en/folktale.src.data.future._future.rejected.html deleted file mode 100644 index 28357f7..0000000 --- a/docs/api/en/folktale.src.data.future._future.rejected.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - rejected - - - - - -

                                                                                                                                                                                                                                              rejected

                                                                                                                                                                                                                                              Constructs a future containing a single rejected value.

                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                              rejected(reason)
                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                              forall a, b: (Future).(a) => Future a b

                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                              Constructs a future containing a single rejected value.

                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                              Defined in src/data/future/_future.js at line 382, column 22
                                                                                                                                                                                                                                              rejected(reason) {
                                                                                                                                                                                                                                              -    let result = new Future();
                                                                                                                                                                                                                                              -    result._state = Rejected(reason);
                                                                                                                                                                                                                                              -    return result;
                                                                                                                                                                                                                                              -  }
                                                                                                                                                                                                                                              Stability
                                                                                                                                                                                                                                              experimental
                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                              folktale/src/data/future/_future
                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.future.html b/docs/api/en/folktale.src.data.future.html deleted file mode 100644 index 0980540..0000000 --- a/docs/api/en/folktale.src.data.future.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - module folktale/data/future - - - - - -

                                                                                                                                                                                                                                                module folktale/data/future

                                                                                                                                                                                                                                                Objects for working with eventual values.

                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                Objects for working with eventual values.

                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                Asynchronous concurrency

                                                                                                                                                                                                                                                _Future()

                                                                                                                                                                                                                                                Represents an eventual value, like Promise, but without a recursive -.then.

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                                Constructing futures

                                                                                                                                                                                                                                                of(value)

                                                                                                                                                                                                                                                Constructs a future containing a successful value.

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                Experimental
                                                                                                                                                                                                                                                rejected(reason)

                                                                                                                                                                                                                                                Constructs a future containing a single rejected value.

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                _Deferred: Deferred()

                                                                                                                                                                                                                                                Deferreds allow creating containers for eventual values.

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                _ExecutionState

                                                                                                                                                                                                                                                Describes the current state of a task execution/deferred/future.

                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                Defined in src/data/future/index.js at line 19, column 0
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                -  of: Future.of,
                                                                                                                                                                                                                                                -  rejected: Future.rejected,
                                                                                                                                                                                                                                                -  _Deferred: require('./_deferred'),
                                                                                                                                                                                                                                                -  _ExecutionState: require('./_execution-state'),
                                                                                                                                                                                                                                                -  _Future: Future
                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                Stability
                                                                                                                                                                                                                                                deprecated
                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                folktale/src/data/future
                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.html b/docs/api/en/folktale.src.data.html deleted file mode 100644 index b28aadd..0000000 --- a/docs/api/en/folktale.src.data.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - module folktale/data - - - - - -

                                                                                                                                                                                                                                                  module folktale/data

                                                                                                                                                                                                                                                  Implements common functional data structures in JavaScript.

                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                  Implements common functional data structures in JavaScript.

                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                  Asynchronous Concurrency

                                                                                                                                                                                                                                                  future

                                                                                                                                                                                                                                                  Objects for working with eventual values.

                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                  Converting data

                                                                                                                                                                                                                                                  conversions

                                                                                                                                                                                                                                                  Provides functions to convert from and to different data -structures.

                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                  Modelling failures

                                                                                                                                                                                                                                                  maybe

                                                                                                                                                                                                                                                  A data structure that models the presence or abscence of a value.

                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                  result

                                                                                                                                                                                                                                                  A data structure that models the result of operations that may fail. A Result -helps with representing errors and propagating them, giving users a more -controllable form of sequencing operations with the power of constructs like -try/catch.

                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                  Defined in src/data/index.js at line 17, column 0
                                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                                  -  conversions: require('./conversions'),
                                                                                                                                                                                                                                                  -  maybe: require('./maybe'),
                                                                                                                                                                                                                                                  -  result: require('./result'),
                                                                                                                                                                                                                                                  -  validation: require('./validation'),
                                                                                                                                                                                                                                                  -  future: require('./future'),
                                                                                                                                                                                                                                                  -  task: require('./task')
                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                  Stability
                                                                                                                                                                                                                                                  experimental
                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                  folktale/src/data
                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.Just.html b/docs/api/en/folktale.src.data.maybe.Just.html deleted file mode 100644 index ee6018f..0000000 --- a/docs/api/en/folktale.src.data.maybe.Just.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Just - - - - - -

                                                                                                                                                                                                                                                    Just

                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                    Just(value)
                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                    forall a: (a) => Maybe a

                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                    Constructs a Maybe value that represents a successful value (a Just).

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                    NOTE:
                                                                                                                                                                                                                                                    The provided value is stored as-given in the structure. If you want to -convert a nullable value (a value that may be null/undefined) to a Maybe -value, use the Maybe.fromNullable(value) function instead of -Maybe.Just(value).

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                    See the documentation for the Maybe structure to understand how to use this.

                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                    Comparing and Testing

                                                                                                                                                                                                                                                    hasInstance(value)

                                                                                                                                                                                                                                                    Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                    Debug Representation

                                                                                                                                                                                                                                                    inspect: toString()

                                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    Experimental
                                                                                                                                                                                                                                                    toString()

                                                                                                                                                                                                                                                    Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                                    Internal

                                                                                                                                                                                                                                                    get constructor

                                                                                                                                                                                                                                                    The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    prototype

                                                                                                                                                                                                                                                    The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                    State and Configuration

                                                                                                                                                                                                                                                    get tag

                                                                                                                                                                                                                                                    The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    get type

                                                                                                                                                                                                                                                    The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                    A String.

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                    Just(value) {
                                                                                                                                                                                                                                                    -    return { value };
                                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                                    Stability
                                                                                                                                                                                                                                                    deprecated
                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                    folktale/src/data/maybe
                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.Nothing.html b/docs/api/en/folktale.src.data.maybe.Nothing.html deleted file mode 100644 index 95ad94f..0000000 --- a/docs/api/en/folktale.src.data.maybe.Nothing.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Nothing - - - - - -

                                                                                                                                                                                                                                                      Nothing

                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                      Nothing()
                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                      forall a: () => Maybe a

                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                      Constructs a Maybe value that represents a failure (a Nothing).

                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                      See the documentation for the Maybe structure to understand how to use this.

                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                      Comparing and Testing

                                                                                                                                                                                                                                                      hasInstance(value)

                                                                                                                                                                                                                                                      Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                      Debug Representation

                                                                                                                                                                                                                                                      inspect: toString()

                                                                                                                                                                                                                                                      Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                      Experimental
                                                                                                                                                                                                                                                      toString()

                                                                                                                                                                                                                                                      Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                                                                      Internal

                                                                                                                                                                                                                                                      get constructor

                                                                                                                                                                                                                                                      The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                      prototype

                                                                                                                                                                                                                                                      The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                      State and Configuration

                                                                                                                                                                                                                                                      get tag

                                                                                                                                                                                                                                                      The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                      get type

                                                                                                                                                                                                                                                      The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                      A String.

                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                      Nothing() {
                                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                                      Stability
                                                                                                                                                                                                                                                      deprecated
                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                      folktale/src/data/maybe
                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.constructor.html b/docs/api/en/folktale.src.data.maybe.constructor.html deleted file mode 100644 index 27dbcc5..0000000 --- a/docs/api/en/folktale.src.data.maybe.constructor.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Just - - - - - -

                                                                                                                                                                                                                                                        Just

                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                        Just(value)
                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                        forall a: (a) => Maybe a

                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                        A Number.

                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                                                                        A String.

                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                        Just(value) {
                                                                                                                                                                                                                                                        -    return { value };
                                                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                        folktale/src/data/maybe
                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.fromJSON.html b/docs/api/en/folktale.src.data.maybe.fromJSON.html deleted file mode 100644 index 056b006..0000000 --- a/docs/api/en/folktale.src.data.maybe.fromJSON.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - fromJSON - - - - - -

                                                                                                                                                                                                                                                          fromJSON

                                                                                                                                                                                                                                                          Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                          fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          type JSONSerialisation = {
                                                                                                                                                                                                                                                          -  "@@type":  String,
                                                                                                                                                                                                                                                          -  "@@tag":   String,
                                                                                                                                                                                                                                                          -  "@@value": Object Any
                                                                                                                                                                                                                                                          -}
                                                                                                                                                                                                                                                          -type JSONParser = {
                                                                                                                                                                                                                                                          -  fromJSON: (JSONSerialisation, Array JSONParser) => Variant
                                                                                                                                                                                                                                                          -}
                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          -(JSONSerialisation, Array JSONParser) => Variant

                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                          Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                          Example:

                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          const { data, setoid } = require('folktale/core/adt');
                                                                                                                                                                                                                                                          -const Id = data('Id', {
                                                                                                                                                                                                                                                          -  Id(value){ return { value } }
                                                                                                                                                                                                                                                          -}).derive(serialize, setoid);
                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          -Id.Id(1).toJSON();
                                                                                                                                                                                                                                                          -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          -Id.fromJSON(Id.Id(1).toJSON());
                                                                                                                                                                                                                                                          -// ==> Id.Id(1)
                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                                          A Number.

                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          Experimental
                                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                          function(value, parsers = { [typeName]: adt }, keysIndicateType = false) {
                                                                                                                                                                                                                                                          -    const valueTypeName = value[typeJsonKey];
                                                                                                                                                                                                                                                          -    const valueTagName = value[tagJsonKey];
                                                                                                                                                                                                                                                          -    const valueContents = value[valueJsonKey];
                                                                                                                                                                                                                                                          -    assertType(typeName, valueTypeName);
                                                                                                                                                                                                                                                          -    const parsersByType = keysIndicateType ? parsers
                                                                                                                                                                                                                                                          -          : /*otherwise*/                    indexByType(values(parsers));
                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          -    const parsedValue = mapValues(valueContents, parseValue(parsersByType));
                                                                                                                                                                                                                                                          -    return Object.assign(Object.create(adt[valueTagName].prototype), parsedValue);
                                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                                          Stability
                                                                                                                                                                                                                                                          experimental
                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                          folktale/src/data/maybe
                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                          • @boris-marinov
                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.fromNullable.html b/docs/api/en/folktale.src.data.maybe.fromNullable.html deleted file mode 100644 index 67ea684..0000000 --- a/docs/api/en/folktale.src.data.maybe.fromNullable.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - fromNullable - - - - - -

                                                                                                                                                                                                                                                            fromNullable

                                                                                                                                                                                                                                                            A convenience method for the folktale/data/conversions/nullable-to-maybe module.

                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                            fromNullable(aNullable)
                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                            forall a: (a or void) => Maybe a

                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                            A convenience method for the folktale/data/conversions/nullable-to-maybe module.

                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                            Example:

                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                            const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                            -Maybe.fromNullable(1);
                                                                                                                                                                                                                                                            -// ==> Maybe.Just(1)
                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                            -Maybe.fromNullable(null);
                                                                                                                                                                                                                                                            -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                            -Maybe.fromNullable(undefined);
                                                                                                                                                                                                                                                            -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                            Defined in src/data/maybe/index.js
                                                                                                                                                                                                                                                            fromNullable(aNullable) {
                                                                                                                                                                                                                                                            -    return require('folktale/data/conversions/nullable-to-maybe')(aNullable);
                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                            folktale/src/data/maybe
                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.fromResult.html b/docs/api/en/folktale.src.data.maybe.fromResult.html deleted file mode 100644 index edacd34..0000000 --- a/docs/api/en/folktale.src.data.maybe.fromResult.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - fromResult - - - - - -

                                                                                                                                                                                                                                                              fromResult

                                                                                                                                                                                                                                                              A convenience method for the folktale/data/conversions/result-to-maybe module.

                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                              fromResult(aResult)
                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                              forall a, b: (Result a b) => Maybe b

                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                              A convenience method for the folktale/data/conversions/result-to-maybe module.

                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                              Note that Error values are discarded, since Nothing can't hold a value.

                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                              Example:

                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                              -const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              -Maybe.fromResult(Result.Ok(1));
                                                                                                                                                                                                                                                              -// ==> Maybe.Just(1)
                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              -Maybe.fromResult(Result.Error(1));
                                                                                                                                                                                                                                                              -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                              Defined in src/data/maybe/index.js
                                                                                                                                                                                                                                                              fromResult(aResult) {
                                                                                                                                                                                                                                                              -    return require('folktale/data/conversions/result-to-maybe')(aResult);
                                                                                                                                                                                                                                                              -  }
                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                              folktale/src/data/maybe
                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.fromValidation.html b/docs/api/en/folktale.src.data.maybe.fromValidation.html deleted file mode 100644 index 4ac882d..0000000 --- a/docs/api/en/folktale.src.data.maybe.fromValidation.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - fromValidation - - - - - -

                                                                                                                                                                                                                                                                fromValidation

                                                                                                                                                                                                                                                                A convenience method for the folktale/data/conversions/validation-to-maybe module.

                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                                                fromValidation(aValidation)
                                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                                forall a, b: (Validation a b) => Maybe b

                                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                                A convenience method for the folktale/data/conversions/validation-to-maybe module.

                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                Note that Failure values are discarded, since Nothing can't hold a value.

                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                -const Validation = require('folktale/data/validation');
                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                -Maybe.fromValidation(Validation.Success(1));
                                                                                                                                                                                                                                                                -// ==> Maybe.Just(1)
                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                -Maybe.fromValidation(Validation.Failure(1));
                                                                                                                                                                                                                                                                -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                                Defined in src/data/maybe/index.js
                                                                                                                                                                                                                                                                fromValidation(aValidation) {
                                                                                                                                                                                                                                                                -    return require('folktale/data/conversions/validation-to-maybe')(aValidation);
                                                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                                folktale/src/data/maybe
                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.html b/docs/api/en/folktale.src.data.maybe.html deleted file mode 100644 index 21b305c..0000000 --- a/docs/api/en/folktale.src.data.maybe.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - module folktale/data/maybe - - - - - -

                                                                                                                                                                                                                                                                  module folktale/data/maybe

                                                                                                                                                                                                                                                                  A data structure that models the presence or abscence of a value.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                  A data structure that models the presence or abscence of a value.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Example:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -const find = (list, predicate) => {
                                                                                                                                                                                                                                                                  -  for (var i = 0; i < list.length; ++i) {
                                                                                                                                                                                                                                                                  -    const item = list[i];
                                                                                                                                                                                                                                                                  -    if (predicate(item)) {
                                                                                                                                                                                                                                                                  -      return Maybe.Just(item);
                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                  -  return Maybe.Nothing();
                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -find([1, 2, 3], (x) => x > 2); // ==> Maybe.Just(3)
                                                                                                                                                                                                                                                                  -find([1, 2, 3], (x) => x > 3); // ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Why use Maybe?

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Some functions can always return a sensible result for all arguments that -they're given. For example, the successor function on natural numbers can -always give back a valid result, regardless of which natural number we give it. -These functions are easier to understand because their results are more -predictable, and we don't have to worry about errors.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Not all functions have this property (of being total), though. Functions like -“find an item in this list” or “look up this key in that hashtable” don't always -have an answer, and so one has to think about how they deal with the cases where -the answer is not there. We have to be able to provide some kind of answer -to the programmer, otherwise the program can't continue — that is, not -providing an answer is the equivalent of throwing an exception.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  In most languages, things like “find an item in this list” will return null -(or the equivalent “not an object”) when the item can't be found, but what if -you had a null in th list? In others, you can only ask the question “find me -the index of this item in that list”, and when one index can't be found it -answers -1, assuming a 0-based indexed structure. But, again, what if I have -an indexed structure where -1 is a valid index?

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Really these questions require two answers: “is the item there?”, and if so, -“what is the item?”, and we often need to test for those answers separately. -Maybe is a data structure that helps answering these questions. A Maybe -structure has two cases:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                  • Just(value) — represents the presence of an answer, and what the answer -is.
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  • Nothing() — represents the absence of an answer.
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  If we have maybe, we can change our code from:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const find1 = (list, predicate) => {
                                                                                                                                                                                                                                                                  -  for (var i = 0; i < list.length; ++i) {
                                                                                                                                                                                                                                                                  -    const item = list[i];
                                                                                                                                                                                                                                                                  -    if (predicate(item)) {
                                                                                                                                                                                                                                                                  -      return item;
                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                  -  return null;
                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -find1([1, 2, 3], (x) => x > 2); // ==> 3
                                                                                                                                                                                                                                                                  -find1([1, 2, 3], (x) => x > 3); // ==> null
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  To:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -const find2 = (list, predicate) => {
                                                                                                                                                                                                                                                                  -  for (var i = 0; i < list.length; ++i) {
                                                                                                                                                                                                                                                                  -    const item = list[i];
                                                                                                                                                                                                                                                                  -    if (predicate(item)) {
                                                                                                                                                                                                                                                                  -      return Maybe.Just(item);
                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                  -  return Maybe.Nothing();
                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -find2([1, 2, 3], (x) => x > 2); // ==> Maybe.Just(3)
                                                                                                                                                                                                                                                                  -find2([1, 2, 3], (x) => x > 3); // ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  This has the advantage that it's always possible to determine whether a function -failed or not. For example, if we run find1([null], x => true), then it'll -return null, but if we run find1([null], x => false) it'll also return -null! On the other hand, running find2([null], x => true) returns -Maybe.Just(null), and find2([null], x => false) returns Maybe.Nothing(). -They're different values that can be tested.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Another advantage of using a maybe value for these situations is that, since the -return value is wrapped, the user of that function is forced to acknowledge the -possibility of an error, as the value can't be used directly.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Working with Maybe values

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Last section shows how to create Maybe values, but how do we use them? A value -wrapped in a Maybe can't be used directly, so using these values is a bit more -of work. Folktale's Maybe structure provides methods to help with this, and they -can be divided roughly into 3 categories:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                  • Extracting values: Sometimes we need to pass the value into things that -don't really know what a Maybe is, so we have to somehow extract the value -out of the structure. These methods help with that.

                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  • Transforming values: Sometimes we get a Maybe value that doesn't quite -have the value we're looking for. We don't really want to change the status -of the computation (failures should continue to be failures, successes -should continue to be successes), but we'd like to tweak the resulting -value a bit. This is the equivalent of applying functions in an expression.

                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  • Sequencing computations: A Maybe is the result of a computation that can -fail. Sometimes we want to run several computations that may fail in -sequence, and these methods help with that. This is roughly the equivalent -of ; in imperative programming, where the next instruction is only -executed if the previous instruction succeeds.

                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  We'll see each of these categories in more details below.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Extracting values

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  If we're wrapping a value in a Maybe, then we can use the value by extracting it -from that container. Folktale lets you do this through the getOrElse(default) -method:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function get(object, key) {
                                                                                                                                                                                                                                                                  -  return key in object ?  Maybe.Just(object[key])
                                                                                                                                                                                                                                                                  -  :      /* otherwise */  Maybe.Nothing();
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -const config = {
                                                                                                                                                                                                                                                                  -  host: '0.0.0.0'
                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -const host = get(config, 'host').getOrElse('localhost');
                                                                                                                                                                                                                                                                  -const port = get(config, 'port').getOrElse(8080);
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -`${host}:${port}`; // ==> '0.0.0.0:8080'
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  This works well if the only error handling we need to do is providing a default -value, which is a fairly common scenario when working with Maybe values. For -more advanced error handling Folktale provides more powerful methods that are -described later in this document.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Transforming values

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Sometimes we want to keep the context of the computation (whether it has failed -or succeeded), but we want to tweak the value a little bit. For example, suppose -you're trying to render the first item of a list, which involves generating some -UI elements with the data from that object, but the list can be empty so you -have to handle that error first. We can't use getOrElse() here because if we -have an error, we don't want to render that error in the same way. Instead, we -can use map(transformation) to apply our rendering logic only to successful -values:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function first(list) {
                                                                                                                                                                                                                                                                  -  return list.length > 0 ?  Maybe.Just(list[0])
                                                                                                                                                                                                                                                                  -  :      /* otherwise */    Maybe.Nothing();
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function render(item) {
                                                                                                                                                                                                                                                                  -  return ['item', ['title', item.title]];
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([{ title: 'Hello' }]).map(render);
                                                                                                                                                                                                                                                                  -// => Maybe.Just(['item', ['title', 'Hello']])
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([]).map(render);
                                                                                                                                                                                                                                                                  -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Sequencing computations

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Sometimes the functions we want to use to transform the value can also fail. We -can't just use .map() here since that'd put the resulting Maybe inside of -another Maybe value:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function first(list) {
                                                                                                                                                                                                                                                                  -  return list.length > 0 ?  Maybe.Just(list[0])
                                                                                                                                                                                                                                                                  -  :      /* otherwise */    Maybe.Nothing();
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function second(list) {
                                                                                                                                                                                                                                                                  -  return list.length > 1 ?  Maybe.Just(list[1])
                                                                                                                                                                                                                                                                  -  :      /* otherwise */    Maybe.Nothing();
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function render(item) {
                                                                                                                                                                                                                                                                  -  return ['item', ['title', item.title]];
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([{ title: 'Hello' }]).map(render);
                                                                                                                                                                                                                                                                  -// => Maybe.Just(['item', ['title', 'Hello']])
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([{ title: 'Hello' }]).map(render)
                                                                                                                                                                                                                                                                  -                           .map(second);
                                                                                                                                                                                                                                                                  -// => Maybe.Just(Maybe.Just(['title', 'Hello']))
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Ideally we'd like to get back Maybe.Just(['title', 'Hello']), but .map() -isn't the method for that. Instead, we can use the .chain() method. .chain() -is a method that operates on Maybe values, and expects a function that also -returns a Maybe value. This return value is then considered the whole result of -the operation. Like .map(), .chain() only applies its function argument to -Just cases:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  first([{ title: 'Hello' }]).map(render)
                                                                                                                                                                                                                                                                  -                           .chain(second);
                                                                                                                                                                                                                                                                  -// => Maybe.Just(['title', 'Hello'])
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([]).map(render).chain(second);
                                                                                                                                                                                                                                                                  -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Error handling

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  So far we've seen how to use values that are wrapped in a Maybe, but if the -purpose of this structure is to represent something that might have failed, how -do we handle those failures?

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Well, a simple form of error handling is the .getOrElse(default) method, -covered in the previous sections, which allows us to extract a value from the -Maybe structure, if it exists, or get a default value otherwise.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  This doesn't help much if we need to do something in response to a failure, -though. So, instead, we have the .orElse(handler) method, which behaves quite -similarly to the .chain() method covered previously, except it executes its -handler on Nothings, rather than on Justs. We can use this to recover from -errors:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function first(list) {
                                                                                                                                                                                                                                                                  -  return list.length > 0 ?  Maybe.Just(list[0])
                                                                                                                                                                                                                                                                  -  :      /* otherwise */    Maybe.Nothing();
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -let nextId = 1;
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function issueError() {
                                                                                                                                                                                                                                                                  -  return Maybe.Just(`Error #${nextId++}`);
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([1]).orElse(issueError);
                                                                                                                                                                                                                                                                  -// ==> Maybe.Just(1)
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([]).orElse(issueError);
                                                                                                                                                                                                                                                                  -// ==> Maybe.Just('Error #1') 
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Note that the major difference between this and .getOrElse() is that the -handler function only gets ran on failure, whereas the expression in -.getOrElse() is always executed:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  nextId; // ==> 2
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([1]).getOrElse(issueError());
                                                                                                                                                                                                                                                                  -// ==> 1
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -nextId; // ==> 3
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Pattern matching

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  As with other union structures in Folktale, Maybe provides a .matchWith() -method to perform a limited form of pattern matching. Pattern matching allows -one to specify a piece of code for each case in a structure, like an if/else -or switch, but specific to that structure.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  We could use .matchWith() to run different computations depending on whether a -Maybe value represents a success or a failure, for example, without the -requirement of having to return a Maybe:

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -function first(list) {
                                                                                                                                                                                                                                                                  -  return list.length > 0 ?  Maybe.Just(list[0])
                                                                                                                                                                                                                                                                  -  :      /* otherwise */    Maybe.Nothing();
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([1]).matchWith({
                                                                                                                                                                                                                                                                  -  Just: ({ value }) => `Found: ${value}`,
                                                                                                                                                                                                                                                                  -  Nothing: () => 'Nothing was found'
                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                  -// ==> 'Found: 1'
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -first([]).matchWith({
                                                                                                                                                                                                                                                                  -  Just: ({ value }) => `Found: ${value}`,
                                                                                                                                                                                                                                                                  -  Nothing: () => 'Nothing was found'
                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                  -// ==> 'Nothing was found'
                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                  Comparing and Testing

                                                                                                                                                                                                                                                                  hasInstance(value)

                                                                                                                                                                                                                                                                  Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Constructing

                                                                                                                                                                                                                                                                  Just(value)

                                                                                                                                                                                                                                                                  Constructs a Maybe value that represents a successful value (a Just).

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  Nothing()

                                                                                                                                                                                                                                                                  Constructs a Maybe value that represents a failure (a Nothing).

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  of(value)

                                                                                                                                                                                                                                                                  Constructs a Maybe value that represents a successful value (a Just).

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Converting from other types

                                                                                                                                                                                                                                                                  fromNullable(aNullable)

                                                                                                                                                                                                                                                                  A convenience method for the folktale/data/conversions/nullable-to-maybe module.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  fromResult(aResult)

                                                                                                                                                                                                                                                                  A convenience method for the folktale/data/conversions/result-to-maybe module.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  fromValidation(aValidation)

                                                                                                                                                                                                                                                                  A convenience method for the folktale/data/conversions/validation-to-maybe module.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Converting to other types

                                                                                                                                                                                                                                                                  toResult(fallbackValue)

                                                                                                                                                                                                                                                                  A convenience method for the folktale/data/conversions/maybe-to-result module.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  toValidation(fallbackValue)

                                                                                                                                                                                                                                                                  A convenience method for the folktale/data/conversions/maybe-to-validation module.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Debug Representation

                                                                                                                                                                                                                                                                  inspect: toString()

                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                  toString()

                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                  Extracting values

                                                                                                                                                                                                                                                                  get()

                                                                                                                                                                                                                                                                  This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  Deprecated

                                                                                                                                                                                                                                                                  Fantasy Land

                                                                                                                                                                                                                                                                  fantasy-land/of(value)

                                                                                                                                                                                                                                                                  Fantasy Land's Applicative of

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Members

                                                                                                                                                                                                                                                                  variants

                                                                                                                                                                                                                                                                  The variants present in this ADT.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Serialisation

                                                                                                                                                                                                                                                                  fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

                                                                                                                                                                                                                                                                  Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                  Defined in src/data/maybe/index.js at line 18, column 0
                                                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                                                  -  ...require('./maybe'),
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -  /*~
                                                                                                                                                                                                                                                                  -   * ---
                                                                                                                                                                                                                                                                  -   * category: Converting from other types
                                                                                                                                                                                                                                                                  -   * type: |
                                                                                                                                                                                                                                                                  -   *   forall a: (a or void) => Maybe a
                                                                                                                                                                                                                                                                  -   */
                                                                                                                                                                                                                                                                  -  fromNullable(aNullable) {
                                                                                                                                                                                                                                                                  -    return require('folktale/data/conversions/nullable-to-maybe')(aNullable);
                                                                                                                                                                                                                                                                  -  },
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -  /*~
                                                                                                                                                                                                                                                                  -   * ---
                                                                                                                                                                                                                                                                  -   * category: Converting from other types
                                                                                                                                                                                                                                                                  -   * type: |
                                                                                                                                                                                                                                                                  -   *   forall a, b: (Result a b) => Maybe b
                                                                                                                                                                                                                                                                  -   */
                                                                                                                                                                                                                                                                  -  fromResult(aResult) {
                                                                                                                                                                                                                                                                  -    return require('folktale/data/conversions/result-to-maybe')(aResult);
                                                                                                                                                                                                                                                                  -  },
                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  -  /*~
                                                                                                                                                                                                                                                                  -   * ---
                                                                                                                                                                                                                                                                  -   * category: Converting from other types
                                                                                                                                                                                                                                                                  -   * type: |
                                                                                                                                                                                                                                                                  -   *   forall a, b: (Validation a b) => Maybe b
                                                                                                                                                                                                                                                                  -   */
                                                                                                                                                                                                                                                                  -  fromValidation(aValidation) {
                                                                                                                                                                                                                                                                  -    return require('folktale/data/conversions/validation-to-maybe')(aValidation);
                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.inspect.html b/docs/api/en/folktale.src.data.maybe.inspect.html deleted file mode 100644 index d0cf230..0000000 --- a/docs/api/en/folktale.src.data.maybe.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

                                                                                                                                                                                                                                                                  toString

                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                  toString()
                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                  () => String

                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                  () => typeName
                                                                                                                                                                                                                                                                  Stability
                                                                                                                                                                                                                                                                  experimental
                                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                                  folktale/src/data/maybe
                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                  • @boris-marinov
                                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.apply.html b/docs/api/en/folktale.src.data.maybe.maybe.apply.html deleted file mode 100644 index 0801547..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.apply.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - apply - - - - - -

                                                                                                                                                                                                                                                                    apply

                                                                                                                                                                                                                                                                    Transforms a Maybe value using a function contained in another Maybe. As with -.map(), the Maybe values are expected to be Just, and no operation is -performed if any of them is a Nothing.

                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                                    apply(aMaybe)
                                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                                    forall a, b: (Maybe (a) => b).(Maybe a) => Maybe b

                                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                                    Transforms a Maybe value using a function contained in another Maybe. As with -.map(), the Maybe values are expected to be Just, and no operation is -performed if any of them is a Nothing.

                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                    Example:

                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    -function increment(value) {
                                                                                                                                                                                                                                                                    -  return value + 1;
                                                                                                                                                                                                                                                                    -}
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    -Maybe.Just(increment).apply(Maybe.Just(1));
                                                                                                                                                                                                                                                                    -// ==> Maybe.Just(2)
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    -Maybe.Just(increment).apply(Maybe.Nothing());
                                                                                                                                                                                                                                                                    -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    -Maybe.Nothing().apply(Maybe.Just(1));
                                                                                                                                                                                                                                                                    -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                                    Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                    -    /*~
                                                                                                                                                                                                                                                                    -     */
                                                                                                                                                                                                                                                                    -    Nothing(aMaybe) {
                                                                                                                                                                                                                                                                    -      assertMaybe('Maybe.Nothing#apply', aMaybe);
                                                                                                                                                                                                                                                                    -      return this;
                                                                                                                                                                                                                                                                    -    },
                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    -    /*~
                                                                                                                                                                                                                                                                    -     */
                                                                                                                                                                                                                                                                    -    Just(aMaybe) {
                                                                                                                                                                                                                                                                    -      assertMaybe('Maybe.Just#apply', aMaybe);
                                                                                                                                                                                                                                                                    -      return aMaybe.map(this.value);
                                                                                                                                                                                                                                                                    -    }
                                                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                                    folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.cata.html b/docs/api/en/folktale.src.data.maybe.maybe.cata.html deleted file mode 100644 index 817e1c5..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.cata.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - cata - - - - - -

                                                                                                                                                                                                                                                                      cata

                                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                                      cata(pattern)
                                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                                      forall a, b:
                                                                                                                                                                                                                                                                      -  (Maybe a).({
                                                                                                                                                                                                                                                                      -    Nothing: () => b,
                                                                                                                                                                                                                                                                      -    Just: (a) => b
                                                                                                                                                                                                                                                                      -  }) => b

                                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                                      Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                      -    /*~
                                                                                                                                                                                                                                                                      -     */
                                                                                                                                                                                                                                                                      -    Nothing(pattern) {
                                                                                                                                                                                                                                                                      -      warnDeprecation('`.cata(pattern)` is deprecated. Use `.matchWith(pattern)` instead.');
                                                                                                                                                                                                                                                                      -      return pattern.Nothing();
                                                                                                                                                                                                                                                                      -    },
                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                      -    /*~
                                                                                                                                                                                                                                                                      -     */
                                                                                                                                                                                                                                                                      -    Just(pattern) {
                                                                                                                                                                                                                                                                      -      warnDeprecation('`.cata(pattern)` is deprecated. Use `.matchWith(pattern)` instead.');
                                                                                                                                                                                                                                                                      -      return pattern.Just(this.value);
                                                                                                                                                                                                                                                                      -    }
                                                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                                      folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.chain.html b/docs/api/en/folktale.src.data.maybe.maybe.chain.html deleted file mode 100644 index 03e57e0..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.chain.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - chain - - - - - -

                                                                                                                                                                                                                                                                        chain

                                                                                                                                                                                                                                                                        Transforms an entire Maybe structure with the provided function. As with -.map(), the transformation is only applied if the value is a Just, but -unlike .map() the transformation is expected to return a new Maybe value.

                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                                        chain(transformation)
                                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                                        forall a, b: (Maybe a).((a) => Maybe b) => Maybe b

                                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                                        Transforms an entire Maybe structure with the provided function. As with -.map(), the transformation is only applied if the value is a Just, but -unlike .map() the transformation is expected to return a new Maybe value.

                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                        Having the transformation function return a new Maybe value means that the -transformation may fail, and the failure is appropriately propagated. In this -sense, a.chain(f) works similarly to the sequencing of statements done by the -; syntax in JavaScript — the next instruction only runs if the previous -instruction succeeds, and either instructions may fail.

                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                        Example:

                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                        const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                        -function first(list) {
                                                                                                                                                                                                                                                                        -  return list.length > 0 ?  Maybe.Just(list[0])
                                                                                                                                                                                                                                                                        -  :      /* otherwise */    Maybe.Nothing();
                                                                                                                                                                                                                                                                        -}
                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                        -first([]).chain(first);
                                                                                                                                                                                                                                                                        -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                        -first([[1]]).chain(first);
                                                                                                                                                                                                                                                                        -// ==> Maybe.Just(1)
                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                        -first([[]]).chain(first);
                                                                                                                                                                                                                                                                        -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                                        Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                        -    /*~
                                                                                                                                                                                                                                                                        -     */
                                                                                                                                                                                                                                                                        -    Nothing(transformation) {
                                                                                                                                                                                                                                                                        -      assertFunction('Maybe.Nothing#chain', transformation);
                                                                                                                                                                                                                                                                        -      return this;
                                                                                                                                                                                                                                                                        -    },
                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                        -    /*~
                                                                                                                                                                                                                                                                        -     */
                                                                                                                                                                                                                                                                        -    Just(transformation) {
                                                                                                                                                                                                                                                                        -      assertFunction('Maybe.Just#chain', transformation);
                                                                                                                                                                                                                                                                        -      return transformation(this.value);
                                                                                                                                                                                                                                                                        -    }
                                                                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                                        folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.get.html b/docs/api/en/folktale.src.data.maybe.maybe.get.html deleted file mode 100644 index daa78c6..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.get.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - get - - - - - -

                                                                                                                                                                                                                                                                          get

                                                                                                                                                                                                                                                                          This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                                          get()
                                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                                          forall a: (Maybe a).() => a :: (throws TypeError)
                                                                                                                                                                                                                                                                          Deprecated since 2.0.0

                                                                                                                                                                                                                                                                          We want to discourage the use of partial functions, and having short names -makes it easy for people to want to use them without thinking about the -problems.

                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                          For more details see https://github.com/origamitower/folktale/issues/42

                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                                          This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                                          Defined in src/data/maybe/maybe.js at line 238, column 21
                                                                                                                                                                                                                                                                          'get'() {
                                                                                                                                                                                                                                                                          -    warnDeprecation('`.get()` is deprecated, and has been renamed to `.unsafeGet()`.');
                                                                                                                                                                                                                                                                          -    return this.unsafeGet();
                                                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                                                          Stability
                                                                                                                                                                                                                                                                          deprecated
                                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                                          folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.getOrElse.html b/docs/api/en/folktale.src.data.maybe.maybe.getOrElse.html deleted file mode 100644 index f6ba970..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.getOrElse.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - getOrElse - - - - - -

                                                                                                                                                                                                                                                                            getOrElse

                                                                                                                                                                                                                                                                            Extracts the value of a Maybe structure, if it exists (i.e.: is a Just), -otherwise returns the provided default value.

                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                                            getOrElse(default)
                                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                                            forall a: (Maybe a).(a) => a

                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                            Extracts the value of a Maybe structure, if it exists (i.e.: is a Just), -otherwise returns the provided default value.

                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                            Example:

                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                            const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                            -Maybe.Just(1).getOrElse(2);   // ==> 1
                                                                                                                                                                                                                                                                            -Maybe.Nothing().getOrElse(2); // ==> 2
                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                            Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                            -    /*~
                                                                                                                                                                                                                                                                            -     */
                                                                                                                                                                                                                                                                            -    Nothing(default_) {
                                                                                                                                                                                                                                                                            -      return default_;
                                                                                                                                                                                                                                                                            -    },
                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                            -    /*~
                                                                                                                                                                                                                                                                            -     */
                                                                                                                                                                                                                                                                            -    Just(default_) {
                                                                                                                                                                                                                                                                            -      return this.value;
                                                                                                                                                                                                                                                                            -    }
                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                                            folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.map.html b/docs/api/en/folktale.src.data.maybe.maybe.map.html deleted file mode 100644 index 8213d76..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.map.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - map - - - - - -

                                                                                                                                                                                                                                                                              map

                                                                                                                                                                                                                                                                              Transforms the value inside a Maybe structure with an unary function. Only -transforms values that are successful (Just), and constructs a new Maybe as a -result.

                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                                              map(transformation)
                                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                                              forall a, b: (Maybe a).((a) => b) => Maybe b

                                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                                              Transforms the value inside a Maybe structure with an unary function. Only -transforms values that are successful (Just), and constructs a new Maybe as a -result.

                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                              Example:

                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                              const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                              -function increment(value) {
                                                                                                                                                                                                                                                                              -  return value + 1;
                                                                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                              -Maybe.Just(1).map(increment);
                                                                                                                                                                                                                                                                              -// ==> Maybe.Just(2)
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                              -Maybe.Nothing().map(increment);
                                                                                                                                                                                                                                                                              -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                                              Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                                                              -    /*~
                                                                                                                                                                                                                                                                              -     */
                                                                                                                                                                                                                                                                              -    Nothing(transformation) {
                                                                                                                                                                                                                                                                              -      assertFunction('Maybe.Nothing#map', transformation);
                                                                                                                                                                                                                                                                              -      return this;
                                                                                                                                                                                                                                                                              -    },
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                              -    /*~
                                                                                                                                                                                                                                                                              -     */
                                                                                                                                                                                                                                                                              -    Just(transformation) {
                                                                                                                                                                                                                                                                              -      assertFunction('Maybe.Just#map', transformation);
                                                                                                                                                                                                                                                                              -      return Just(transformation(this.value));
                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                              -  }
                                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                                              folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.of.html b/docs/api/en/folktale.src.data.maybe.maybe.of.html deleted file mode 100644 index dbcc7d0..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.of.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - of - - - - - -

                                                                                                                                                                                                                                                                                of

                                                                                                                                                                                                                                                                                Constructs a Maybe value that represents a successful value (a Just).

                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                                                                of(value)
                                                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                                                forall a: (a) => Maybe a

                                                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                                                Constructs a Maybe value that represents a successful value (a Just).

                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                NOTE:
                                                                                                                                                                                                                                                                                The provided value is stored as-given in the structure. If you want to -convert a nullable value (a value that may be null/undefined) to a Maybe -value, use the Maybe.fromNullable(value) function instead of -Maybe.of(value).

                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                See the documentation for the Maybe structure to understand how to use this.

                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                                                Defined in src/data/maybe/maybe.js at line 238, column 21
                                                                                                                                                                                                                                                                                of(value) {
                                                                                                                                                                                                                                                                                -    return Just(value);
                                                                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                                                folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.orElse.html b/docs/api/en/folktale.src.data.maybe.maybe.orElse.html deleted file mode 100644 index d402090..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.orElse.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - orElse - - - - - -

                                                                                                                                                                                                                                                                                  orElse

                                                                                                                                                                                                                                                                                  Allows recovering from from failed Maybe values.

                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                  orElse(handler)
                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                  forall a: (Maybe a).((a) => Maybe a) => Maybe a

                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                  Allows recovering from from failed Maybe values.

                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                  While .chain() allows one to sequence operations, such that the second -operation is ran only if the first one succeeds, and their state is propagated, -.orElse() allows one to recover from a failed operation by providing a new -state.

                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                  Example:

                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -function first(list) {
                                                                                                                                                                                                                                                                                  -  return list.length > 0 ?   Maybe.Just(list[0])
                                                                                                                                                                                                                                                                                  -  :      /* otherwise */     Maybe.Nothing();
                                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -let failures = 0;
                                                                                                                                                                                                                                                                                  -function emitFailure() {
                                                                                                                                                                                                                                                                                  -  failures += 1;
                                                                                                                                                                                                                                                                                  -  return Maybe.Just('failed');
                                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -first(['one']).orElse(emitFailure);
                                                                                                                                                                                                                                                                                  -// ==> Maybe.Just('one')
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -failures; // ==> 0
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -first([]).orElse(emitFailure);
                                                                                                                                                                                                                                                                                  -// ==> Maybe.Just('failed')
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -failures; // ==> 1
                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                  Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                                                                  -    /*~
                                                                                                                                                                                                                                                                                  -     */
                                                                                                                                                                                                                                                                                  -    Nothing(handler) {
                                                                                                                                                                                                                                                                                  -      assertFunction('Maybe.Nothing#orElse', handler);
                                                                                                                                                                                                                                                                                  -      return handler(this.value);
                                                                                                                                                                                                                                                                                  -    },
                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  -    /*~
                                                                                                                                                                                                                                                                                  -     */
                                                                                                                                                                                                                                                                                  -    Just(handler) {
                                                                                                                                                                                                                                                                                  -      assertFunction('Maybe.Nothing#orElse', handler);
                                                                                                                                                                                                                                                                                  -      return this;
                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                                                  folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.toResult.html b/docs/api/en/folktale.src.data.maybe.maybe.toResult.html deleted file mode 100644 index d719f75..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.toResult.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toResult - - - - - -

                                                                                                                                                                                                                                                                                    toResult

                                                                                                                                                                                                                                                                                    A convenience method for the folktale/data/conversions/maybe-to-result module.

                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                                                    toResult(fallbackValue)
                                                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                                                    forall a, b: (Maybe a).(b) => Result b a

                                                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                                                    A convenience method for the folktale/data/conversions/maybe-to-result module.

                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                    Example:

                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                    const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                    -const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                    -Maybe.Just(1).toResult(0);
                                                                                                                                                                                                                                                                                    -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                    -Maybe.Nothing().toResult(0)
                                                                                                                                                                                                                                                                                    -// ==> Result.Error(0)
                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                                                    Defined in src/data/maybe/maybe.js at line 238, column 21
                                                                                                                                                                                                                                                                                    toResult(fallbackValue) {
                                                                                                                                                                                                                                                                                    -    return require('folktale/data/conversions/maybe-to-result')(this, fallbackValue);  
                                                                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                                                    folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.toValidation.html b/docs/api/en/folktale.src.data.maybe.maybe.toValidation.html deleted file mode 100644 index 6b942e7..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.toValidation.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toValidation - - - - - -

                                                                                                                                                                                                                                                                                      toValidation

                                                                                                                                                                                                                                                                                      A convenience method for the folktale/data/conversions/maybe-to-validation module.

                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                                                      toValidation(fallbackValue)
                                                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                                                      forall a, b: (Maybe a).(b) => Result b a

                                                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                                                      A convenience method for the folktale/data/conversions/maybe-to-validation module.

                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                      Example:

                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                      const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                      -const Validation = require('folktale/data/validation');
                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                      -Maybe.Just(1).toValidation(0);
                                                                                                                                                                                                                                                                                      -// ==> Validation.Success(1)
                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                      -Maybe.Nothing().toValidation(0)
                                                                                                                                                                                                                                                                                      -// ==> Validation.Failure(0)
                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                                                      Defined in src/data/maybe/maybe.js at line 238, column 21
                                                                                                                                                                                                                                                                                      toValidation(fallbackValue) {
                                                                                                                                                                                                                                                                                      -    return require('folktale/data/conversions/maybe-to-validation')(this, fallbackValue);
                                                                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                                                      folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.unsafeGet.html b/docs/api/en/folktale.src.data.maybe.maybe.unsafeGet.html deleted file mode 100644 index f9f14e0..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.unsafeGet.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - unsafeGet - - - - - -

                                                                                                                                                                                                                                                                                        unsafeGet

                                                                                                                                                                                                                                                                                        Extracts the value from a Just structure.

                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                                                        unsafeGet()
                                                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                                                        forall a: (Maybe a).() => a :: (throws TypeError)

                                                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                                                        Extracts the value from a Just structure.

                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                        WARNING
                                                                                                                                                                                                                                                                                        This method is partial, which means that it will only work for -Just structures, not for Nothing structures. It's recommended -to use .getOrElse() or .matchWith() instead.

                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                        Example:

                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        -Maybe.Just(1).unsafeGet(); // ==> 1
                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        -try {
                                                                                                                                                                                                                                                                                        -  Maybe.Nothing().unsafeGet();
                                                                                                                                                                                                                                                                                        -  // TypeError: Can't extract the value of a Nothing
                                                                                                                                                                                                                                                                                        -} catch (e) {
                                                                                                                                                                                                                                                                                        -  e instanceof TypeError; // ==> true
                                                                                                                                                                                                                                                                                        -}
                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                                                        Defined in src/data/maybe/maybe.js at line 63, column 18
                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                        -    /*~
                                                                                                                                                                                                                                                                                        -     */
                                                                                                                                                                                                                                                                                        -    Nothing() {
                                                                                                                                                                                                                                                                                        -      throw new TypeError(`Can't extract the value of a Nothing.
                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        -    Since Nothing holds no values, it's not possible to extract one from them.
                                                                                                                                                                                                                                                                                        -    You might consider switching from Maybe#get to Maybe#getOrElse, or some other method
                                                                                                                                                                                                                                                                                        -    that is not partial.
                                                                                                                                                                                                                                                                                        -      `);
                                                                                                                                                                                                                                                                                        -    },
                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        -    /*~
                                                                                                                                                                                                                                                                                        -     */
                                                                                                                                                                                                                                                                                        -    Just() {
                                                                                                                                                                                                                                                                                        -      return this.value;
                                                                                                                                                                                                                                                                                        -    }
                                                                                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                                                        folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.maybe.value.html b/docs/api/en/folktale.src.data.maybe.maybe.value.html deleted file mode 100644 index 25528d1..0000000 --- a/docs/api/en/folktale.src.data.maybe.maybe.value.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - value - - - - - -

                                                                                                                                                                                                                                                                                          value

                                                                                                                                                                                                                                                                                          The value contained in a Just instance of the Maybe structure.

                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                                                          get value()
                                                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                                                          forall a: get (Maybe a) => a

                                                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                                                          The value contained in a Just instance of the Maybe structure.

                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                          This is usually used to destructure the instance in a .matchWith call.

                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                          Example:

                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                          const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                          -Maybe.Just(1).matchWith({
                                                                                                                                                                                                                                                                                          -  Just: ({ value }) => value, // equivalent to (x) => x.value
                                                                                                                                                                                                                                                                                          -  Nothing: () => 'nothing'
                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                          -// ==> 1
                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                                                          Defined in src/data/maybe/maybe.js at line 45, column 23
                                                                                                                                                                                                                                                                                          get value() {
                                                                                                                                                                                                                                                                                          -    throw new TypeError('`value` can’t be accessed in an abstract instance of Maybe.Just');
                                                                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                                                          folktale/src/data/maybe/maybe
                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.of.html b/docs/api/en/folktale.src.data.maybe.of.html deleted file mode 100644 index 3b49baf..0000000 --- a/docs/api/en/folktale.src.data.maybe.of.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - of - - - - - -

                                                                                                                                                                                                                                                                                            of

                                                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                                                            of(value)
                                                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                                                            forall a: (a) => Maybe a

                                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                                            Constructs a Maybe value that represents a successful value (a Just).

                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                            NOTE:
                                                                                                                                                                                                                                                                                            The provided value is stored as-given in the structure. If you want to -convert a nullable value (a value that may be null/undefined) to a Maybe -value, use the Maybe.fromNullable(value) function instead of -Maybe.of(value).

                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                            See the documentation for the Maybe structure to understand how to use this.

                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                                                            A Number.

                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                                            function(value) {
                                                                                                                                                                                                                                                                                            -  return Just(value);
                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                                                            folktale/src/data/maybe
                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.toEither.html b/docs/api/en/folktale.src.data.maybe.toEither.html deleted file mode 100644 index 98246d0..0000000 --- a/docs/api/en/folktale.src.data.maybe.toEither.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toEither - - - - - -

                                                                                                                                                                                                                                                                                              toEither

                                                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                                                              toEither(fallbackValue)
                                                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                                                              forall a, b: (Maybe a).(b) => Either b a

                                                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                                                              A convenience method for the folktale/data/conversions/maybe-to-either module.

                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                              Example:

                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                              const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                              -const Either = require('folktale/data/either');
                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                              -Maybe.Just(1).toEither(0);
                                                                                                                                                                                                                                                                                              -// ==> Either.Right(1)
                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                              -Maybe.Nothing().toEither(0)
                                                                                                                                                                                                                                                                                              -// ==> Either.Left(0)
                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                                                                              A Number.

                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                                                              function(fallbackValue) {
                                                                                                                                                                                                                                                                                              -  return require('folktale/data/conversions/maybe-to-either')(this, fallbackValue);
                                                                                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                                                              folktale/src/data/maybe
                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.maybe.toValidation.html b/docs/api/en/folktale.src.data.maybe.toValidation.html deleted file mode 100644 index afc20e6..0000000 --- a/docs/api/en/folktale.src.data.maybe.toValidation.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toValidation - - - - - -

                                                                                                                                                                                                                                                                                                toValidation

                                                                                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                                                                                toValidation(fallbackValue)
                                                                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                                                                forall a, b: (Maybe a).(b) => Validation b a

                                                                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                                                                A convenience method for the folktale/data/conversions/maybe-to-validation module.

                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                                -const Validation = require('folktale/data/validation');
                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                -Maybe.Just(1).toValidation(0);
                                                                                                                                                                                                                                                                                                -// ==> Validation.Success(1)
                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                -Maybe.Nothing().toValidation(0)
                                                                                                                                                                                                                                                                                                -// ==> Validation.Failure(0)    
                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                                                                A Number.

                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                                                                function(fallbackValue) {
                                                                                                                                                                                                                                                                                                -  return require('folktale/data/conversions/maybe-to-validation')(this, fallbackValue);
                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                                                                folktale/src/data/maybe
                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.Error.html b/docs/api/en/folktale.src.data.result.Error.html deleted file mode 100644 index b8700a2..0000000 --- a/docs/api/en/folktale.src.data.result.Error.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - Error - - - - - -

                                                                                                                                                                                                                                                                                                  Error

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a failure.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                                  Error(value)
                                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                                  forall a, b: (a) => Result a b

                                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a failure.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  See the documentation for the Result structure to understand how to use this.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Static properties

                                                                                                                                                                                                                                                                                                  Comparing and Testing

                                                                                                                                                                                                                                                                                                  hasInstance(value)

                                                                                                                                                                                                                                                                                                  Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Debug Representation

                                                                                                                                                                                                                                                                                                  inspect: toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Internal

                                                                                                                                                                                                                                                                                                  get constructor

                                                                                                                                                                                                                                                                                                  The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  prototype

                                                                                                                                                                                                                                                                                                  The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  State and Configuration

                                                                                                                                                                                                                                                                                                  get tag

                                                                                                                                                                                                                                                                                                  The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  get type

                                                                                                                                                                                                                                                                                                  The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Instance (prototype) properties

                                                                                                                                                                                                                                                                                                  Comparing and Testing

                                                                                                                                                                                                                                                                                                  hasInstance(value)

                                                                                                                                                                                                                                                                                                  Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Inherited

                                                                                                                                                                                                                                                                                                  Comparing and testing

                                                                                                                                                                                                                                                                                                  equals(value)

                                                                                                                                                                                                                                                                                                  Compares two setoids structurally.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Constructing

                                                                                                                                                                                                                                                                                                  Error(value)

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a failure.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  Ok(value)

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a success.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  of(value)

                                                                                                                                                                                                                                                                                                  Constructs a Result holding an Ok value.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited

                                                                                                                                                                                                                                                                                                  Converting

                                                                                                                                                                                                                                                                                                  toMaybe()

                                                                                                                                                                                                                                                                                                  Transforms a Result into a Maybe. Error values are lost in the process.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  toValidation()

                                                                                                                                                                                                                                                                                                  Transforms a Result into a Validation.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited

                                                                                                                                                                                                                                                                                                  Debug Representation

                                                                                                                                                                                                                                                                                                  inspect: toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Extending ADTs

                                                                                                                                                                                                                                                                                                  derive(...derivations)

                                                                                                                                                                                                                                                                                                  Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited

                                                                                                                                                                                                                                                                                                  Extracting values

                                                                                                                                                                                                                                                                                                  get()

                                                                                                                                                                                                                                                                                                  This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  DeprecatedInherited
                                                                                                                                                                                                                                                                                                  getOrElse(default)

                                                                                                                                                                                                                                                                                                  Extracts the value of a Result structure, if it exists (i.e.: is an Ok), -otherwise returns the provided default value.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  merge()

                                                                                                                                                                                                                                                                                                  Returns the value inside of the Result structure, regardless of its state.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  unsafeGet()

                                                                                                                                                                                                                                                                                                  Extracts the value from a Result structure.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Fantasy Land

                                                                                                                                                                                                                                                                                                  ap(that)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/ap(that)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/bimap(f, g)

                                                                                                                                                                                                                                                                                                  Fantasy Land’s Bifunctor bimap

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/chain(transformation)

                                                                                                                                                                                                                                                                                                  Fantasy Land’s Chain chain.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/equals(that)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/map(transformation)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Functor map.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/of(value)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Applicative of

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Members

                                                                                                                                                                                                                                                                                                  variants

                                                                                                                                                                                                                                                                                                  The variants present in this ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Inherited

                                                                                                                                                                                                                                                                                                  Pattern matching

                                                                                                                                                                                                                                                                                                  fold(ErrorTransformation, OkTransformation)

                                                                                                                                                                                                                                                                                                  Applies a function to each case of a Result.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Recovering

                                                                                                                                                                                                                                                                                                  orElse(handler)

                                                                                                                                                                                                                                                                                                  Allows recovering from Error values with a handler function.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Serialisation

                                                                                                                                                                                                                                                                                                  fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

                                                                                                                                                                                                                                                                                                  Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  toJSON()

                                                                                                                                                                                                                                                                                                  Serialises a variant to JSON.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  State and configuration

                                                                                                                                                                                                                                                                                                  get value

                                                                                                                                                                                                                                                                                                  The value contained in an Error instance of the Result structure.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Abstract

                                                                                                                                                                                                                                                                                                  Testing and Comparing

                                                                                                                                                                                                                                                                                                  get isError

                                                                                                                                                                                                                                                                                                  True if a value belongs to the ADT variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Deprecated

                                                                                                                                                                                                                                                                                                  Transforming

                                                                                                                                                                                                                                                                                                  apply(anResult)

                                                                                                                                                                                                                                                                                                  Applies the function contained in one Result to the value in another Result. -Application only occurs if both Results are Ok, otherwise keeps the first -Error.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  bimap(ErrorTransformation, OkTransformation)

                                                                                                                                                                                                                                                                                                  Transforms each side of a Result with a function, without changing the context -of the computation. That is, Errors will still be Errors, Oks will still be -Oks.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  chain(transformation)

                                                                                                                                                                                                                                                                                                  Transforms the value and context of a Result computation with an unary function. -As with .map(), the transformation is only applied if the value is an Ok, -but the transformation is expected a new Result value, which then becomes the -result of the method.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  map(transformation)

                                                                                                                                                                                                                                                                                                  Transforms the value inside of a Result structure with an unary function without -changing the context of the computation. That is, Error values continue to be -Error values, and Ok values continue to be Ok values.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  mapError(transformation)

                                                                                                                                                                                                                                                                                                  Transforms the value inside an Error without changing the context of the -computation.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  matchWith(pattern)

                                                                                                                                                                                                                                                                                                  Selects an operation based on this Variant's tag.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  swap()

                                                                                                                                                                                                                                                                                                  Inverts the context of a Result value such that Errors are transformed into Oks, -and Oks are transformed into Errors. Does not touch the value inside of the -Result.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                                  Error(value) {
                                                                                                                                                                                                                                                                                                  -    return { value };
                                                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.Ok.html b/docs/api/en/folktale.src.data.result.Ok.html deleted file mode 100644 index a1e6ae5..0000000 --- a/docs/api/en/folktale.src.data.result.Ok.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - Ok - - - - - -

                                                                                                                                                                                                                                                                                                  Ok

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a success.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                                  Ok(value)
                                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                                  forall a, b: (b) => Result a b

                                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a success.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  See the documentation for the Result structure to understand how to use this.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Static properties

                                                                                                                                                                                                                                                                                                  Comparing and Testing

                                                                                                                                                                                                                                                                                                  hasInstance(value)

                                                                                                                                                                                                                                                                                                  Checks if a value belongs to this Variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Debug Representation

                                                                                                                                                                                                                                                                                                  inspect: toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the Variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Internal

                                                                                                                                                                                                                                                                                                  get constructor

                                                                                                                                                                                                                                                                                                  The internal constructor provided by the user, which transforms and -validates the properties attached to objects constructed in this ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  prototype

                                                                                                                                                                                                                                                                                                  The object that provides common behaviours for instances of this variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  State and Configuration

                                                                                                                                                                                                                                                                                                  get tag

                                                                                                                                                                                                                                                                                                  The unique tag for this variant within the ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  get type

                                                                                                                                                                                                                                                                                                  The (ideally unique) type for the ADT. This is provided by the user -creating the ADT, so we can't actually guarantee uniqueness.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Instance (prototype) properties

                                                                                                                                                                                                                                                                                                  Comparing and Testing

                                                                                                                                                                                                                                                                                                  hasInstance(value)

                                                                                                                                                                                                                                                                                                  Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Inherited

                                                                                                                                                                                                                                                                                                  Comparing and testing

                                                                                                                                                                                                                                                                                                  equals(value)

                                                                                                                                                                                                                                                                                                  Compares two setoids structurally.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Constructing

                                                                                                                                                                                                                                                                                                  Error(value)

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a failure.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  Ok(value)

                                                                                                                                                                                                                                                                                                  Constructs a Result whose value represents a success.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  of(value)

                                                                                                                                                                                                                                                                                                  Constructs a Result holding an Ok value.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited

                                                                                                                                                                                                                                                                                                  Converting

                                                                                                                                                                                                                                                                                                  toMaybe()

                                                                                                                                                                                                                                                                                                  Transforms a Result into a Maybe. Error values are lost in the process.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  toValidation()

                                                                                                                                                                                                                                                                                                  Transforms a Result into a Validation.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited

                                                                                                                                                                                                                                                                                                  Debug Representation

                                                                                                                                                                                                                                                                                                  inspect: toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  toString()

                                                                                                                                                                                                                                                                                                  Returns a textual representation of the ADT instance.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Extending ADTs

                                                                                                                                                                                                                                                                                                  derive(...derivations)

                                                                                                                                                                                                                                                                                                  Allows a function to provide functionality to variants in an ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited

                                                                                                                                                                                                                                                                                                  Extracting values

                                                                                                                                                                                                                                                                                                  get()

                                                                                                                                                                                                                                                                                                  This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  DeprecatedInherited
                                                                                                                                                                                                                                                                                                  getOrElse(default)

                                                                                                                                                                                                                                                                                                  Extracts the value of a Result structure, if it exists (i.e.: is an Ok), -otherwise returns the provided default value.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  merge()

                                                                                                                                                                                                                                                                                                  Returns the value inside of the Result structure, regardless of its state.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  unsafeGet()

                                                                                                                                                                                                                                                                                                  Extracts the value from a Result structure.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Fantasy Land

                                                                                                                                                                                                                                                                                                  ap(that)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/ap(that)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/bimap(f, g)

                                                                                                                                                                                                                                                                                                  Fantasy Land’s Bifunctor bimap

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/chain(transformation)

                                                                                                                                                                                                                                                                                                  Fantasy Land’s Chain chain.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/equals(that)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/map(transformation)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Functor map.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  fantasy-land/of(value)

                                                                                                                                                                                                                                                                                                  Fantasy Land's Applicative of

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Members

                                                                                                                                                                                                                                                                                                  variants

                                                                                                                                                                                                                                                                                                  The variants present in this ADT.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Inherited

                                                                                                                                                                                                                                                                                                  Pattern matching

                                                                                                                                                                                                                                                                                                  fold(ErrorTransformation, OkTransformation)

                                                                                                                                                                                                                                                                                                  Applies a function to each case of a Result.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Recovering

                                                                                                                                                                                                                                                                                                  orElse(handler)

                                                                                                                                                                                                                                                                                                  Allows recovering from Error values with a handler function.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Serialisation

                                                                                                                                                                                                                                                                                                  fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

                                                                                                                                                                                                                                                                                                  Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  ExperimentalInherited
                                                                                                                                                                                                                                                                                                  toJSON()

                                                                                                                                                                                                                                                                                                  Serialises a variant to JSON.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  State and configuration

                                                                                                                                                                                                                                                                                                  get value

                                                                                                                                                                                                                                                                                                  The value contained in an Ok instance of the Result structure.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Abstract

                                                                                                                                                                                                                                                                                                  Testing and Comparing

                                                                                                                                                                                                                                                                                                  get isOk

                                                                                                                                                                                                                                                                                                  True if a value belongs to the ADT variant.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Deprecated

                                                                                                                                                                                                                                                                                                  Transforming

                                                                                                                                                                                                                                                                                                  apply(anResult)

                                                                                                                                                                                                                                                                                                  Applies the function contained in one Result to the value in another Result. -Application only occurs if both Results are Ok, otherwise keeps the first -Error.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  bimap(ErrorTransformation, OkTransformation)

                                                                                                                                                                                                                                                                                                  Transforms each side of a Result with a function, without changing the context -of the computation. That is, Errors will still be Errors, Oks will still be -Oks.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  chain(transformation)

                                                                                                                                                                                                                                                                                                  Transforms the value and context of a Result computation with an unary function. -As with .map(), the transformation is only applied if the value is an Ok, -but the transformation is expected a new Result value, which then becomes the -result of the method.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  map(transformation)

                                                                                                                                                                                                                                                                                                  Transforms the value inside of a Result structure with an unary function without -changing the context of the computation. That is, Error values continue to be -Error values, and Ok values continue to be Ok values.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  mapError(transformation)

                                                                                                                                                                                                                                                                                                  Transforms the value inside an Error without changing the context of the -computation.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  matchWith(pattern)

                                                                                                                                                                                                                                                                                                  Selects an operation based on this Variant's tag.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental
                                                                                                                                                                                                                                                                                                  swap()

                                                                                                                                                                                                                                                                                                  Inverts the context of a Result value such that Errors are transformed into Oks, -and Oks are transformed into Errors. Does not touch the value inside of the -Result.

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                                  Ok(value) {
                                                                                                                                                                                                                                                                                                  -    return { value };
                                                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.constructor.html b/docs/api/en/folktale.src.data.result.constructor.html deleted file mode 100644 index 2fc2c98..0000000 --- a/docs/api/en/folktale.src.data.result.constructor.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Error - - - - - -

                                                                                                                                                                                                                                                                                                  Error

                                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                                  Error(value)
                                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                                  forall a, b: (a) => Result a b

                                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                                  Error(value) {
                                                                                                                                                                                                                                                                                                  -    return { value };
                                                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                                                  Stability
                                                                                                                                                                                                                                                                                                  experimental
                                                                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                                                                  folktale/src/data/result
                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.fromJSON.html b/docs/api/en/folktale.src.data.result.fromJSON.html deleted file mode 100644 index 85c7f3c..0000000 --- a/docs/api/en/folktale.src.data.result.fromJSON.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - fromJSON - - - - - -

                                                                                                                                                                                                                                                                                                    fromJSON

                                                                                                                                                                                                                                                                                                    Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                                                                    fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)
                                                                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                                                                    type JSONSerialisation = {
                                                                                                                                                                                                                                                                                                    -  "@@type":  String,
                                                                                                                                                                                                                                                                                                    -  "@@tag":   String,
                                                                                                                                                                                                                                                                                                    -  "@@value": Object Any
                                                                                                                                                                                                                                                                                                    -}
                                                                                                                                                                                                                                                                                                    -type JSONParser = {
                                                                                                                                                                                                                                                                                                    -  fromJSON: (JSONSerialisation, Array JSONParser) => Variant
                                                                                                                                                                                                                                                                                                    -}
                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                    -(JSONSerialisation, Array JSONParser) => Variant

                                                                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                                                                    Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                    Example:

                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                    const { data, setoid } = require('folktale/core/adt');
                                                                                                                                                                                                                                                                                                    -const Id = data('Id', {
                                                                                                                                                                                                                                                                                                    -  Id(value){ return { value } }
                                                                                                                                                                                                                                                                                                    -}).derive(serialize, setoid);
                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                    -Id.Id(1).toJSON();
                                                                                                                                                                                                                                                                                                    -// ==> { '@@type': 'Id', '@@tag': 'Id', '@@value': { value: 1 } }
                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                    -Id.fromJSON(Id.Id(1).toJSON());
                                                                                                                                                                                                                                                                                                    -// ==> Id.Id(1)
                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                                                                    function(value, parsers = { [typeName]: adt }, keysIndicateType = false) {
                                                                                                                                                                                                                                                                                                    -    const valueTypeName = value[typeJsonKey];
                                                                                                                                                                                                                                                                                                    -    const valueTagName = value[tagJsonKey];
                                                                                                                                                                                                                                                                                                    -    const valueContents = value[valueJsonKey];
                                                                                                                                                                                                                                                                                                    -    assertType(typeName, valueTypeName);
                                                                                                                                                                                                                                                                                                    -    const parsersByType = keysIndicateType ? parsers
                                                                                                                                                                                                                                                                                                    -          : /*otherwise*/                    indexByType(values(parsers));
                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                    -    const parsedValue = mapValues(valueContents, parseValue(parsersByType));
                                                                                                                                                                                                                                                                                                    -    return Object.assign(Object.create(adt[valueTagName].prototype), parsedValue);
                                                                                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                                                                                    Stability
                                                                                                                                                                                                                                                                                                    experimental
                                                                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                                                                    folktale/src/data/result
                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                    • @boris-marinov
                                                                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.fromMaybe.html b/docs/api/en/folktale.src.data.result.fromMaybe.html deleted file mode 100644 index 474c9ca..0000000 --- a/docs/api/en/folktale.src.data.result.fromMaybe.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - fromMaybe - - - - - -

                                                                                                                                                                                                                                                                                                      fromMaybe

                                                                                                                                                                                                                                                                                                      A convenience method for the folktale/data/conversions/maybe-to-result module.

                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                                                                      fromMaybe(aMaybe, failureValue)
                                                                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                                                                      forall a, b: (Maybe b, a) => Result a b

                                                                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                                                                      A convenience method for the folktale/data/conversions/maybe-to-result module.

                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                      Example:

                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                      const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                      -const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                      -Result.fromMaybe(Maybe.Just(1), 'error');
                                                                                                                                                                                                                                                                                                      -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                      -Result.fromMaybe(Maybe.Nothing(), 'error');
                                                                                                                                                                                                                                                                                                      -// ==> Result.Error('error')
                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                                                                      Defined in src/data/result/index.js
                                                                                                                                                                                                                                                                                                      fromMaybe(aMaybe, failureValue) {
                                                                                                                                                                                                                                                                                                      -    return require('folktale/data/conversions/maybe-to-result')(aMaybe, failureValue);
                                                                                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                                                                      folktale/src/data/result
                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.fromNullable.html b/docs/api/en/folktale.src.data.result.fromNullable.html deleted file mode 100644 index d591080..0000000 --- a/docs/api/en/folktale.src.data.result.fromNullable.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - fromNullable - - - - - -

                                                                                                                                                                                                                                                                                                        fromNullable

                                                                                                                                                                                                                                                                                                        A convenience method for the folktale/data/conversions/nullable-to-result -module.

                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                                                                        fromNullable(aNullable)
                                                                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                                                                        forall a: (a or None) => Result None a

                                                                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                                                                        A convenience method for the folktale/data/conversions/nullable-to-result -module.

                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                        Example:

                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                        const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                        -Result.fromNullable(1);
                                                                                                                                                                                                                                                                                                        -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                        -Result.fromNullable(null);
                                                                                                                                                                                                                                                                                                        -// ==> Result.Error(null)
                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                        -Result.fromNullable(undefined);
                                                                                                                                                                                                                                                                                                        -// ==> Result.Error(undefined)
                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                                                                        Defined in src/data/result/index.js
                                                                                                                                                                                                                                                                                                        fromNullable(aNullable) {
                                                                                                                                                                                                                                                                                                        -    return require('folktale/data/conversions/nullable-to-result')(aNullable);
                                                                                                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                                                                        folktale/src/data/result
                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.fromValidation.html b/docs/api/en/folktale.src.data.result.fromValidation.html deleted file mode 100644 index 2818b9e..0000000 --- a/docs/api/en/folktale.src.data.result.fromValidation.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - fromValidation - - - - - -

                                                                                                                                                                                                                                                                                                          fromValidation

                                                                                                                                                                                                                                                                                                          A convenience method for the folktale/data/conversions/validation-to-result -module.

                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                                                                          fromValidation(aValidation)
                                                                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                                                                          forall a, b: (Validation a b) => Result a b

                                                                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                                                                          A convenience method for the folktale/data/conversions/validation-to-result -module.

                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                          Example:

                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                          const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                          -const Validation = require('folktale/data/validation');
                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                          -Result.fromValidation(Validation.Success(1));
                                                                                                                                                                                                                                                                                                          -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                          -Result.fromValidation(Validation.Failure(1));
                                                                                                                                                                                                                                                                                                          -// ==> Result.Error(1)
                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                                                                          Defined in src/data/result/index.js
                                                                                                                                                                                                                                                                                                          fromValidation(aValidation) {
                                                                                                                                                                                                                                                                                                          -    return require('folktale/data/conversions/validation-to-result')(aValidation);
                                                                                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                                                                          folktale/src/data/result
                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.html b/docs/api/en/folktale.src.data.result.html deleted file mode 100644 index fc78424..0000000 --- a/docs/api/en/folktale.src.data.result.html +++ /dev/null @@ -1,610 +0,0 @@ - - - - - module folktale/data/result - - - - - -

                                                                                                                                                                                                                                                                                                            module folktale/data/result

                                                                                                                                                                                                                                                                                                            A data structure that models the result of operations that may fail. A Result -helps with representing errors and propagating them, giving users a more -controllable form of sequencing operations with the power of constructs like -try/catch.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                                                            A data structure that models the result of operations that may fail. A Result -helps with representing errors and propagating them, giving users a more -controllable form of sequencing operations with the power of constructs like -try/catch.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            A Result may be either an Ok(value), which contains a successful value, or -an Error(value), which contains an error.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Example:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -const { data, setoid, show } = require('folktale/core/adt');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const DivisionErrors = data('division-errors', {
                                                                                                                                                                                                                                                                                                            -  DivisionByZero(dividend) {
                                                                                                                                                                                                                                                                                                            -    return { dividend };
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -}).derive(setoid, show);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const { DivisionByZero } = DivisionErrors;
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const divideBy = (dividend, divisor) => 
                                                                                                                                                                                                                                                                                                            -  divisor === 0 ?  Result.Error(DivisionByZero(dividend))
                                                                                                                                                                                                                                                                                                            -: /* otherwise */  Result.Ok(Math.floor(dividend / divisor));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -divideBy(4, 2);
                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -divideBy(4, 0);
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error(DivisionByZero(4))
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Why use Result?

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Sometimes functions fail, for many reasons: someone might have provided an -unexpected value to it, the internet connection might have gone down in the -middle of an HTTP request, the database might have died. Regardless of which -reason, we have to handle these failures. And, of course, we'd like to handle -failures in the simplest way possible.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            In JavaScript you're often left with two major ways of dealing with these -failures: a branching instruction (like if/else), or throwing errors and -catching them.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            To see how Result compares to these, we'll look at a function that needs to -validate some information, and that incorporates some more complex validation -rules. A person may sign-up for a service by providing the form they would -prefer being contacted (email or phone), and the information related to that -preference has to be provided, but any other info is optional:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            // Functions to assert the format of each data
                                                                                                                                                                                                                                                                                                            -const isValidName  = (name)  => name.trim() !== '';
                                                                                                                                                                                                                                                                                                            -const isValidEmail = (email) => /(.+)@(.+)/.test(email);
                                                                                                                                                                                                                                                                                                            -const isValidPhone = (phone) => /^\d+$/.test(phone);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -// Objects representing each possible failure in the validation
                                                                                                                                                                                                                                                                                                            -const { data, setoid } = require('folktale/core/adt');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const ValidationErrors = data('validation-errors', {
                                                                                                                                                                                                                                                                                                            -  Required(field) {
                                                                                                                                                                                                                                                                                                            -    return { field };
                                                                                                                                                                                                                                                                                                            -  },
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  InvalidEmail(email) {
                                                                                                                                                                                                                                                                                                            -    return { email };
                                                                                                                                                                                                                                                                                                            -  },
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  InvalidPhone(phone) {
                                                                                                                                                                                                                                                                                                            -    return { phone };
                                                                                                                                                                                                                                                                                                            -  },
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  InvalidType(type) {
                                                                                                                                                                                                                                                                                                            -    return { type };
                                                                                                                                                                                                                                                                                                            -  },
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  Optional(error) {
                                                                                                                                                                                                                                                                                                            -    return { error };
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -}).derive(setoid);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const { 
                                                                                                                                                                                                                                                                                                            -  Required, 
                                                                                                                                                                                                                                                                                                            -  InvalidEmail, 
                                                                                                                                                                                                                                                                                                            -  InvalidPhone, 
                                                                                                                                                                                                                                                                                                            -  InvalidType, 
                                                                                                                                                                                                                                                                                                            -  Optional 
                                                                                                                                                                                                                                                                                                            -} = ValidationErrors;
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Branching stops being a very feasible thing after a couple of cases. It's very -simple to forget to handle failures (often with catastrophic effects, as can be -seen in things like NullPointerException and the likes), and there's no error -propagation, so every part of the code has to handle the same error over and -over again:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const validateBranching = ({ name, type, email, phone }) => {
                                                                                                                                                                                                                                                                                                            -  if (!isValidName(name)) {
                                                                                                                                                                                                                                                                                                            -    return Required('name');
                                                                                                                                                                                                                                                                                                            -  } else if (type === 'email') {
                                                                                                                                                                                                                                                                                                            -    if (!isValidEmail(email)) {
                                                                                                                                                                                                                                                                                                            -      return InvalidEmail(email);
                                                                                                                                                                                                                                                                                                            -    } else if (phone && !isValidPhone(phone)) {
                                                                                                                                                                                                                                                                                                            -      return Optional(InvalidPhone(phone));
                                                                                                                                                                                                                                                                                                            -    } else {
                                                                                                                                                                                                                                                                                                            -      return { type, name, email, phone };
                                                                                                                                                                                                                                                                                                            -    }
                                                                                                                                                                                                                                                                                                            -  } else if (type === 'phone') {
                                                                                                                                                                                                                                                                                                            -    if (!isValidPhone(phone)) {
                                                                                                                                                                                                                                                                                                            -      return InvalidPhone(phone);
                                                                                                                                                                                                                                                                                                            -    } else if (email && !isValidEmail(email)) {
                                                                                                                                                                                                                                                                                                            -      return Optional(InvalidEmail(email));
                                                                                                                                                                                                                                                                                                            -    } else {
                                                                                                                                                                                                                                                                                                            -      return { type, name, email, phone };
                                                                                                                                                                                                                                                                                                            -    }
                                                                                                                                                                                                                                                                                                            -  } else {
                                                                                                                                                                                                                                                                                                            -    return InvalidType(type);
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -};
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -validateBranching({
                                                                                                                                                                                                                                                                                                            -  name: 'Max',
                                                                                                                                                                                                                                                                                                            -  type: 'email',
                                                                                                                                                                                                                                                                                                            -  phone: '11234456'
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// ==> InvalidEmail(undefined)
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -validateBranching({
                                                                                                                                                                                                                                                                                                            -  name: 'Alissa',
                                                                                                                                                                                                                                                                                                            -  type: 'email',
                                                                                                                                                                                                                                                                                                            -  email: 'alissa@somedomain'
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// ==> { type: 'email', name: 'Alissa', email: 'alissa@somedomain', phone: undefined }
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Exceptions (with the throw and try/catch constructs) alleviate this a bit. -They don't solve the cases where you forget to handle a failure—although that -often results in crashing the process, which is better than continuing but doing -the wrong thing—, but they allow failures to propagate, so fewer places in the -code need to really deal with the problem:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const id = (a) => a;
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const assertEmail = (email, wrapper=id) => {
                                                                                                                                                                                                                                                                                                            -  if (!isValidEmail(email)) {
                                                                                                                                                                                                                                                                                                            -    throw wrapper(InvalidEmail(email));
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -};
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const assertPhone = (phone, wrapper=id) => {
                                                                                                                                                                                                                                                                                                            -  if (!isValidPhone(phone)) {
                                                                                                                                                                                                                                                                                                            -    throw wrapper(InvalidEmail(email));
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -};
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const validateThrow = ({ name, type, email, phone }) => {
                                                                                                                                                                                                                                                                                                            -  if (!isValidName(name)) {
                                                                                                                                                                                                                                                                                                            -    throw Required('name');
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -  switch (type) {
                                                                                                                                                                                                                                                                                                            -    case 'email':
                                                                                                                                                                                                                                                                                                            -      assertEmail(email);
                                                                                                                                                                                                                                                                                                            -      if (phone)  assertPhone(phone, Optional);
                                                                                                                                                                                                                                                                                                            -      return { type, name, email, phone };
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -    case 'phone':
                                                                                                                                                                                                                                                                                                            -      assertPhone(phone);
                                                                                                                                                                                                                                                                                                            -      if (email)  assertEmail(email, Optional);
                                                                                                                                                                                                                                                                                                            -      return { type, name, email, phone };
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -    default:
                                                                                                                                                                                                                                                                                                            -      throw InvalidType(type);
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -};
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -try {
                                                                                                                                                                                                                                                                                                            -  validateThrow({
                                                                                                                                                                                                                                                                                                            -    name: 'Max',
                                                                                                                                                                                                                                                                                                            -    type: 'email',
                                                                                                                                                                                                                                                                                                            -    phone: '11234456'
                                                                                                                                                                                                                                                                                                            -  });
                                                                                                                                                                                                                                                                                                            -} catch (e) {
                                                                                                                                                                                                                                                                                                            -  e; // ==> InvalidEmail(undefined)
                                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -validateThrow({
                                                                                                                                                                                                                                                                                                            -  name: 'Alissa',
                                                                                                                                                                                                                                                                                                            -  type: 'email',
                                                                                                                                                                                                                                                                                                            -  email: 'alissa@somedomain'
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// ==> { type: 'email', name: 'Alissa', email: 'alissa@somedomain', phone: undefined }
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            On the other hand, the error propagation that we have with throw doesn't tell -us much about how much of the code has actually been executed, and this is -particularly problematic when you have side-effects. How are you supposed to -recover from a failure when you don't know in which state your application is?

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Result helps with both of these cases. With a Result, the user is forced to -be aware of the failure, since they're not able to use the value at all without -unwrapping the value first. At the same time, using a Result value will -automatically propagate the errors when they're not handled, making error -handling easier. Since Result runs one operation at a time when you use the -value, and does not do any dynamic stack unwinding (as throw does), it's much -easier to understand in which state your application should be.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Using Result, the previous examples would look like this:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const checkName = (name) =>
                                                                                                                                                                                                                                                                                                            -  isValidName(name) ?  Result.Ok(name)
                                                                                                                                                                                                                                                                                                            -: /* otherwise */      Result.Error(Required('name'));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const checkEmail = (email) =>
                                                                                                                                                                                                                                                                                                            -  isValidEmail(email) ?  Result.Ok(email)
                                                                                                                                                                                                                                                                                                            -: /* otherwise */        Result.Error(InvalidEmail(email));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const checkPhone = (phone) =>
                                                                                                                                                                                                                                                                                                            -  isValidPhone(phone) ?  Result.Ok(phone)
                                                                                                                                                                                                                                                                                                            -: /* otherwise */        Result.Error(InvalidPhone(phone));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const optional = (check) => (value) =>
                                                                                                                                                                                                                                                                                                            -  value           ?  check(value).mapError(Optional)
                                                                                                                                                                                                                                                                                                            -: /* otherwise */    Result.Ok(value);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const maybeCheckEmail = optional(checkEmail);
                                                                                                                                                                                                                                                                                                            -const maybeCheckPhone = optional(checkPhone);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const validateResult = ({ name, type, email, phone }) =>
                                                                                                                                                                                                                                                                                                            -  checkName(name).chain(_ => 
                                                                                                                                                                                                                                                                                                            -    type === 'email' ?  checkEmail(email).chain(_ =>
                                                                                                                                                                                                                                                                                                            -                          maybeCheckPhone(phone).map(_ => ({
                                                                                                                                                                                                                                                                                                            -                            name, type, email, phone
                                                                                                                                                                                                                                                                                                            -                          }))
                                                                                                                                                                                                                                                                                                            -                        )
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  : type === 'phone' ?  checkPhone(phone).chain(_ =>
                                                                                                                                                                                                                                                                                                            -                          maybeCheckEmail(email).map(_ => ({
                                                                                                                                                                                                                                                                                                            -                            name, type, email, phone
                                                                                                                                                                                                                                                                                                            -                          }))
                                                                                                                                                                                                                                                                                                            -                        )
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  : /* otherwise */     Result.Error(InvalidType(type))
                                                                                                                                                                                                                                                                                                            -  );
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -validateResult({
                                                                                                                                                                                                                                                                                                            -  name: 'Max',
                                                                                                                                                                                                                                                                                                            -  type: 'email',
                                                                                                                                                                                                                                                                                                            -  phone: '11234456'
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error(InvalidEmail(undefined))
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -validateResult({
                                                                                                                                                                                                                                                                                                            -  name: 'Alissa',
                                                                                                                                                                                                                                                                                                            -  type: 'email',
                                                                                                                                                                                                                                                                                                            -  email: 'alissa@somedomain'
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// => Result.Ok({ name: 'Alissa', type: 'email', phone: undefined, email: 'alissa@somedomain' })
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            So, Results give you simpler and more predictable forms of error handling, that -still allow error propagation and composition to happen, as with regular -JavaScript exceptions, at the cost of some additional syntactical overhead, -since JavaScript does not allow one to abstract over syntax.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Working with Result values

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            A Result value may be one of the following cases:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • Ok(value) — represents a successful value (e.g.: the correct return value -from a function).

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                            • Error(value) — represents an unsuccessful value (e.g.: an error during the -evaluation of a function).

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Functions that may fail just return one of these two cases instead of failing. -That is, instead of writing something like this:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            //: (Number, Number) => Number throws DivisionByZero
                                                                                                                                                                                                                                                                                                            -const divideBy1 = (dividend, divisor) => {
                                                                                                                                                                                                                                                                                                            -  if (divisor === 0) {
                                                                                                                                                                                                                                                                                                            -    throw new Error('Division by zero');
                                                                                                                                                                                                                                                                                                            -  } else {
                                                                                                                                                                                                                                                                                                            -    return dividend / divisor;
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -divideBy1(6, 3); // ==> 2
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            One would write something like this:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -//: (Number, Number) => Result DivisionByZero Number
                                                                                                                                                                                                                                                                                                            -const divideBy2 = (dividend, divisor) => {
                                                                                                                                                                                                                                                                                                            -  if (divisor === 0) {
                                                                                                                                                                                                                                                                                                            -    return Result.Error('Division by zero');
                                                                                                                                                                                                                                                                                                            -  } else {
                                                                                                                                                                                                                                                                                                            -    return Result.Ok(dividend / divisor);
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -divideBy2(6, 3); // ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            The function returns a value of the type Result <error-type> <success-type>, -which is quite similar to the first version of the function, with the difference -that the error is made into a real value that the function returns, and as such -can be interacted with in the same way one interacts with any other object in -the language.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Because the value is wrapped in the Result structure, in order to use the -value one must first unwrap it. Folktale's Result provides methods to help -with this, and they can be divided roughly into 3 categories:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • Sequencing computations: A Result is the result of a computation that -can fail. Sometimes we want to run several computations that may fail in -sequence, and these methods help with that. This is roughly the equivalent -of ; in imperative programming, where the next instruction is only -executed if the previous instruction succeeds.

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                            • Transforming values: Sometimes we get a Result value that isn't -quite the value we're looking for. We don't really want to change the -status of the computation (errors should continue to be errors, successes -should continue to be successes), but we'd like to tweak the resulting -value a bit. This is the equivalent of applying functions in an -expression.

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                            • Extracting values: Sometimes we need to pass the value into things that -don't really know what a Result is, so we have to somehow extract the -value out of the structure. These methods help with that.

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            We'll see each of these categories in more details below.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Sequencing computations

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Because Result is used for partial functions which may fail in, possibly, many -different ways a common use case for the structure is combining all of these -functions such that only successful values flow through.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            You can sequence computations in this manner with the Result structure by -using the .chain method. The method takes as argument a single function that -will receive the value in the Result structure, and must return a new Result -structure, which then becomes the result of the method. Only successful values -flow through the function argument, errors are just propagated to the result -immediately.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            As an example, imagine we want to parse an integer. Integers are basically a -sequence of many digits, but we can start smaller and try figuring out how we -parse a single digit:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const isDigit = (character) =>
                                                                                                                                                                                                                                                                                                            -  '0123456789'.split('').includes(character);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const digit = (input) => {
                                                                                                                                                                                                                                                                                                            -  const character = input.slice(0, 1);
                                                                                                                                                                                                                                                                                                            -  const rest = input.slice(1);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  return isDigit(character) ?  Result.Ok([character, rest])
                                                                                                                                                                                                                                                                                                            -  :      /* otherwise */       Result.Error(`Expected a digit (0..9), got "${character}"`);
                                                                                                                                                                                                                                                                                                            -};
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -digit('012'); 
                                                                                                                                                                                                                                                                                                            -// => Result.Ok(['0', '12'])
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -digit('a12'); 
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), got "a"')
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            So far our parser correctly recognises the first digit in a sequence of -characters, but to parse integers we need it to recognise more than one digit. -We can also only proceed to the next character if the first one succeeds -(otherwise we already know it's not an integer!).

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            If we have a fixed number of digits that would look like the following:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const twoDigits = (input) =>
                                                                                                                                                                                                                                                                                                            -  digit(input).chain(([char1, rest]) =>
                                                                                                                                                                                                                                                                                                            -    digit(rest).chain(([char2, rest]) =>
                                                                                                                                                                                                                                                                                                            -      [char1 + char2, rest]
                                                                                                                                                                                                                                                                                                            -    )
                                                                                                                                                                                                                                                                                                            -  );
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -twoDigits('012');
                                                                                                                                                                                                                                                                                                            -// => Result.Ok(['01', '2'])
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -twoDigits('a12');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), got "a"')
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -twoDigits('0a2');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), got "a"')
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            We can generalise this to arbitrary numbers of digits by writing a recursive -function:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const digits = (input) =>
                                                                                                                                                                                                                                                                                                            -  input === '' ?   Result.Error('Expected a digit (0..9), but there was nothing to parse')
                                                                                                                                                                                                                                                                                                            -: /* otherwise */  digit(input).chain(([character, rest]) =>
                                                                                                                                                                                                                                                                                                            -                     rest === '' ?  Result.Ok(character)
                                                                                                                                                                                                                                                                                                            -                   : /* else */     digits(rest).chain(characters =>
                                                                                                                                                                                                                                                                                                            -                                      Result.Ok(character + characters)
                                                                                                                                                                                                                                                                                                            -                                    )
                                                                                                                                                                                                                                                                                                            -                   );
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -digits('012');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok('012')
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -digits('a12');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), got "a"')
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -digits('01a');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), got "a"')
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -digits('');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), but there was nothing to parse')
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            NOTE
                                                                                                                                                                                                                                                                                                            While the recursive .chain can be used when performing an arbitrary number -of computations, it should be noted that it may grow the stack of calls in a -JavaScript implementation beyond what that implementation supports, resulting -in a Max Call Stack Size Exceeded error.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Finally, parsing should give us a number instead of a string, so that string -needs to be converted. Since we already ensured that the resulting string only -has digits, the conversion from String to Number can never fail, but we can -still use .chain if we always return a Result.Ok:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const integer = (input) =>
                                                                                                                                                                                                                                                                                                            -  digits(input).chain(x => Result.Ok(Number(x)));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -integer('012');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok(12)
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -integer('01a')
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Expected a digit (0..9), got "a"')
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Transforming values

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Sometimes we want to transform just the value that is inside of a Result, -without touching the context of that value (whether the Result is a success or -an error). In the previous section, the integer transformation is a good -example of this. For these cases, the .map method can be used instead of the -.chain method:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -Result.Ok('012').map(Number);
                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok(12)
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Note that, like .chain, the .map method only runs on successful values, thus -it propagates failures as well:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Result.Error('012').map(Number);
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('012')
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Extracting values

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            While one can always just put all the rest of a computation inside of a -.chain, sometimes it may be preferrable to extract the value out of a Result -structure instead. For these cases there's a .getOrElse method:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -Result.Ok(1).getOrElse('not found');
                                                                                                                                                                                                                                                                                                            -// ==> 1
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -Result.Error(1).getOrElse('not found');
                                                                                                                                                                                                                                                                                                            -// ==> 'not found'
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Additionally, if one doesn't care about whether the value failed or succeeded, -the .merge method just returns whatever value is wrapped in the Result:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Result.Ok(1).merge();
                                                                                                                                                                                                                                                                                                            -// ==> 1
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -Result.Error(1).merge();
                                                                                                                                                                                                                                                                                                            -// ==> 1
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Error handling

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Since the purpose of a Result structure is to represent failures, we need to -be able to handle these failures in some way. The .getOrElse method gives us -some very specific and limited form of error handling, but if we want to do -something in order to recover from an error, this doesn't help us much.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            For a more general form of error handling, the Result structure provides the -.orElse method. This works pretty much in the same way .chain does, except -it invokes the function on errors (successes are propagated):

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const parseNumber = (input) =>
                                                                                                                                                                                                                                                                                                            -  isNaN(input) ?   Result.Error(`Not a number: ${input}`) 
                                                                                                                                                                                                                                                                                                            -: /* otherwise */  Result.Ok(Number(input));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const parseBool = (input) =>
                                                                                                                                                                                                                                                                                                            -  input === 'true'  ?  Result.Ok(true)
                                                                                                                                                                                                                                                                                                            -: input === 'false' ?  Result.Ok(false)
                                                                                                                                                                                                                                                                                                            -: /* otherwise */      Result.Error(`Not a boolean: ${input}`);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -const parseNumberOrBool = (input) =>
                                                                                                                                                                                                                                                                                                            -  parseNumber(input)
                                                                                                                                                                                                                                                                                                            -    .orElse(_ => parseBool(input));
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -parseNumberOrBool('13');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok(13)
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -parseNumberOrBool('true');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok(true)
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -parseNumberOrBool('foo');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Not a boolean: foo')
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            As with successes' .map, one may also transform the failure value of a -Result without changing the context of the computation by using the -.mapError method:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const parseNumberOrBool2 = (input) =>
                                                                                                                                                                                                                                                                                                            -  parseNumber(input)
                                                                                                                                                                                                                                                                                                            -    .orElse(_ => parseBool(input))
                                                                                                                                                                                                                                                                                                            -    .mapError(_ => `Not a number or boolean: ${input}`);
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -parseNumberOrBool2('foo');
                                                                                                                                                                                                                                                                                                            -// ==> Result.Error('Not a number or boolean: foo')
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Pattern matching

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            As with other union structures in Folktale, Result provides a .matchWith() -method to perform a limited form of pattern matching. Pattern matching allows -one to specify a piece of code for each case in a structure, like an if/else -or switch, but specific to that structure.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            We could use .matchWith() to run different computations depending on whether a -MResult value represents a success or a failure, for example, without the -requirement of having to return a Result:

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -Result.Ok(1).matchWith({
                                                                                                                                                                                                                                                                                                            -  Ok:    ({ value }) => `Ok: ${value}`,
                                                                                                                                                                                                                                                                                                            -  Error: ({ value }) => `Error: ${value}`
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// ==> 'Ok: 1'
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -Result.Error(1).matchWith({
                                                                                                                                                                                                                                                                                                            -  Ok:    ({ value }) => `Ok: ${value}`,
                                                                                                                                                                                                                                                                                                            -  Error: ({ value }) => `Error: ${value}`
                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                            -// ==> 'Error: 1'
                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            How does Result compare to Validation?

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Result and Validation are pretty close structures. They both try to represent -whether a particular thing has failed or succeeded, and even their vocabulary is -very similar (Error vs. Failure, Ok vs. Success). The major difference -is in some of their methods.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            A Result is a data structure that implements the Monad interface (.chain). -This makes Result a pretty good structure to model a sequence of computations -that may fail, where a computation may only run if the previous computation -succeeded. In this sense, a Result's .chain method is very similar to -JavaScript's ; at the end of statements: the statement at the right of the -semicolon only runs if the statement at the left did not throw an error.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            A Validation is a data structure that implements the Applicative interface -(.apply), and does so in a way that if a failure is applied to another -failure, then it results in a new validation that contains the failures of both -validations. In other words, Validation is a data structure made for errors that -can be aggregated, and it makes sense in the contexts of things like form -validations, where you want to display to the user all of the fields that failed -the validation rather than just stopping at the first failure.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Validations can't be as easily used for sequencing operations because the -.apply method takes two validations, so the operations that create them must -have been executed already. While it is possible to use Validations in a -sequential manner, it's better to leave the job to Result, a data structure made -for that.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                                                            Comparing and Testing

                                                                                                                                                                                                                                                                                                            hasInstance(value)

                                                                                                                                                                                                                                                                                                            Checks if a value belongs to this ADT.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Constructing

                                                                                                                                                                                                                                                                                                            Error(value)

                                                                                                                                                                                                                                                                                                            Constructs a Result whose value represents a failure.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental
                                                                                                                                                                                                                                                                                                            Ok(value)

                                                                                                                                                                                                                                                                                                            Constructs a Result whose value represents a success.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental
                                                                                                                                                                                                                                                                                                            of(value)

                                                                                                                                                                                                                                                                                                            Constructs a Result holding an Ok value.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Converting

                                                                                                                                                                                                                                                                                                            toMaybe()

                                                                                                                                                                                                                                                                                                            Transforms a Result into a Maybe. Error values are lost in the process.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental
                                                                                                                                                                                                                                                                                                            toValidation()

                                                                                                                                                                                                                                                                                                            Transforms a Result into a Validation.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Converting from other types

                                                                                                                                                                                                                                                                                                            fromMaybe(aMaybe, failureValue)

                                                                                                                                                                                                                                                                                                            A convenience method for the folktale/data/conversions/maybe-to-result module.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            fromNullable(aNullable)

                                                                                                                                                                                                                                                                                                            A convenience method for the folktale/data/conversions/nullable-to-result -module.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            fromValidation(aValidation)

                                                                                                                                                                                                                                                                                                            A convenience method for the folktale/data/conversions/validation-to-result -module.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Debug Representation

                                                                                                                                                                                                                                                                                                            inspect: toString()

                                                                                                                                                                                                                                                                                                            Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental
                                                                                                                                                                                                                                                                                                            toString()

                                                                                                                                                                                                                                                                                                            Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Extracting values

                                                                                                                                                                                                                                                                                                            get()

                                                                                                                                                                                                                                                                                                            This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Deprecated
                                                                                                                                                                                                                                                                                                            merge()

                                                                                                                                                                                                                                                                                                            Returns the value inside of the Result structure, regardless of its state.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Fantasy Land

                                                                                                                                                                                                                                                                                                            fantasy-land/of(value)

                                                                                                                                                                                                                                                                                                            Fantasy Land's Applicative of

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Handling exceptions

                                                                                                                                                                                                                                                                                                            try: _try(f)

                                                                                                                                                                                                                                                                                                            Runs a function that may raise an exception, trapping it. Returns an Ok with -the return value of the function, if it has finished successfully, or an Error -with the raised exception.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Members

                                                                                                                                                                                                                                                                                                            variants

                                                                                                                                                                                                                                                                                                            The variants present in this ADT.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Serialisation

                                                                                                                                                                                                                                                                                                            fromJSON(value, parsers = { - [typeName]: adt -}, keysIndicateType = false)

                                                                                                                                                                                                                                                                                                            Parses a previously serialised ADT into a rich ADT object.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                                                            Defined in src/data/result/index.js at line 16, column 0
                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                            -  ...require('./result'),
                                                                                                                                                                                                                                                                                                            -  try: require('./try'),
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  /*~
                                                                                                                                                                                                                                                                                                            -   * ---
                                                                                                                                                                                                                                                                                                            -   * category: Converting from other types
                                                                                                                                                                                                                                                                                                            -   * type: |
                                                                                                                                                                                                                                                                                                            -   *   forall a: (a or None) => Result None a
                                                                                                                                                                                                                                                                                                            -   */
                                                                                                                                                                                                                                                                                                            -  fromNullable(aNullable) {
                                                                                                                                                                                                                                                                                                            -    return require('folktale/data/conversions/nullable-to-result')(aNullable);
                                                                                                                                                                                                                                                                                                            -  },
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  /*~
                                                                                                                                                                                                                                                                                                            -   * ---
                                                                                                                                                                                                                                                                                                            -   * category: Converting from other types
                                                                                                                                                                                                                                                                                                            -   * type: |
                                                                                                                                                                                                                                                                                                            -   *   forall a, b: (Validation a b) => Result a b
                                                                                                                                                                                                                                                                                                            -   */
                                                                                                                                                                                                                                                                                                            -  fromValidation(aValidation) {
                                                                                                                                                                                                                                                                                                            -    return require('folktale/data/conversions/validation-to-result')(aValidation);
                                                                                                                                                                                                                                                                                                            -  },
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            -  /*~
                                                                                                                                                                                                                                                                                                            -   * ---
                                                                                                                                                                                                                                                                                                            -   * category: Converting from other types
                                                                                                                                                                                                                                                                                                            -   * type: |
                                                                                                                                                                                                                                                                                                            -   *   forall a, b: (Maybe b, a) => Result a b
                                                                                                                                                                                                                                                                                                            -   */
                                                                                                                                                                                                                                                                                                            -  fromMaybe(aMaybe, failureValue) {
                                                                                                                                                                                                                                                                                                            -    return require('folktale/data/conversions/maybe-to-result')(aMaybe, failureValue);
                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.inspect.html b/docs/api/en/folktale.src.data.result.inspect.html deleted file mode 100644 index 296b74b..0000000 --- a/docs/api/en/folktale.src.data.result.inspect.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - toString - - - - - -

                                                                                                                                                                                                                                                                                                            toString

                                                                                                                                                                                                                                                                                                            Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                                                                            toString()
                                                                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                                                                            () => String

                                                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                                                            Returns a textual representation of the ADT.

                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                                                            () => typeName
                                                                                                                                                                                                                                                                                                            Stability
                                                                                                                                                                                                                                                                                                            experimental
                                                                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                                                                            folktale/src/data/result
                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                            • @boris-marinov
                                                                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.apply.html b/docs/api/en/folktale.src.data.result.result.apply.html deleted file mode 100644 index 22d2521..0000000 --- a/docs/api/en/folktale.src.data.result.result.apply.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - apply - - - - - -

                                                                                                                                                                                                                                                                                                              apply

                                                                                                                                                                                                                                                                                                              Applies the function contained in one Result to the value in another Result. -Application only occurs if both Results are Ok, otherwise keeps the first -Error.

                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                                                                              apply(anResult)
                                                                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                                                                              forall a, b, c:
                                                                                                                                                                                                                                                                                                              -  (Result a ((b) => c)).(Result a b) => Result a c

                                                                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                                                                              Applies the function contained in one Result to the value in another Result. -Application only occurs if both Results are Ok, otherwise keeps the first -Error.

                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                              Note that Result.Ok(x => x + 1).apply(Result.Ok(1)) is equivalent to -Result.Ok(1).map(x => x + 1).

                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                              Example:

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              -function increment(value) {
                                                                                                                                                                                                                                                                                                              -  return value + 1;
                                                                                                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              -Result.Ok(increment).apply(Result.Ok(1));
                                                                                                                                                                                                                                                                                                              -// ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              -Result.Ok(increment).apply(Result.Error(1));
                                                                                                                                                                                                                                                                                                              -// ==> Result.Error(1)
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              -Result.Error(increment).apply(Result.Ok(1));
                                                                                                                                                                                                                                                                                                              -// ==> Result.Error(increment)
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              -Result.Error(increment).apply(Result.Error(1));
                                                                                                                                                                                                                                                                                                              -// ==> Result.Error(increment)
                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                                                                              Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                                                                                              -    Error(anResult) {
                                                                                                                                                                                                                                                                                                              -      assertResult('Result.Error#apply', anResult);
                                                                                                                                                                                                                                                                                                              -      return this;
                                                                                                                                                                                                                                                                                                              -    },
                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              -    Ok(anResult) {
                                                                                                                                                                                                                                                                                                              -      assertResult('Result.Ok#apply', anResult);
                                                                                                                                                                                                                                                                                                              -      return anResult.map(this.value);
                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                              -  }
                                                                                                                                                                                                                                                                                                              Stability
                                                                                                                                                                                                                                                                                                              experimental
                                                                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                                                                              folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.bimap.html b/docs/api/en/folktale.src.data.result.result.bimap.html deleted file mode 100644 index ab3d59f..0000000 --- a/docs/api/en/folktale.src.data.result.result.bimap.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - bimap - - - - - -

                                                                                                                                                                                                                                                                                                                bimap

                                                                                                                                                                                                                                                                                                                Transforms each side of a Result with a function, without changing the context -of the computation. That is, Errors will still be Errors, Oks will still be -Oks.

                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                                                                                                bimap(ErrorTransformation, OkTransformation)
                                                                                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                                                                                (Result a b).((a) => c, (b) => d) => Result c d

                                                                                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                                                                                Transforms each side of a Result with a function, without changing the context -of the computation. That is, Errors will still be Errors, Oks will still be -Oks.

                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                -const inc = (x) => x + 1;
                                                                                                                                                                                                                                                                                                                -const dec = (x) => x - 1;
                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                -Result.Ok(1).bimap(inc, dec);
                                                                                                                                                                                                                                                                                                                -// ==> Result.Ok(dec(1))
                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                -Result.Error(1).bimap(inc, dec);
                                                                                                                                                                                                                                                                                                                -// ==> Result.Error(inc(1))
                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                                                                                Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                                                                -    Error(f, g) {
                                                                                                                                                                                                                                                                                                                -      assertFunction('Result.Error#bimap', f);
                                                                                                                                                                                                                                                                                                                -      assertFunction('Result.Error#bimap', g);
                                                                                                                                                                                                                                                                                                                -      return Error(f(this.value));
                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                -    Ok(f, g) {
                                                                                                                                                                                                                                                                                                                -      assertFunction('Result.Ok#bimap', f);
                                                                                                                                                                                                                                                                                                                -      assertFunction('Result.Ok#bimap', g);
                                                                                                                                                                                                                                                                                                                -      return Ok(g(this.value));
                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                                                                                                Stability
                                                                                                                                                                                                                                                                                                                experimental
                                                                                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                                                                                folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.chain.html b/docs/api/en/folktale.src.data.result.result.chain.html deleted file mode 100644 index 2e56867..0000000 --- a/docs/api/en/folktale.src.data.result.result.chain.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - chain - - - - - -

                                                                                                                                                                                                                                                                                                                  chain

                                                                                                                                                                                                                                                                                                                  Transforms the value and context of a Result computation with an unary function. -As with .map(), the transformation is only applied if the value is an Ok, -but the transformation is expected a new Result value, which then becomes the -result of the method.

                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                                                  chain(transformation)
                                                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                                                  forall a, b, c:
                                                                                                                                                                                                                                                                                                                  -  (Result a b).((b) => Result a c) => Result a c

                                                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                                                  Transforms the value and context of a Result computation with an unary function. -As with .map(), the transformation is only applied if the value is an Ok, -but the transformation is expected a new Result value, which then becomes the -result of the method.

                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                  Example:

                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  -const divideBy = (a) => (b) =>
                                                                                                                                                                                                                                                                                                                  -  b === 0        ?  Result.Error('division by zero')
                                                                                                                                                                                                                                                                                                                  -: /* otherwise */   Result.Ok(a / b);
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  -Result.Ok(4).chain(divideBy(2));
                                                                                                                                                                                                                                                                                                                  -// ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  -Result.Error(4).chain(divideBy(2));
                                                                                                                                                                                                                                                                                                                  -// ==> Result.Error(4)
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  -Result.Ok(4).chain(divideBy(0));
                                                                                                                                                                                                                                                                                                                  -// ==> Result.Error('division by zero')
                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                                                  Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                                                                                                  -    Error(f) {
                                                                                                                                                                                                                                                                                                                  -      assertFunction('Result.Error#chain', f);
                                                                                                                                                                                                                                                                                                                  -      return this;
                                                                                                                                                                                                                                                                                                                  -    },
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  -    Ok(f) {
                                                                                                                                                                                                                                                                                                                  -      assertFunction('Result.Ok#chain', f);
                                                                                                                                                                                                                                                                                                                  -      return f(this.value);
                                                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                                                                  Stability
                                                                                                                                                                                                                                                                                                                  experimental
                                                                                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                                                                                  folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.errorMap.html b/docs/api/en/folktale.src.data.result.result.errorMap.html deleted file mode 100644 index feead67..0000000 --- a/docs/api/en/folktale.src.data.result.result.errorMap.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - errorMap - - - - - -

                                                                                                                                                                                                                                                                                                                    errorMap

                                                                                                                                                                                                                                                                                                                    Transforms the value of Error Results.

                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                                                                                    errorMap(transformation)
                                                                                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                                                                                    forall a, b, c:
                                                                                                                                                                                                                                                                                                                    -  (Result a b).((a) => c) => Result c b

                                                                                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                                                                                    Transforms the value of Error Results.

                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                    Example:

                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                    Error(1).errorMap(x => x + 1);   // ==> Result.Error(2)
                                                                                                                                                                                                                                                                                                                    -Ok(1).errorMap(x => x + 1);  // ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                                                                                    Defined in src/data/result/result.js at line 61, column 19
                                                                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                                                                    -    Error(f) {
                                                                                                                                                                                                                                                                                                                    -      assertFunction('Result.Error#errorMap', f);
                                                                                                                                                                                                                                                                                                                    -      return Error(f(this.value));
                                                                                                                                                                                                                                                                                                                    -    },
                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                    -    Ok(f) {
                                                                                                                                                                                                                                                                                                                    -      assertFunction('Result.Ok#errorMap', f);
                                                                                                                                                                                                                                                                                                                    -      return this;
                                                                                                                                                                                                                                                                                                                    -    }
                                                                                                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                                                                                                    Stability
                                                                                                                                                                                                                                                                                                                    experimental
                                                                                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                                                                                    folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.fold.html b/docs/api/en/folktale.src.data.result.result.fold.html deleted file mode 100644 index 400128d..0000000 --- a/docs/api/en/folktale.src.data.result.result.fold.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - fold - - - - - -

                                                                                                                                                                                                                                                                                                                      fold

                                                                                                                                                                                                                                                                                                                      Applies a function to each case of a Result.

                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                                                                                      fold(ErrorTransformation, OkTransformation)
                                                                                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                                                                                      forall a, b, c:
                                                                                                                                                                                                                                                                                                                      -  (Result a b).((a) => c, (b) => c) => c

                                                                                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                                                                                      Applies a function to each case of a Result.

                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                      Example:

                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                      const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                      -const inc = (x) => x + 1;
                                                                                                                                                                                                                                                                                                                      -const dec = (x) => x - 1;
                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                      -Result.Error(1).fold(inc, dec);
                                                                                                                                                                                                                                                                                                                      -// ==> inc(1)
                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                      -Result.Ok(1).fold(inc, dec);
                                                                                                                                                                                                                                                                                                                      -// ==> dec(1)
                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                                                                                      Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                      -    Error(f, g) {
                                                                                                                                                                                                                                                                                                                      -      assertFunction('Result.Error#fold', f);
                                                                                                                                                                                                                                                                                                                      -      assertFunction('Result.Error#fold', g);
                                                                                                                                                                                                                                                                                                                      -      return f(this.value);
                                                                                                                                                                                                                                                                                                                      -    },
                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                      -    Ok(f, g) {
                                                                                                                                                                                                                                                                                                                      -      assertFunction('Result.Ok#fold', f);
                                                                                                                                                                                                                                                                                                                      -      assertFunction('Result.Ok#fold', g);
                                                                                                                                                                                                                                                                                                                      -      return g(this.value);
                                                                                                                                                                                                                                                                                                                      -    }
                                                                                                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                                                                                                      Stability
                                                                                                                                                                                                                                                                                                                      experimental
                                                                                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                                                                                      folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.get.html b/docs/api/en/folktale.src.data.result.result.get.html deleted file mode 100644 index 7e991d0..0000000 --- a/docs/api/en/folktale.src.data.result.result.get.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - get - - - - - -

                                                                                                                                                                                                                                                                                                                        get

                                                                                                                                                                                                                                                                                                                        This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                                                                                        get()
                                                                                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                                                                                        forall a, b: (Result a b).() => b :: (throws TypeError)
                                                                                                                                                                                                                                                                                                                        Deprecated since 2.0.0

                                                                                                                                                                                                                                                                                                                        We want to discourage the use of partial functions, and having short names -makes it easy for people to want to use them without thinking about the -problems.

                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                        For more details see https://github.com/origamitower/folktale/issues/42

                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                                                                                        This method has been renamed to unsafeGet().

                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                                                                                        Defined in src/data/result/result.js at line 302, column 22
                                                                                                                                                                                                                                                                                                                        'get'() {
                                                                                                                                                                                                                                                                                                                        -    warnDeprecation('`.get()` is deprecated, and has been renamed to `.unsafeGet()`.');
                                                                                                                                                                                                                                                                                                                        -    return this.unsafeGet();
                                                                                                                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                                                                                                                        Stability
                                                                                                                                                                                                                                                                                                                        deprecated
                                                                                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                                                                                        folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.getOrElse.html b/docs/api/en/folktale.src.data.result.result.getOrElse.html deleted file mode 100644 index 1f0d93b..0000000 --- a/docs/api/en/folktale.src.data.result.result.getOrElse.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - getOrElse - - - - - -

                                                                                                                                                                                                                                                                                                                          getOrElse

                                                                                                                                                                                                                                                                                                                          Extracts the value of a Result structure, if it exists (i.e.: is an Ok), -otherwise returns the provided default value.

                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                                                                                          getOrElse(default)
                                                                                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                                                                                          forall a, b: (Result a b).(b) => b

                                                                                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                                                                                          Extracts the value of a Result structure, if it exists (i.e.: is an Ok), -otherwise returns the provided default value.

                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                          Example:

                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                          const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                          -Result.Ok(1).getOrElse(2);
                                                                                                                                                                                                                                                                                                                          -// ==> 1
                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                          -Result.Error(1).getOrElse(2);
                                                                                                                                                                                                                                                                                                                          -// ==> 2
                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                                                                                          Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                          {
                                                                                                                                                                                                                                                                                                                          -    Error(default_) {
                                                                                                                                                                                                                                                                                                                          -      return default_;
                                                                                                                                                                                                                                                                                                                          -    },
                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                          -    Ok(default_) {
                                                                                                                                                                                                                                                                                                                          -      return this.value;
                                                                                                                                                                                                                                                                                                                          -    }
                                                                                                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                                                                                                          Stability
                                                                                                                                                                                                                                                                                                                          experimental
                                                                                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                                                                                          folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.map.html b/docs/api/en/folktale.src.data.result.result.map.html deleted file mode 100644 index f545285..0000000 --- a/docs/api/en/folktale.src.data.result.result.map.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - map - - - - - -

                                                                                                                                                                                                                                                                                                                            map

                                                                                                                                                                                                                                                                                                                            Transforms the value inside of a Result structure with an unary function without -changing the context of the computation. That is, Error values continue to be -Error values, and Ok values continue to be Ok values.

                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                                                                                            map(transformation)
                                                                                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                                                                                            forall a, b, c:
                                                                                                                                                                                                                                                                                                                            -  (Result a b).((b) => c) => Result a c

                                                                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                                                                            Transforms the value inside of a Result structure with an unary function without -changing the context of the computation. That is, Error values continue to be -Error values, and Ok values continue to be Ok values.

                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                            Example:

                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                            -function increment(value) {
                                                                                                                                                                                                                                                                                                                            -  return value + 1;
                                                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                            -Result.Ok(1).map(increment);
                                                                                                                                                                                                                                                                                                                            -// ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                            -Result.Error(1).map(increment);
                                                                                                                                                                                                                                                                                                                            -// ==> Result.Error(2)
                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                                                                            Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                                            -    Error(f) {
                                                                                                                                                                                                                                                                                                                            -      assertFunction('Result.Error#map', f);
                                                                                                                                                                                                                                                                                                                            -      return this;
                                                                                                                                                                                                                                                                                                                            -    },
                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                            -    Ok(f) {
                                                                                                                                                                                                                                                                                                                            -      assertFunction('Result.Ok#map', f);
                                                                                                                                                                                                                                                                                                                            -      return Ok(f(this.value));
                                                                                                                                                                                                                                                                                                                            -    }
                                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                                            Stability
                                                                                                                                                                                                                                                                                                                            experimental
                                                                                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                                                                                            folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.mapError.html b/docs/api/en/folktale.src.data.result.result.mapError.html deleted file mode 100644 index 16a6beb..0000000 --- a/docs/api/en/folktale.src.data.result.result.mapError.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - mapError - - - - - -

                                                                                                                                                                                                                                                                                                                              mapError

                                                                                                                                                                                                                                                                                                                              Transforms the value inside an Error without changing the context of the -computation.

                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                                                                                              mapError(transformation)
                                                                                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                                                                                              forall a, b, c:
                                                                                                                                                                                                                                                                                                                              -  (Result a b).((a) => c) => Result c b

                                                                                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                                                                                              Transforms the value inside an Error without changing the context of the -computation.

                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                              This is similar to .map, except it operates on Errors instead of Oks.

                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                              Example:

                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                              const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                              -Result.Error(1).mapError(x => x + 1);
                                                                                                                                                                                                                                                                                                                              -// ==> Result.Error(2)
                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                              -Result.Ok(1).mapError(x => x + 1);
                                                                                                                                                                                                                                                                                                                              -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                                                                                              Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                                                                                                              -    Error(f) {
                                                                                                                                                                                                                                                                                                                              -      assertFunction('Result.Error#mapError', f);
                                                                                                                                                                                                                                                                                                                              -      return Error(f(this.value));
                                                                                                                                                                                                                                                                                                                              -    },
                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                              -    Ok(f) {
                                                                                                                                                                                                                                                                                                                              -      assertFunction('Result.Ok#mapError', f);
                                                                                                                                                                                                                                                                                                                              -      return this;
                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                              -  }
                                                                                                                                                                                                                                                                                                                              Stability
                                                                                                                                                                                                                                                                                                                              experimental
                                                                                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                                                                                              folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.merge.html b/docs/api/en/folktale.src.data.result.result.merge.html deleted file mode 100644 index 461cd71..0000000 --- a/docs/api/en/folktale.src.data.result.result.merge.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - merge - - - - - -

                                                                                                                                                                                                                                                                                                                                merge

                                                                                                                                                                                                                                                                                                                                Returns the value inside of the Result structure, regardless of its state.

                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                                                                                                                merge()
                                                                                                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                                                                                                forall a, b: (Result a b).() => a or b

                                                                                                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                                                                                                Returns the value inside of the Result structure, regardless of its state.

                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                -Result.Ok(1).merge();
                                                                                                                                                                                                                                                                                                                                -// ==> 1
                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                -Result.Error(1).merge();
                                                                                                                                                                                                                                                                                                                                -// ==> 1
                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                                                                                                Defined in src/data/result/result.js at line 302, column 22
                                                                                                                                                                                                                                                                                                                                merge(){
                                                                                                                                                                                                                                                                                                                                -    return this.value;
                                                                                                                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                                                                                                                Stability
                                                                                                                                                                                                                                                                                                                                experimental
                                                                                                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                                                                                                folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                                                • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.of.html b/docs/api/en/folktale.src.data.result.result.of.html deleted file mode 100644 index 5bbb26a..0000000 --- a/docs/api/en/folktale.src.data.result.result.of.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - of - - - - - -

                                                                                                                                                                                                                                                                                                                                  of

                                                                                                                                                                                                                                                                                                                                  Constructs a Result holding an Ok value.

                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                                                                  of(value)
                                                                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                                                                  forall a, b: (b) => Result a b

                                                                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                                                                  Constructs a Result holding an Ok value.

                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                  Example:

                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                  const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                  -Result.of(1);
                                                                                                                                                                                                                                                                                                                                  -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                                                                  Defined in src/data/result/result.js at line 302, column 22
                                                                                                                                                                                                                                                                                                                                  of(value) {
                                                                                                                                                                                                                                                                                                                                  -    return Ok(value);
                                                                                                                                                                                                                                                                                                                                  -  }
                                                                                                                                                                                                                                                                                                                                  Stability
                                                                                                                                                                                                                                                                                                                                  experimental
                                                                                                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                                                                                                  folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.orElse.html b/docs/api/en/folktale.src.data.result.result.orElse.html deleted file mode 100644 index 1a14331..0000000 --- a/docs/api/en/folktale.src.data.result.result.orElse.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - orElse - - - - - -

                                                                                                                                                                                                                                                                                                                                    orElse

                                                                                                                                                                                                                                                                                                                                    Allows recovering from Error values with a handler function.

                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                                                                                                    orElse(handler)
                                                                                                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                                                                                                    forall a, b, c:
                                                                                                                                                                                                                                                                                                                                    -  (Result a b).((a) => Result c b) => Result c b

                                                                                                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                                                                                                    Allows recovering from Error values with a handler function.

                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                    While .chain() allows one to sequence operations, such that the second -operation is ran only if the first one succeeds, the .orElse() method allows -one to recover from an Error by running a function that provides a new Result -value.

                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                    Example:

                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                    const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                    -Result.Ok(4).orElse(error => Result.Ok(error + 1));
                                                                                                                                                                                                                                                                                                                                    -// ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                    -Result.Error(4).orElse(error => Result.Ok(error + 1));
                                                                                                                                                                                                                                                                                                                                    -// ==> Result.Ok(5)
                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                    -Result.Error(4).orElse(error => Result.Error(error - 1));
                                                                                                                                                                                                                                                                                                                                    -// ==> Result.Error(3)
                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                                                                                                    Experimental

                                                                                                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                                                                                                    Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                                                                                    -    Error(handler) {
                                                                                                                                                                                                                                                                                                                                    -      assertFunction('Result.Error#orElse', handler);
                                                                                                                                                                                                                                                                                                                                    -      return handler(this.value);
                                                                                                                                                                                                                                                                                                                                    -    },
                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                    -    Ok(handler) {
                                                                                                                                                                                                                                                                                                                                    -      assertFunction('Result.Ok#orElse', handler);
                                                                                                                                                                                                                                                                                                                                    -      return this;
                                                                                                                                                                                                                                                                                                                                    -    }
                                                                                                                                                                                                                                                                                                                                    -  }
                                                                                                                                                                                                                                                                                                                                    Stability
                                                                                                                                                                                                                                                                                                                                    experimental
                                                                                                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                                                                                                    folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.swap.html b/docs/api/en/folktale.src.data.result.result.swap.html deleted file mode 100644 index 3746a29..0000000 --- a/docs/api/en/folktale.src.data.result.result.swap.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - swap - - - - - -

                                                                                                                                                                                                                                                                                                                                      swap

                                                                                                                                                                                                                                                                                                                                      Inverts the context of a Result value such that Errors are transformed into Oks, -and Oks are transformed into Errors. Does not touch the value inside of the -Result.

                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                                                                                                      swap()
                                                                                                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                                                                                                      forall a, b: (Result a b).() => Result b a

                                                                                                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                                                                                                      Inverts the context of a Result value such that Errors are transformed into Oks, -and Oks are transformed into Errors. Does not touch the value inside of the -Result.

                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                      Example:

                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                      const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                      -Result.Ok(1).swap();
                                                                                                                                                                                                                                                                                                                                      -// ==> Result.Error(1)
                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                      -Result.Error(1).swap();
                                                                                                                                                                                                                                                                                                                                      -// ==> Result.Ok(1)
                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                                                                                                      Experimental

                                                                                                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                                                                                                      Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                      -    Error() {
                                                                                                                                                                                                                                                                                                                                      -      return Ok(this.value);
                                                                                                                                                                                                                                                                                                                                      -    },
                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                      -    Ok() {
                                                                                                                                                                                                                                                                                                                                      -      return Error(this.value);
                                                                                                                                                                                                                                                                                                                                      -    }
                                                                                                                                                                                                                                                                                                                                      -  }
                                                                                                                                                                                                                                                                                                                                      Stability
                                                                                                                                                                                                                                                                                                                                      experimental
                                                                                                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                                                                                                      folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.toMaybe.html b/docs/api/en/folktale.src.data.result.result.toMaybe.html deleted file mode 100644 index 6d6d1cc..0000000 --- a/docs/api/en/folktale.src.data.result.result.toMaybe.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - toMaybe - - - - - -

                                                                                                                                                                                                                                                                                                                                        toMaybe

                                                                                                                                                                                                                                                                                                                                        Transforms a Result into a Maybe. Error values are lost in the process.

                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                                                                                                        toMaybe()
                                                                                                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                                                                                                        forall a, b: (Result a b).() => Maybe b

                                                                                                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                                                                                                        Transforms a Result into a Maybe. Error values are lost in the process.

                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                        Example:

                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                        const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                        -const Maybe = require('folktale/data/maybe');
                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                        -Result.Ok(1).toMaybe();
                                                                                                                                                                                                                                                                                                                                        -// ==> Maybe.Just(1)
                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                        -Result.Error(1).toMaybe();
                                                                                                                                                                                                                                                                                                                                        -// ==> Maybe.Nothing()
                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                                                                                                        Defined in src/data/result/result.js at line 302, column 22
                                                                                                                                                                                                                                                                                                                                        toMaybe() {
                                                                                                                                                                                                                                                                                                                                        -    return require('folktale/data/conversions/result-to-maybe')(this);
                                                                                                                                                                                                                                                                                                                                        -  }
                                                                                                                                                                                                                                                                                                                                        Stability
                                                                                                                                                                                                                                                                                                                                        experimental
                                                                                                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                                                                                                        folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.toValidation.html b/docs/api/en/folktale.src.data.result.result.toValidation.html deleted file mode 100644 index 6fd4e5a..0000000 --- a/docs/api/en/folktale.src.data.result.result.toValidation.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - toValidation - - - - - -

                                                                                                                                                                                                                                                                                                                                          toValidation

                                                                                                                                                                                                                                                                                                                                          Transforms a Result into a Validation.

                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                                                                                                          toValidation()
                                                                                                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                                                                                                          forall a, b: (Result a b).() => Validation a b

                                                                                                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                                                                                                          Transforms a Result into a Validation.

                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                          Result's Oks are mapped into Validation's Successes, and Result's Errors -are mapped into Validation's Failures.

                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                          Example:

                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                          const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                          -const Validation = require('folktale/data/validation');
                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                          -Result.Ok(1).toValidation();
                                                                                                                                                                                                                                                                                                                                          -// ==> Validation.Success(1)
                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                          -Result.Error(1).toValidation();
                                                                                                                                                                                                                                                                                                                                          -// ==> Validation.Failure(1)
                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                                                                                                          Defined in src/data/result/result.js at line 302, column 22
                                                                                                                                                                                                                                                                                                                                          toValidation() {
                                                                                                                                                                                                                                                                                                                                          -    return require('folktale/data/conversions/result-to-validation')(this);
                                                                                                                                                                                                                                                                                                                                          -  }
                                                                                                                                                                                                                                                                                                                                          Stability
                                                                                                                                                                                                                                                                                                                                          experimental
                                                                                                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                                                                                                          folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.unsafeGet.html b/docs/api/en/folktale.src.data.result.result.unsafeGet.html deleted file mode 100644 index c3faa2c..0000000 --- a/docs/api/en/folktale.src.data.result.result.unsafeGet.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - unsafeGet - - - - - -

                                                                                                                                                                                                                                                                                                                                            unsafeGet

                                                                                                                                                                                                                                                                                                                                            Extracts the value from a Result structure.

                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                                                                                                            unsafeGet()
                                                                                                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                                                                                                            forall a, b: (Result a b).() => b :: throws TypeError

                                                                                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                                                                                            Extracts the value from a Result structure.

                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                            WARNING
                                                                                                                                                                                                                                                                                                                                            This method is partial, which means that it will only work for Ok -structures, not for Error structures. It's recommended to use .getOrElse() -or .matchWith() instead.

                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                            Example:

                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -Result.Ok(1).unsafeGet();
                                                                                                                                                                                                                                                                                                                                            -// ==> 1
                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -try {
                                                                                                                                                                                                                                                                                                                                            -  Result.Error(1).unsafeGet();
                                                                                                                                                                                                                                                                                                                                            -  // TypeError: Can't extract the value of an Error
                                                                                                                                                                                                                                                                                                                                            -} catch (e) {
                                                                                                                                                                                                                                                                                                                                            -  e instanceof TypeError; // ==> true
                                                                                                                                                                                                                                                                                                                                            -}
                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                                                                                                            Experimental

                                                                                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                                                                                            Defined in src/data/result/result.js at line 82, column 19
                                                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                                                            -    Error() {
                                                                                                                                                                                                                                                                                                                                            -      throw new TypeError(`Can't extract the value of an Error.
                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -Error does not contain a normal value - it contains an error.
                                                                                                                                                                                                                                                                                                                                            -You might consider switching from Result#unsafeGet to Result#getOrElse,
                                                                                                                                                                                                                                                                                                                                            -or some other method that is not partial.
                                                                                                                                                                                                                                                                                                                                            -      `);
                                                                                                                                                                                                                                                                                                                                            -    },
                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                            -    Ok() {
                                                                                                                                                                                                                                                                                                                                            -      return this.value;
                                                                                                                                                                                                                                                                                                                                            -    }
                                                                                                                                                                                                                                                                                                                                            -  }
                                                                                                                                                                                                                                                                                                                                            Stability
                                                                                                                                                                                                                                                                                                                                            experimental
                                                                                                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                                                                                                            folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.result.value.html b/docs/api/en/folktale.src.data.result.result.value.html deleted file mode 100644 index 0129659..0000000 --- a/docs/api/en/folktale.src.data.result.result.value.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - value - - - - - -

                                                                                                                                                                                                                                                                                                                                              value

                                                                                                                                                                                                                                                                                                                                              The value contained in an Error instance of the Result structure.

                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                                                                                                              get value()
                                                                                                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                                                                                                              forall a, b: get (Result a b) => a

                                                                                                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                                                                                                              The value contained in an Error instance of the Result structure.

                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                              This is usually used to destructure the instance in a .matchWith call.

                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                              Example:

                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                              const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                              -Result.Error(1).matchWith({
                                                                                                                                                                                                                                                                                                                                              -  Error: ({ value }) => value,    // equivalent to (x) => x.value
                                                                                                                                                                                                                                                                                                                                              -  Ok:    ({ value }) => 'nothing'
                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                              -// ==> 1
                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                                                                                                              Defined in src/data/result/result.js at line 50, column 24
                                                                                                                                                                                                                                                                                                                                              get value() {
                                                                                                                                                                                                                                                                                                                                              -    throw new TypeError('`value` can’t be accessed in an abstract instance of Result.Error');
                                                                                                                                                                                                                                                                                                                                              -  }
                                                                                                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                                                                                                              folktale/src/data/result/result
                                                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.data.result.try.try.html b/docs/api/en/folktale.src.data.result.try.try.html deleted file mode 100644 index 87b33d4..0000000 --- a/docs/api/en/folktale.src.data.result.try.try.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - _try - - - - - -

                                                                                                                                                                                                                                                                                                                                                _try

                                                                                                                                                                                                                                                                                                                                                Runs a function that may raise an exception, trapping it. Returns an Ok with -the return value of the function, if it has finished successfully, or an Error -with the raised exception.

                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                Signature

                                                                                                                                                                                                                                                                                                                                                _try(f)
                                                                                                                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                                                                                                                forall a, b: (() => b :: throws a) => Result a b

                                                                                                                                                                                                                                                                                                                                                Documentation

                                                                                                                                                                                                                                                                                                                                                Runs a function that may raise an exception, trapping it. Returns an Ok with -the return value of the function, if it has finished successfully, or an Error -with the raised exception.

                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                Example:

                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                function successor(natural) {
                                                                                                                                                                                                                                                                                                                                                -  if (natural < 0) {
                                                                                                                                                                                                                                                                                                                                                -    throw `Not a natural number: ${natural}`;
                                                                                                                                                                                                                                                                                                                                                -  } else {
                                                                                                                                                                                                                                                                                                                                                -    return natural + 1;
                                                                                                                                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                -const Result = require('folktale/data/result');
                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                -Result.try(() => successor(-1));
                                                                                                                                                                                                                                                                                                                                                -// ==> Result.Error('Not a natural number: -1')
                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                -Result.try(() => successor(1));
                                                                                                                                                                                                                                                                                                                                                -// ==> Result.Ok(2)
                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                                                                                                (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                Experimental

                                                                                                                                                                                                                                                                                                                                                Source Code

                                                                                                                                                                                                                                                                                                                                                Defined in src/data/result/try.js at line 22, column 0
                                                                                                                                                                                                                                                                                                                                                (f) => {
                                                                                                                                                                                                                                                                                                                                                -  try {
                                                                                                                                                                                                                                                                                                                                                -    return Ok(f());
                                                                                                                                                                                                                                                                                                                                                -  } catch (e) {
                                                                                                                                                                                                                                                                                                                                                -    return Error(e);
                                                                                                                                                                                                                                                                                                                                                -  }
                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                Stability
                                                                                                                                                                                                                                                                                                                                                experimental
                                                                                                                                                                                                                                                                                                                                                Licence
                                                                                                                                                                                                                                                                                                                                                MIT
                                                                                                                                                                                                                                                                                                                                                Module
                                                                                                                                                                                                                                                                                                                                                folktale/src/data/result/try
                                                                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                                                                Authors
                                                                                                                                                                                                                                                                                                                                                • @boris-marinov
                                                                                                                                                                                                                                                                                                                                                Maintainers
                                                                                                                                                                                                                                                                                                                                                  - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.ap.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.ap.html deleted file mode 100644 index fb93c01..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.ap.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - ap - - - - - -

                                                                                                                                                                                                                                                                                                                                                  ap

                                                                                                                                                                                                                                                                                                                                                  Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                  Signature

                                                                                                                                                                                                                                                                                                                                                  ap(that)
                                                                                                                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                                                                                                                  ('F ('a) => b).('F 'a) => 'F 'b
                                                                                                                                                                                                                                                                                                                                                  -where 'F is Apply

                                                                                                                                                                                                                                                                                                                                                  Documentation

                                                                                                                                                                                                                                                                                                                                                  Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                                                                                                  (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                  Source Code

                                                                                                                                                                                                                                                                                                                                                  Defined in src/helpers/provide-fantasy-land-aliases.js at line 68, column 9
                                                                                                                                                                                                                                                                                                                                                  ap(that) {
                                                                                                                                                                                                                                                                                                                                                  -      return this.apply(that);
                                                                                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                                                                                  Licence
                                                                                                                                                                                                                                                                                                                                                  MIT
                                                                                                                                                                                                                                                                                                                                                  Module
                                                                                                                                                                                                                                                                                                                                                  folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                                                                  Authors
                                                                                                                                                                                                                                                                                                                                                  • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                  Maintainers
                                                                                                                                                                                                                                                                                                                                                    - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/ap.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/ap.html deleted file mode 100644 index 5ee120b..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/ap.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - fantasy-land/ap - - - - - -

                                                                                                                                                                                                                                                                                                                                                    fantasy-land/ap

                                                                                                                                                                                                                                                                                                                                                    Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                    Signature

                                                                                                                                                                                                                                                                                                                                                    fantasy-land/ap(that)
                                                                                                                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                                                                                                                    ('F 'a).('F ('a) => 'b) => 'F 'b
                                                                                                                                                                                                                                                                                                                                                    -where 'F is Apply

                                                                                                                                                                                                                                                                                                                                                    Documentation

                                                                                                                                                                                                                                                                                                                                                    Fantasy Land's Apply ap

                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                    Properties

                                                                                                                                                                                                                                                                                                                                                    (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                    Source Code

                                                                                                                                                                                                                                                                                                                                                    Defined in src/helpers/provide-fantasy-land-aliases.js at line 68, column 9
                                                                                                                                                                                                                                                                                                                                                    'fantasy-land/ap'(that) {
                                                                                                                                                                                                                                                                                                                                                    -      return that.apply(this);
                                                                                                                                                                                                                                                                                                                                                    -    }
                                                                                                                                                                                                                                                                                                                                                    Licence
                                                                                                                                                                                                                                                                                                                                                    MIT
                                                                                                                                                                                                                                                                                                                                                    Module
                                                                                                                                                                                                                                                                                                                                                    folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                                                                    Authors
                                                                                                                                                                                                                                                                                                                                                    • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                    Maintainers
                                                                                                                                                                                                                                                                                                                                                      - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/bimap.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/bimap.html deleted file mode 100644 index ce1c6d2..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/bimap.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - fantasy-land/bimap - - - - - -

                                                                                                                                                                                                                                                                                                                                                      fantasy-land/bimap

                                                                                                                                                                                                                                                                                                                                                      Fantasy Land’s Bifunctor bimap

                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                      Signature

                                                                                                                                                                                                                                                                                                                                                      fantasy-land/bimap(f, g)
                                                                                                                                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                                                                                                                                      forall F, a, b, c, d:
                                                                                                                                                                                                                                                                                                                                                      -  (F a b).((a) => c, (b) => d) => F c d
                                                                                                                                                                                                                                                                                                                                                      -where F is Bifunctor

                                                                                                                                                                                                                                                                                                                                                      Documentation

                                                                                                                                                                                                                                                                                                                                                      Fantasy Land’s Bifunctor bimap

                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                      Properties

                                                                                                                                                                                                                                                                                                                                                      (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                      Source Code

                                                                                                                                                                                                                                                                                                                                                      Defined in src/helpers/provide-fantasy-land-aliases.js at line 218, column 9
                                                                                                                                                                                                                                                                                                                                                      'fantasy-land/bimap'(f, g) {
                                                                                                                                                                                                                                                                                                                                                      -      return this.bimap(f, g);
                                                                                                                                                                                                                                                                                                                                                      -    }
                                                                                                                                                                                                                                                                                                                                                      Licence
                                                                                                                                                                                                                                                                                                                                                      MIT
                                                                                                                                                                                                                                                                                                                                                      Module
                                                                                                                                                                                                                                                                                                                                                      folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                                                                      Authors
                                                                                                                                                                                                                                                                                                                                                      • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                      Maintainers
                                                                                                                                                                                                                                                                                                                                                        - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/chain.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/chain.html deleted file mode 100644 index 3d465b6..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/chain.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - fantasy-land/chain - - - - - -

                                                                                                                                                                                                                                                                                                                                                        fantasy-land/chain

                                                                                                                                                                                                                                                                                                                                                        Fantasy Land’s Chain chain.

                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                        Signature

                                                                                                                                                                                                                                                                                                                                                        fantasy-land/chain(transformation)
                                                                                                                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                                                                                                                        forall M, a, b:
                                                                                                                                                                                                                                                                                                                                                        -  (M a).((a) => M b) => M b
                                                                                                                                                                                                                                                                                                                                                        -where M is Chain

                                                                                                                                                                                                                                                                                                                                                        Documentation

                                                                                                                                                                                                                                                                                                                                                        Fantasy Land’s Chain chain.

                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                        Properties

                                                                                                                                                                                                                                                                                                                                                        (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                        Source Code

                                                                                                                                                                                                                                                                                                                                                        Defined in src/helpers/provide-fantasy-land-aliases.js at line 139, column 9
                                                                                                                                                                                                                                                                                                                                                        'fantasy-land/chain'(transformation) {
                                                                                                                                                                                                                                                                                                                                                        -      return this.chain(transformation);
                                                                                                                                                                                                                                                                                                                                                        -    }
                                                                                                                                                                                                                                                                                                                                                        Licence
                                                                                                                                                                                                                                                                                                                                                        MIT
                                                                                                                                                                                                                                                                                                                                                        Module
                                                                                                                                                                                                                                                                                                                                                        folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                                                                        Authors
                                                                                                                                                                                                                                                                                                                                                        • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                        Maintainers
                                                                                                                                                                                                                                                                                                                                                          - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/equals.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/equals.html deleted file mode 100644 index 27a4b92..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/equals.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - fantasy-land/equals - - - - - -

                                                                                                                                                                                                                                                                                                                                                          fantasy-land/equals

                                                                                                                                                                                                                                                                                                                                                          Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                          Signature

                                                                                                                                                                                                                                                                                                                                                          fantasy-land/equals(that)
                                                                                                                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                                                                                                                          ('S 'a).('S 'a) => Boolean
                                                                                                                                                                                                                                                                                                                                                          -where 'S is Setoid

                                                                                                                                                                                                                                                                                                                                                          Documentation

                                                                                                                                                                                                                                                                                                                                                          Fantasy Land's Setoid `equals'.

                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                          Properties

                                                                                                                                                                                                                                                                                                                                                          (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                          Source Code

                                                                                                                                                                                                                                                                                                                                                          Defined in src/helpers/provide-fantasy-land-aliases.js at line 12, column 10
                                                                                                                                                                                                                                                                                                                                                          'fantasy-land/equals'(that) {
                                                                                                                                                                                                                                                                                                                                                          -      return this.equals(that);
                                                                                                                                                                                                                                                                                                                                                          -    }
                                                                                                                                                                                                                                                                                                                                                          Licence
                                                                                                                                                                                                                                                                                                                                                          MIT
                                                                                                                                                                                                                                                                                                                                                          Module
                                                                                                                                                                                                                                                                                                                                                          folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                                                                          Authors
                                                                                                                                                                                                                                                                                                                                                          • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                          Maintainers
                                                                                                                                                                                                                                                                                                                                                            - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/map.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/map.html deleted file mode 100644 index 6806689..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/map.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - fantasy-land/map - - - - - -

                                                                                                                                                                                                                                                                                                                                                            fantasy-land/map

                                                                                                                                                                                                                                                                                                                                                            Fantasy Land's Functor map.

                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                            Signature

                                                                                                                                                                                                                                                                                                                                                            fantasy-land/map(transformation)
                                                                                                                                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                                                                                                                                            ('F 'a).(('a) => 'b) => 'F 'b
                                                                                                                                                                                                                                                                                                                                                            -where 'F is Functor

                                                                                                                                                                                                                                                                                                                                                            Documentation

                                                                                                                                                                                                                                                                                                                                                            Fantasy Land's Functor map.

                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                                                                                                                            (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                            Source Code

                                                                                                                                                                                                                                                                                                                                                            Defined in src/helpers/provide-fantasy-land-aliases.js at line 54, column 7
                                                                                                                                                                                                                                                                                                                                                            'fantasy-land/map'(transformation) {
                                                                                                                                                                                                                                                                                                                                                            -      return this.map(transformation);
                                                                                                                                                                                                                                                                                                                                                            -    }
                                                                                                                                                                                                                                                                                                                                                            Licence
                                                                                                                                                                                                                                                                                                                                                            MIT
                                                                                                                                                                                                                                                                                                                                                            Module
                                                                                                                                                                                                                                                                                                                                                            folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                                                                            Authors
                                                                                                                                                                                                                                                                                                                                                            • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                            Maintainers
                                                                                                                                                                                                                                                                                                                                                              - - - - \ No newline at end of file diff --git a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/of.html b/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/of.html deleted file mode 100644 index 845c707..0000000 --- a/docs/api/en/folktale.src.helpers.provide-fantasy-land-aliases.fantasy-land/of.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - fantasy-land/of - - - - - -

                                                                                                                                                                                                                                                                                                                                                              fantasy-land/of

                                                                                                                                                                                                                                                                                                                                                              Fantasy Land's Applicative of

                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                              Signature

                                                                                                                                                                                                                                                                                                                                                              fantasy-land/of(value)
                                                                                                                                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                                                                                                                                              forall F, a:
                                                                                                                                                                                                                                                                                                                                                              -  (F).(a) => F a
                                                                                                                                                                                                                                                                                                                                                              -where F is Applicative

                                                                                                                                                                                                                                                                                                                                                              Documentation

                                                                                                                                                                                                                                                                                                                                                              Fantasy Land's Applicative of

                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                                                                                                                              (Uncategorised)

                                                                                                                                                                                                                                                                                                                                                              Source Code

                                                                                                                                                                                                                                                                                                                                                              Defined in src/helpers/provide-fantasy-land-aliases.js at line 94, column 6
                                                                                                                                                                                                                                                                                                                                                              'fantasy-land/of'(value) {
                                                                                                                                                                                                                                                                                                                                                              -      return this.of(value);
                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                              Licence
                                                                                                                                                                                                                                                                                                                                                              MIT
                                                                                                                                                                                                                                                                                                                                                              Module
                                                                                                                                                                                                                                                                                                                                                              folktale/src/helpers/provide-fantasy-land-aliases
                                                                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                                                                              Authors
                                                                                                                                                                                                                                                                                                                                                              • Quildreen Motta
                                                                                                                                                                                                                                                                                                                                                              Maintainers
                                                                                                                                                                                                                                                                                                                                                                - - - - \ No newline at end of file diff --git a/docs/api/en/style.css b/docs/api/en/style.css index d7cfd36..15da5ee 100644 --- a/docs/api/en/style.css +++ b/docs/api/en/style.css @@ -578,3 +578,39 @@ pre code[class*="language-"] { margin-left: 5px; font-variant: small-caps; } +#header .navigation { + float: right; + font-size: 80%; + list-style: none; + margin: 0; +} +#header .navigation-item { + display: inline-block; + margin: 0 0 0 0.2em; + padding: 0 0.5em; + border-bottom: 0px solid #2c3e50; +} +#header .navigation-item:hover { + border-bottom-width: 5px; + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + -ms-transition: none; + transition: none; +} +#header .navigation-item:hover a { + color: #fff; + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + -ms-transition: none; + transition: none; +} +#header .navigation-item, +#header a { + -webkit-transition: all 0.25s ease-out; + -moz-transition: all 0.25s ease-out; + -o-transition: all 0.25s ease-out; + -ms-transition: all 0.25s ease-out; + transition: all 0.25s ease-out; +}