diff --git a/README.md b/README.md index 90e1dd1..7d7c034 100644 --- a/README.md +++ b/README.md @@ -26,86 +26,54 @@ The code is organized in ES2015 modules, but all types, classes and functions are exported by the [root module](https://funfix.org/api/modules/_funfix_.html). -**["core"](https://funfix.org/api/modules/_core_index_.html)** +--- +**[core](https://funfix.org/api/modules/_core_index_.html)** defines core data types and universal interfaces: -- **[Option<A>](https://funfix.org/api/classes/_core_disjunctions_.option.html)**: - data type for representing optional values, much like the "`Maybe`" - monadic type from Haskell or "`Option`" from Scala -- **[Either<L,R>](https://funfix.org/api/classes/_core_disjunctions_.either.html)**: - data type for representing disjoint unions, for working with values of - two possible types, inspired by the data type with the same name - from Haskell and Scala -- **[Try<A>](https://funfix.org/api/classes/_core_disjunctions_.try.html)**: - data type for capturing exceptional results and manipulating - them as values, being equivalent in spirit with `Either`, - inspired by the data type with the same name from Scala -- **[core/errors](https://funfix.org/api/modules/_core_errors_.html)**: - sub-module that defines the standard `Error` types -- **[core/std](https://funfix.org/api/modules/_core_std_.html)**: - sub-module that defines the `IEquals` interface for structural equality, - along with other utilities +| | | +|:------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Option<A>](https://funfix.org/api/classes/_core_disjunctions_.option.html) | data type for representing optional values, much like the "`Maybe`" monadic type from Haskell or "`Option`" from Scala | +| [Either<L,R>](https://funfix.org/api/classes/_core_disjunctions_.either.html) | data type for representing disjoint unions, for working with values of two possible types, inspired by the data type with the same name from Haskell and Scala | +| [Try<A>](https://funfix.org/api/classes/_core_disjunctions_.try.html) | data type for capturing exceptional results and manipulating them as values, being equivalent in spirit with `Either`, inspired by the data type with the same name from Scala | +| [core/errors](https://funfix.org/api/modules/_core_errors_.html) | sub-module that defines the standard `Error` types | +| [core/std](https://funfix.org/api/modules/_core_std_.html) | sub-module that defines the `IEquals` interface for structural equality, along with other utilities | +--- **["exec"](https://funfix.org/api/modules/_exec_index_.html)** defines low level primitives for dealing with asynchrony and concurrency: -- **[Future<A>](https://funfix.org/api/classes/_exec_future_.future.html)**: - a lawful and cancelable alternative to JavaScript's `Promise` -- **[DynamicRef<A>](https://funfix.org/api/classes/_exec_ref_.dynamicref.html)**: - binding mechanism for global variables -- **[exec/cancelable](https://funfix.org/api/modules/_exec_cancelable_.html)**: - sub-module that defines `ICancelable` and derived interfaces, classes - and utilities for dealing with cancellation -- **[exec/scheduler](https://funfix.org/api/modules/_exec_scheduler_.html)**: - sub-module that defines `Scheduler`, for scheduling asynchronous - execution, as an alternative to working straight with `setTimeout` -- **[exec/time](https://funfix.org/api/modules/_exec_time_.html)**: - sub-module that defines `TimeUnit` and `Duration` for specifying - timespans +| | | +|:------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Future<A>](https://funfix.org/api/classes/_exec_future_.future.html) | a lawful and cancelable alternative to JavaScript's `Promise` | +| [DynamicRef<A>](https://funfix.org/api/classes/_exec_ref_.dynamicref.html) | binding mechanism for global variables, inspired by Scala's implicits | +| [exec/cancelable](https://funfix.org/api/modules/_exec_cancelable_.html) | sub-module that defines `ICancelable` and derived interfaces, classes and utilities for dealing with cancellation | +| [exec/scheduler](https://funfix.org/api/modules/_exec_scheduler_.html) | sub-module that defines `Scheduler`, for scheduling asynchronous execution, as an alternative to working straight with `setTimeout` | +| [exec/time](https://funfix.org/api/modules/_exec_time_.html) | sub-module that defines `TimeUnit` and `Duration` for specifying timespans | +--- **["effect"](https://funfix.org/api/modules/_effect_index_.html)** defines data types for dealing with side effects: -- **[Eval<A>](https://funfix.org/api/classes/_effect_eval_.eval.html)**: - data type for suspending synchronous side effects and controlling - evaluation (e.g. memoization, error handling) +| | | +|:------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Eval<A>](https://funfix.org/api/classes/_effect_eval_.eval.html) | data type for suspending synchronous side effects and controlling evaluation (e.g. memoization, error handling) | +--- **["types"](https://funfix.org/api/modules/_types_index_.html)** defines [type classes](https://en.wikipedia.org/wiki/Type_class) inspired by Haskell's standard library and by [Typelevel Cats](http://typelevel.org/cats/): -- **[Eq](https://funfix.org/api/classes/_types_eq_.eq.html)**: - a type class for determining equality between instances of the - same type and that obeys the laws defined in - [EqLaws](https://funfix.org/api/classes/_types_eq_.eqlaws.html) -- **[Functor](https://funfix.org/api/classes/_types_functor_.functor.html)**: - a type class exposing `map` and that obeys the laws defined in - [FunctorLaws](https://funfix.org/api/classes/_types_functor_.functorlaws.html) -- **[Apply](https://funfix.org/api/classes/_types_applicative_.apply.html)**: - a type class that extends `Functor`, exposing `ap` and that obeys - the laws defined in - [ApplyLaws](https://funfix.org/api/classes/_types_apply_.applylaws.html) -- **[Applicative](https://funfix.org/api/classes/_types_applicative_.applicative.html)**: - a type class that extends `Functor` and `Apply`, exposing `pure` - and that obeys the laws defined in - [ApplicativeLaws](https://funfix.org/api/classes/_types_applicative_.applicativelaws.html) -- **[ApplicativeError](https://funfix.org/api/classes/_types_applicative_.applicativeerror.html)**: - a type class that extends `Applicative`, for applicative types that can raise errors - or recover from them and that obeys the laws defined in - [ApplicativeErrorLaws](https://funfix.org/api/classes/_types_applicative_.applicativeerrorlaws.html) -- **[FlatMap](https://funfix.org/api/classes/_types_monad_.flatmap.html)**: - a type class that extends `Functor` and `Apply`, exposing `flatMap` - and `tailRecM` and that obeys the laws defined in - [FlatMapLaws](https://funfix.org/api/classes/_types_monad_.flatmaplaws.html) -- **[Monad](https://funfix.org/api/classes/_types_monad_.monad.html)**: - a type class that extends `Applicative` and `FlatMap` - and that obeys the laws defined in - [MonadLaws](https://funfix.org/api/classes/_types_monad_.monadlaws.html) -- **[MonadError](https://funfix.org/api/classes/_types_monad_.monaderror.html)**: - a type class that extends `ApplicativeError` and `Monad`, for monads that - can raise or recover from errors and that obeys the laws defined in - [MonadErrorLaws](https://funfix.org/api/classes/_types_monad_.monaderrorlaws.html) +| | | +|:------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Eq](https://funfix.org/api/classes/_types_eq_.eq.html) | a type class for determining equality between instances of the same type and that obeys the laws defined in [EqLaws](https://funfix.org/api/classes/_types_eq_.eqlaws.html) | +| [Functor](https://funfix.org/api/classes/_types_functor_.functor.html) | a type class exposing `map` and that obeys the laws defined in [FunctorLaws](https://funfix.org/api/classes/_types_functor_.functorlaws.html) | +| [Apply](https://funfix.org/api/classes/_types_applicative_.apply.html) | a type class that extends `Functor`, exposing `ap` and that obeys the laws defined in [ApplyLaws](https://funfix.org/api/classes/_types_apply_.applylaws.html) | +| [Applicative](https://funfix.org/api/classes/_types_applicative_.applicative.html) | a type class that extends `Functor` and `Apply`, exposing `pure` and that obeys the laws defined in [ApplicativeLaws](https://funfix.org/api/classes/_types_applicative_.applicativelaws.html) | +| [ApplicativeError](https://funfix.org/api/classes/_types_applicative_.applicativeerror.html) | a type class that extends `Applicative`, for applicative types that can raise errors or recover from them and that obeys the laws defined in [ApplicativeErrorLaws](https://funfix.org/api/classes/_types_applicative_.applicativeerrorlaws.html) | +| [FlatMap](https://funfix.org/api/classes/_types_monad_.flatmap.html) | a type class that extends `Functor` and `Apply`, exposing `flatMap` and `tailRecM` and that obeys the laws defined in [FlatMapLaws](https://funfix.org/api/classes/_types_monad_.flatmaplaws.html) | +| [Monad](https://funfix.org/api/classes/_types_monad_.monad.html) | a type class that extends `Applicative` and `FlatMap` and that obeys the laws defined in [MonadLaws](https://funfix.org/api/classes/_types_monad_.monadlaws.html) | +| [MonadError](https://funfix.org/api/classes/_types_monad_.monaderror.html) | a type class that extends `ApplicativeError` and `Monad`, for monads that can raise or recover from errors and that obeys the laws defined in [MonadErrorLaws](https://funfix.org/api/classes/_types_monad_.monaderrorlaws.html) | More is coming 😉 diff --git a/package.json b/package.json index 534b389..30ec94c 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "option", "either" ], - "main": "dist/funfix.umd.js", - "module": "dist/funfix.es5.js", - "typings": "dist/types/funfix.d.ts", + "main": "dist/index.umd.js", + "module": "dist/index.js", + "typings": "dist/types/index.d.ts", "files": [ "dist", "src", diff --git a/rollup.config.js b/rollup.config.js index 18dd637..368dedd 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -15,21 +15,18 @@ * limitations under the License. */ -import babel from "rollup-plugin-babel" -import resolve from "rollup-plugin-node-resolve" -import commonjs from "rollup-plugin-commonjs" +const babel = require("rollup-plugin-babel") +const resolve = require("rollup-plugin-node-resolve") +const commonjs = require("rollup-plugin-commonjs") const pkg = require("./package.json") const { camelCase } = require("lodash") const typescript = require("rollup-plugin-typescript2") -const libraryName = "funfix" - export default { - entry: `src/${libraryName}.ts`, + entry: `src/index.ts`, targets: [ - { dest: pkg.main, moduleName: camelCase(libraryName), format: "umd" }, - { dest: pkg.module, format: "es" } + { dest: pkg.main, moduleName: "funfix", format: "umd" } ], sourceMap: true, // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') diff --git a/rootdoc.md b/rootdoc.md index 26d5d2d..ea9f364 100644 --- a/rootdoc.md +++ b/rootdoc.md @@ -63,7 +63,7 @@ const email: string | null = ## Features Overview The code is organized in ES2015 modules, but all types, classes and -functions are exported by the [root module]{@link "funfix"}. +functions are exported by the [root module]{@link "index"}. **["core"]{@link "core/index"}** defines core data types and universal interfaces: diff --git a/src/exec/future.ts b/src/exec/future.ts index b06d0fc..79cd039 100644 --- a/src/exec/future.ts +++ b/src/exec/future.ts @@ -38,7 +38,7 @@ import { Try, Success, Failure, Option, Some, None, Either, Left, Right } from "../core/disjunctions" import { IllegalStateError } from "../core/errors" import { Scheduler } from "./scheduler" -import { ICancelable, SingleAssignCancelable, MultiAssignCancelable } from "./cancelable" +import { ICancelable, Cancelable, MultiAssignCancelable } from "./cancelable" /** * `IPromiseLike` represents objects that have a `then` method complying with diff --git a/src/funfix.js.flow b/src/index.js.flow similarity index 100% rename from src/funfix.js.flow rename to src/index.js.flow diff --git a/src/funfix.ts b/src/index.ts similarity index 100% rename from src/funfix.ts rename to src/index.ts diff --git a/test/flow/either.test.js.flow b/test/flow/core/either.test.js.flow similarity index 98% rename from test/flow/either.test.js.flow rename to test/flow/core/either.test.js.flow index 9a9586b..4163f32 100644 --- a/test/flow/either.test.js.flow +++ b/test/flow/core/either.test.js.flow @@ -30,7 +30,7 @@ import { functorOf, Left, Right -} from "../../src/funfix" +} from "../../../src/" const optLeft: Either = Left(1) const optRight: Either = Right("unu") diff --git a/test/flow/errors.test.js.flow b/test/flow/core/errors.test.js.flow similarity index 97% rename from test/flow/errors.test.js.flow rename to test/flow/core/errors.test.js.flow index a465b70..921bbc4 100644 --- a/test/flow/errors.test.js.flow +++ b/test/flow/core/errors.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing wildcard import -import * as ff from "../../src/funfix" +import * as ff from "../../../src/" // Testing a la carte import import { @@ -28,7 +28,7 @@ import { IllegalInheritanceError, IllegalStateError, IllegalArgumentError -} from "../../src/core" +} from "../../../src/core" new ff.CompositeError([]) new ff.CompositeError(["error", new Error()]) diff --git a/test/flow/option.test.js.flow b/test/flow/core/option.test.js.flow similarity index 99% rename from test/flow/option.test.js.flow rename to test/flow/core/option.test.js.flow index 1c2760b..cbbf3ba 100644 --- a/test/flow/option.test.js.flow +++ b/test/flow/core/option.test.js.flow @@ -34,7 +34,7 @@ import { monadOf, Eq, eqOf -} from "../../src/funfix" +} from "../../../src/" const opt: Option = Option.of(1) diff --git a/test/flow/std.test.js.flow b/test/flow/core/std.test.js.flow similarity index 96% rename from test/flow/std.test.js.flow rename to test/flow/core/std.test.js.flow index 8b35fa3..5d695d3 100644 --- a/test/flow/std.test.js.flow +++ b/test/flow/core/std.test.js.flow @@ -17,7 +17,7 @@ /* @flow */ -import * as ff from "../../src/funfix" +import * as ff from "../../../src/" // A la carte import import { IEquals, @@ -27,7 +27,7 @@ import { isValueObject, hashCodeOfString, applyMixins -} from "../../src/core" +} from "../../../src/core" // IEquals test (1) const opt: ff.Option = ff.Option.of(1) diff --git a/test/flow/try.test.js.flow b/test/flow/core/try.test.js.flow similarity index 98% rename from test/flow/try.test.js.flow rename to test/flow/core/try.test.js.flow index c164b2b..e1a08a1 100644 --- a/test/flow/try.test.js.flow +++ b/test/flow/core/try.test.js.flow @@ -30,7 +30,7 @@ import { Success, Try, TryInstances -} from "../../src/funfix" +} from "../../../src/" const failure: Try = Failure(1) const success: Try = Success("unu") diff --git a/test/flow/eval.test.js.flow b/test/flow/effect/eval.test.js.flow similarity index 96% rename from test/flow/eval.test.js.flow rename to test/flow/effect/eval.test.js.flow index e272c14..1c35d98 100644 --- a/test/flow/eval.test.js.flow +++ b/test/flow/effect/eval.test.js.flow @@ -17,9 +17,9 @@ /* @flow */ -import * as ff from "../../src/funfix" -import { Try, Right, Either } from "../../src/funfix" -import { Eval } from "../../src/effect" +import * as ff from "../../../src/" +import { Try, Right, Either } from "../../../src/" +import { Eval } from "../../../src/effect" import { Functor, functorOf, @@ -32,7 +32,7 @@ import { Monad, monadOf, EvalInstances -} from "../../src/types" +} from "../../../src/types" const ref1: ff.Eval = ff.Eval.always(() => 1) const ref2: Eval = Eval.always(() => 1) diff --git a/test/flow/future.test.js.flow b/test/flow/exec/future.test.js.flow similarity index 99% rename from test/flow/future.test.js.flow rename to test/flow/exec/future.test.js.flow index 91d232f..750ef3d 100644 --- a/test/flow/future.test.js.flow +++ b/test/flow/exec/future.test.js.flow @@ -38,7 +38,7 @@ import { monadOf, MonadError, monadErrorOf -} from "../../src/funfix" +} from "../../../src/" const fa1: Future = Future.pure(1) const fa2: Future = Future.pure(1, Scheduler.global.get()) diff --git a/test/flow/ref.test.js.flow b/test/flow/exec/ref.test.js.flow similarity index 95% rename from test/flow/ref.test.js.flow rename to test/flow/exec/ref.test.js.flow index 66303b8..7539156 100644 --- a/test/flow/ref.test.js.flow +++ b/test/flow/exec/ref.test.js.flow @@ -17,7 +17,7 @@ /* @flow */ -import { DynamicRef } from "../../src/funfix" +import { DynamicRef } from "../../../src/" const ref: DynamicRef = DynamicRef.of(() => "original") const value: string = ref.get() diff --git a/test/flow/scheduler.test.js.flow b/test/flow/exec/scheduler.test.js.flow similarity index 98% rename from test/flow/scheduler.test.js.flow rename to test/flow/exec/scheduler.test.js.flow index 295a7db..0ff26c3 100644 --- a/test/flow/scheduler.test.js.flow +++ b/test/flow/exec/scheduler.test.js.flow @@ -23,7 +23,7 @@ import { TestScheduler, Duration, ICancelable -} from "../../src/funfix" +} from "../../../src/" const global: Scheduler = Scheduler.global.get() diff --git a/test/flow/applicative.test.js.flow b/test/flow/types/applicative.test.js.flow similarity index 97% rename from test/flow/applicative.test.js.flow rename to test/flow/types/applicative.test.js.flow index 0c19377..a136c80 100644 --- a/test/flow/applicative.test.js.flow +++ b/test/flow/types/applicative.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing a la carte import -import type { OptionK, TypeClass } from "../../src/funfix" +import type { OptionK, TypeClass } from "../../../src/" import { Equiv, Applicative, @@ -32,7 +32,7 @@ import { Option, Some, applyMixins -} from "../../src/funfix" +} from "../../../src/" const erasure: Applicative = Applicative._funErasure const typeId: string = Applicative._funTypeId diff --git a/test/flow/applicativeError.test.js.flow b/test/flow/types/applicativeError.test.js.flow similarity index 97% rename from test/flow/applicativeError.test.js.flow rename to test/flow/types/applicativeError.test.js.flow index be0036d..3cdc715 100644 --- a/test/flow/applicativeError.test.js.flow +++ b/test/flow/types/applicativeError.test.js.flow @@ -17,7 +17,7 @@ /* @flow */ -import type { EvalK, TypeClass } from "../../src/funfix" +import type { EvalK, TypeClass } from "../../../src/" import { Equiv, ApplicativeError, @@ -33,7 +33,7 @@ import { Eval, Either, applyMixins -} from "../../src/funfix" +} from "../../../src/" const erasure: ApplicativeError = ApplicativeError._funErasure const typeId: string = ApplicativeError._funTypeId diff --git a/test/flow/apply.test.js.flow b/test/flow/types/apply.test.js.flow similarity index 96% rename from test/flow/apply.test.js.flow rename to test/flow/types/apply.test.js.flow index 9e00273..c07b16f 100644 --- a/test/flow/apply.test.js.flow +++ b/test/flow/types/apply.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing a la carte import -import type { OptionK, TypeClass } from "../../src/funfix" +import type { OptionK, TypeClass } from "../../../src/" import { Equiv, Apply, @@ -30,7 +30,7 @@ import { Option, Some, applyMixins -} from "../../src/funfix" +} from "../../../src/" const erasure: Apply = Apply._funErasure const typeId: string = Apply._funTypeId diff --git a/test/flow/eq.test.js.flow b/test/flow/types/eq.test.js.flow similarity index 95% rename from test/flow/eq.test.js.flow rename to test/flow/types/eq.test.js.flow index efe7fa4..284a0de 100644 --- a/test/flow/eq.test.js.flow +++ b/test/flow/types/eq.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing a la carte import -import type { TypeClass } from "../../src/funfix" +import type { TypeClass } from "../../../src/" import { Eq, EqLaws, @@ -28,7 +28,7 @@ import { Some, None, applyMixins -} from "../../src/funfix" +} from "../../../src/" const erasure: Eq = Eq._funErasure const typeId: string = Eq._funTypeId diff --git a/test/flow/flatMap.test.js.flow b/test/flow/types/flatMap.test.js.flow similarity index 97% rename from test/flow/flatMap.test.js.flow rename to test/flow/types/flatMap.test.js.flow index fd99670..489d591 100644 --- a/test/flow/flatMap.test.js.flow +++ b/test/flow/types/flatMap.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing a la carte import -import type { OptionK, TypeClass } from "../../src/funfix" +import type { OptionK, TypeClass } from "../../../src/" import { Equiv, Functor, @@ -33,7 +33,7 @@ import { Some, applyMixins, Either -} from "../../src/funfix" +} from "../../../src/" const erasure: FlatMap = FlatMap._funErasure const typeId: string = FlatMap._funTypeId diff --git a/test/flow/functor.test.js.flow b/test/flow/types/functor.test.js.flow similarity index 95% rename from test/flow/functor.test.js.flow rename to test/flow/types/functor.test.js.flow index c17b086..e10f780 100644 --- a/test/flow/functor.test.js.flow +++ b/test/flow/types/functor.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing a la carte import -import type { OptionK, TypeClass } from "../../src/funfix" +import type { OptionK, TypeClass } from "../../../src/" import { Equiv, Functor, @@ -28,7 +28,7 @@ import { Option, Some, applyMixins -} from "../../src/funfix" +} from "../../../src/" const erasure: Functor = Functor._funErasure const typeId: string = Functor._funTypeId diff --git a/test/flow/monad.test.js.flow b/test/flow/types/monad.test.js.flow similarity index 98% rename from test/flow/monad.test.js.flow rename to test/flow/types/monad.test.js.flow index 76c934c..3815606 100644 --- a/test/flow/monad.test.js.flow +++ b/test/flow/types/monad.test.js.flow @@ -18,7 +18,7 @@ /* @flow */ // Testing a la carte import -import type { OptionK, TypeClass } from "../../src/funfix" +import type { OptionK, TypeClass } from "../../../src/" import { Equiv, Functor, @@ -37,7 +37,7 @@ import { Some, applyMixins, Either -} from "../../src/funfix" +} from "../../../src/" const erasure: Monad = Monad._funErasure const typeId: string = Monad._funTypeId diff --git a/test/flow/monadError.test.js.flow b/test/flow/types/monadError.test.js.flow similarity index 98% rename from test/flow/monadError.test.js.flow rename to test/flow/types/monadError.test.js.flow index 76095e8..cedd0f8 100644 --- a/test/flow/monadError.test.js.flow +++ b/test/flow/types/monadError.test.js.flow @@ -17,7 +17,7 @@ /* @flow */ -import type { EvalK, TypeClass } from "../../src/funfix" +import type { EvalK, TypeClass } from "../../../src/" import { Equiv, MonadError, @@ -35,7 +35,7 @@ import { Eval, Either, applyMixins -} from "../../src/funfix" +} from "../../../src/" const erasure: MonadError = MonadError._funErasure const typeId: string = MonadError._funTypeId diff --git a/test/core/either.test.ts b/test/ts/core/either.test.ts similarity index 99% rename from test/core/either.test.ts rename to test/ts/core/either.test.ts index 68d39de..f8ad520 100644 --- a/test/core/either.test.ts +++ b/test/ts/core/either.test.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { hashCode, is, Left, Right, Either, Option, eqOf } from "../../src/funfix" +import { hashCode, is, Left, Right, Either, Option, eqOf } from "../../../src/" import * as jv from "jsverify" import * as inst from "../instances" import * as laws from "../laws" diff --git a/test/core/errors.test.ts b/test/ts/core/errors.test.ts similarity index 99% rename from test/core/errors.test.ts rename to test/ts/core/errors.test.ts index 82391ae..cda5f61 100644 --- a/test/core/errors.test.ts +++ b/test/ts/core/errors.test.ts @@ -23,7 +23,7 @@ import { NoSuchElementError, IllegalArgumentError, NotImplementedError -} from "../../src/funfix" +} from "../../../src/" describe("DummyError", () => { it("has custom message", () => { diff --git a/test/core/option.test.ts b/test/ts/core/option.test.ts similarity index 98% rename from test/core/option.test.ts rename to test/ts/core/option.test.ts index fec273c..459b944 100644 --- a/test/core/option.test.ts +++ b/test/ts/core/option.test.ts @@ -15,9 +15,9 @@ * limitations under the License. */ -import { Option, Some, None, Left, Right } from "../../src/funfix" -import { NoSuchElementError } from "../../src/funfix" -import { is, hashCode, eqOf } from "../../src/funfix" +import { Option, Some, None, Left, Right } from "../../../src/" +import { NoSuchElementError } from "../../../src/" +import { is, hashCode, eqOf } from "../../../src/" import * as jv from "jsverify" import * as inst from "../instances" diff --git a/test/core/std.test.ts b/test/ts/core/std.test.ts similarity index 98% rename from test/core/std.test.ts rename to test/ts/core/std.test.ts index 860bd7e..7b510ad 100644 --- a/test/core/std.test.ts +++ b/test/ts/core/std.test.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { IEquals, hashCode, is, equals, id } from "../../src/funfix" +import { IEquals, hashCode, is, equals, id } from "../../../src/" import * as jv from "jsverify" import * as inst from "../instances" diff --git a/test/core/try.test.ts b/test/ts/core/try.test.ts similarity index 98% rename from test/core/try.test.ts rename to test/ts/core/try.test.ts index 2e0c1b7..e784198 100644 --- a/test/core/try.test.ts +++ b/test/ts/core/try.test.ts @@ -15,10 +15,10 @@ * limitations under the License. */ -import { Try, Success, Failure, DummyError, NoSuchElementError } from "../../src/funfix" -import { None, Some, Left, Right } from "../../src/funfix" -import { IllegalStateError } from "../../src/funfix" -import { is, hashCode, eqOf } from "../../src/funfix" +import { Try, Success, Failure, DummyError, NoSuchElementError } from "../../../src/" +import { None, Some, Left, Right } from "../../../src/" +import { IllegalStateError } from "../../../src/" +import { is, hashCode, eqOf } from "../../../src/" import * as jv from "jsverify" import * as inst from "../instances" diff --git a/test/effect/eval.test.ts b/test/ts/effect/eval.test.ts similarity index 99% rename from test/effect/eval.test.ts rename to test/ts/effect/eval.test.ts index 168861d..caf1c41 100644 --- a/test/effect/eval.test.ts +++ b/test/ts/effect/eval.test.ts @@ -24,7 +24,7 @@ import { Right, DummyError, Try -} from "../../src/funfix" +} from "../../../src/" import * as jv from "jsverify" import * as inst from "../instances" diff --git a/test/exec/cancelable.test.ts b/test/ts/exec/cancelable.test.ts similarity index 99% rename from test/exec/cancelable.test.ts rename to test/ts/exec/cancelable.test.ts index 78699fc..ccd4532 100644 --- a/test/exec/cancelable.test.ts +++ b/test/ts/exec/cancelable.test.ts @@ -23,7 +23,7 @@ import { SingleAssignCancelable, SerialCancelable, IllegalStateError -} from "../../src/funfix" +} from "../../../src/" class TestCancelable extends BoolCancelable { private _isCanceled: boolean diff --git a/test/exec/future.test.ts b/test/ts/exec/future.test.ts similarity index 99% rename from test/exec/future.test.ts rename to test/ts/exec/future.test.ts index d2dc684..0cccb1b 100644 --- a/test/exec/future.test.ts +++ b/test/ts/exec/future.test.ts @@ -15,9 +15,9 @@ * limitations under the License. */ -import { is, Try, Success, Failure, Some, None, DummyError, Left, Right, IllegalStateError } from "../../src/core" -import { Future, IPromiseLike, TestScheduler, Scheduler, BoolCancelable } from "../../src/exec" -import { Eq } from "../../src/types" +import { is, Try, Success, Failure, Some, None, DummyError, Left, Right, IllegalStateError } from "../../../src/core" +import { Future, IPromiseLike, TestScheduler, Scheduler, BoolCancelable } from "../../../src/exec" +import { Eq } from "../../../src/types" import * as jv from "jsverify" import * as inst from "../instances" diff --git a/test/exec/internals.test.ts b/test/ts/exec/internals.test.ts similarity index 97% rename from test/exec/internals.test.ts rename to test/ts/exec/internals.test.ts index bc36e0e..64ae97c 100644 --- a/test/exec/internals.test.ts +++ b/test/ts/exec/internals.test.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { arrayBSearchInsertPos } from "../../src/exec/internals" +import { arrayBSearchInsertPos } from "../../../src/exec/internals" import * as jv from "jsverify" describe("arrayBSearchInsertPos", () => { diff --git a/test/exec/ref.test.ts b/test/ts/exec/ref.test.ts similarity index 96% rename from test/exec/ref.test.ts rename to test/ts/exec/ref.test.ts index bfa1540..8cdfa7d 100644 --- a/test/exec/ref.test.ts +++ b/test/ts/exec/ref.test.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { DynamicRef } from "../../src/exec/ref" +import { DynamicRef } from "../../../src/exec/ref" describe("DynamicRef", () => { it("should return the default value", () => { diff --git a/test/exec/scheduler.test.ts b/test/ts/exec/scheduler.test.ts similarity index 99% rename from test/exec/scheduler.test.ts rename to test/ts/exec/scheduler.test.ts index 0c52a89..e8f0415 100644 --- a/test/exec/scheduler.test.ts +++ b/test/ts/exec/scheduler.test.ts @@ -22,7 +22,7 @@ import { TestScheduler, DummyError, Duration -} from "../../src/funfix" +} from "../../../src/" describe("GlobalScheduler", () => { test("Scheduler.global.get() instanceof GlobalScheduler", () => { diff --git a/test/exec/time.test.ts b/test/ts/exec/time.test.ts similarity index 99% rename from test/exec/time.test.ts rename to test/ts/exec/time.test.ts index 0e444b3..22babdf 100644 --- a/test/exec/time.test.ts +++ b/test/ts/exec/time.test.ts @@ -27,7 +27,7 @@ import { HOURS, DAYS, Duration -} from "../../src/funfix" +} from "../../../src/" describe("NANOSECONDS", () => { jv.property("NANOSECONDS.toNanos(d) === d", diff --git a/test/instances.ts b/test/ts/instances.ts similarity index 99% rename from test/instances.ts rename to test/ts/instances.ts index 569be8f..b39681e 100644 --- a/test/instances.ts +++ b/test/ts/instances.ts @@ -34,7 +34,7 @@ import { MINUTES, HOURS, DAYS -} from "../src/funfix" +} from "../../src/" export const arbAnyPrimitive: jv.Arbitrary = jv.sum([jv.number, jv.string, jv.falsy]) diff --git a/test/laws.ts b/test/ts/laws.ts similarity index 99% rename from test/laws.ts rename to test/ts/laws.ts index 15f87b1..0e7e227 100644 --- a/test/laws.ts +++ b/test/ts/laws.ts @@ -26,7 +26,7 @@ import { FlatMapLaws, flatMapLawsOf, flatMapOf, MonadLaws, monadLawsOf, monadOf, MonadErrorLaws, monadErrorLawsOf, monadErrorOf -} from "../src/funfix" +} from "../../src/" export function testEq( type: Constructor, arbA: jv.Arbitrary, diff --git a/test/types/box.ts b/test/ts/types/box.ts similarity index 98% rename from test/types/box.ts rename to test/ts/types/box.ts index bafad66..db3a0b0 100644 --- a/test/types/box.ts +++ b/test/ts/types/box.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { applyMixins, Either, Try } from "../../src/core" +import { applyMixins, Either, Try } from "../../../src/core" import { Functor, Apply, @@ -27,7 +27,7 @@ import { Eq, HK, registerTypeClassInstance -} from "../../src/types" +} from "../../../src/types" /** * Dummy class meant to test global type class operations. diff --git a/test/types/laws.test.ts b/test/ts/types/laws.test.ts similarity index 97% rename from test/types/laws.test.ts rename to test/ts/types/laws.test.ts index 060dbc0..10d4810 100644 --- a/test/types/laws.test.ts +++ b/test/ts/types/laws.test.ts @@ -18,12 +18,12 @@ import * as jv from "jsverify" import * as laws from "../laws" import { Box, BoxApplicative } from "./box" -import { Success } from "../../src/core" +import { Success } from "../../../src/core" import { eqOf, Eq, Applicative, applicativeOf, getTypeClassInstance, registerTypeClassInstance -} from "../../src/types" +} from "../../../src/types" const arbBox = jv.number.smap(n => new Box(Success(n)), b => b.value.get()) diff --git a/tools/copy-flow.ts b/tools/copy-flow.ts index a3efa3b..1af9c00 100755 --- a/tools/copy-flow.ts +++ b/tools/copy-flow.ts @@ -63,8 +63,7 @@ async function main() { } const pkg = JSON.parse(fs.readFileSync(path.join(currentDir, "package.json")) as any) - exec(`cp -f "${destDir}/${pkg.name}.js.flow" "${currentDir}/${pkg.main}.flow"`) - exec(`cp -f "${destDir}/${pkg.name}.js.flow" "${currentDir}/${pkg.module}.flow"`) + exec(`cp -f "${destDir}/index.js.flow" "${currentDir}/${pkg.main}.flow"`) } main().then( diff --git a/tools/prepublish.sh b/tools/prepublish.sh index 9716985..1abd48c 100755 --- a/tools/prepublish.sh +++ b/tools/prepublish.sh @@ -26,5 +26,5 @@ cat > ./index.js.flow <