Skip to content
Permalink
Browse files

Funfix 7.0 (#101)

Enhancements:

- Fix #93 — reboot `funfix-types`, move to new [Funland](https://funland-js.org/) project, the data types now being compatible with the [static-land](https://github.com/rpominov/static-land) and [fantasy-land](https://github.com/fantasyland/fantasy-land) specs (*breaking*)
- Fix #104 — change the higher-kinded types encoding to be compatible with [fp-ts](https://github.com/gcanti/fp-ts) (*breaking*)
- Fix #97 — add `Future.forEach` method, thanks to @alvaroc1 
- Fix #105 — add the `Applicative` apply (`ap`) method on all data types
- Fix #106 — add the `Either.pure` builder
- Fix #107 — add disjunction types corresponding to data constructors for usage with type guards

Build chores:

- Fix #103 — updates TypeScript to 2.7
- Fix #102 — turn off `--excludeNotExported` in TypeDoc invocation until issue is fixed — error is happening after upgrade to latest version, which is needed due to the upgrade to TypeScript 2.7
- Fix #108 — configure build to support pre-release versions
  • Loading branch information...
alexandru committed Feb 18, 2018
1 parent ec4b64e commit 3d4dd5cca753640678e76086b6174f7265f4fd8b
Showing with 3,027 additions and 8,059 deletions.
  1. +2 −0 .gitignore
  2. +2 −2 .travis.yml
  3. +0 −32 README.md
  4. +0 −1 common/.flowconfig
  5. +1 −1 common/package.json
  6. +1 −1 common/tsconfig.json
  7. +2 −1 common/tslint.json
  8. +3 −2 lerna.json
  9. +10 −21 package.json
  10. +4 −1 packages/funfix-core/package.json
  11. +1 −1 packages/funfix-core/rollup.config.js
  12. +79 −36 packages/funfix-core/src/disjunctions.js.flow
  13. +441 −244 packages/funfix-core/src/disjunctions.ts
  14. +1 −1 packages/funfix-core/src/errors.js.flow
  15. +1 −1 packages/funfix-core/src/errors.ts
  16. +2 −1 packages/funfix-core/src/index.js.flow
  17. +5 −1 packages/funfix-core/src/index.ts
  18. +126 −0 packages/funfix-core/src/internals.ts
  19. +15 −8 packages/{funfix-types/src/index.js.flow → funfix-core/src/kinds.js.flow}
  20. +99 −0 packages/funfix-core/src/kinds.ts
  21. +4 −1 packages/funfix-core/src/std.js.flow
  22. +9 −1 packages/funfix-core/src/std.ts
  23. +39 −2 packages/funfix-core/test/flow/either.test.js.flow
  24. +1 −1 packages/funfix-core/test/flow/errors.test.js.flow
  25. +35 −5 packages/funfix-core/test/flow/option.test.js.flow
  26. +1 −1 packages/funfix-core/test/flow/std.test.js.flow
  27. +35 −2 packages/funfix-core/test/flow/try.test.js.flow
  28. +1 −1 packages/funfix-core/test/ts/asserts.ts
  29. +99 −29 packages/funfix-core/test/ts/either.test.ts
  30. +1 −1 packages/funfix-core/test/ts/errors.test.ts
  31. +49 −10 packages/funfix-core/test/ts/instances.ts
  32. +147 −0 packages/funfix-core/test/ts/internals.test.ts
  33. +102 −48 packages/funfix-core/test/ts/option.test.ts
  34. +13 −2 packages/funfix-core/test/ts/std.test.ts
  35. +97 −26 packages/funfix-core/test/ts/try.test.ts
  36. +7 −0 packages/funfix-core/yarn.lock
  37. +3 −2 packages/funfix-effect/package.json
  38. +1 −1 packages/funfix-effect/rollup.config.js
  39. +10 −4 packages/funfix-effect/src/eval.js.flow
  40. +55 −18 packages/funfix-effect/src/eval.ts
  41. +1 −1 packages/funfix-effect/src/index.js.flow
  42. +1 −1 packages/funfix-effect/src/index.ts
  43. +1 −1 packages/funfix-effect/src/internals.ts
  44. +11 −5 packages/funfix-effect/src/io.js.flow
  45. +73 −32 packages/funfix-effect/src/io.ts
  46. +8 −2 packages/funfix-effect/test/flow/eval.test.js.flow
  47. +8 −2 packages/funfix-effect/test/flow/io.test.js.flow
  48. +1 −1 packages/funfix-effect/test/ts/asserts.ts
  49. +67 −10 packages/funfix-effect/test/ts/eval.test.ts
  50. +26 −14 packages/funfix-effect/test/ts/instances.ts
  51. +104 −41 packages/funfix-effect/test/ts/io.test.ts
  52. +7 −0 packages/funfix-effect/yarn.lock
  53. +3 −2 packages/funfix-exec/package.json
  54. +1 −1 packages/funfix-exec/rollup.config.js
  55. +1 −1 packages/funfix-exec/rootdoc.md
  56. +1 −1 packages/funfix-exec/src/cancelable.js.flow
  57. +1 −1 packages/funfix-exec/src/cancelable.ts
  58. +13 −7 packages/funfix-exec/src/future.js.flow
  59. +78 −25 packages/funfix-exec/src/future.ts
  60. +1 −1 packages/funfix-exec/src/index.js.flow
  61. +1 −1 packages/funfix-exec/src/index.ts
  62. +1 −1 packages/funfix-exec/src/internals.ts
  63. +1 −1 packages/funfix-exec/src/ref.js.flow
  64. +1 −1 packages/funfix-exec/src/ref.ts
  65. +1 −1 packages/funfix-exec/src/scheduler.js.flow
  66. +5 −5 packages/funfix-exec/src/scheduler.ts
  67. +1 −1 packages/funfix-exec/src/time.js.flow
  68. +1 −1 packages/funfix-exec/src/time.ts
  69. +1 −1 packages/funfix-exec/test/flow/cancelable.test.js.flow
  70. +8 −1 packages/funfix-exec/test/flow/future.test.js.flow
  71. +1 −1 packages/funfix-exec/test/flow/ref.test.js.flow
  72. +1 −1 packages/funfix-exec/test/flow/scheduler.test.js.flow
  73. +1 −1 packages/funfix-exec/test/ts/asserts.ts
  74. +1 −1 packages/funfix-exec/test/ts/cancelable.test.ts
  75. +133 −47 packages/funfix-exec/test/ts/future.test.ts
  76. +22 −13 packages/funfix-exec/test/ts/instances.ts
  77. +1 −1 packages/funfix-exec/test/ts/internals.test.ts
  78. +1 −1 packages/funfix-exec/test/ts/ref.test.ts
  79. +1 −1 packages/funfix-exec/test/ts/scheduler.test.ts
  80. +1 −1 packages/funfix-exec/test/ts/time.test.ts
  81. +7 −0 packages/funfix-exec/yarn.lock
  82. +0 −1 packages/funfix-types/.babelrc
  83. +0 −1 packages/funfix-types/.editorconfig
  84. +0 −1 packages/funfix-types/.flowconfig
  85. +0 −12 packages/funfix-types/CHANGELOG.md
  86. +0 −64 packages/funfix-types/README.md
  87. +0 −7 packages/funfix-types/index.js.flow
  88. +0 −1 packages/funfix-types/mocha.opts
  89. +0 −77 packages/funfix-types/package.json
  90. +0 −57 packages/funfix-types/rollup.config.js
  91. +0 −69 packages/funfix-types/rootdoc.md
  92. +0 −95 packages/funfix-types/src/applicative.js.flow
  93. +0 −759 packages/funfix-types/src/applicative.ts
  94. +0 −64 packages/funfix-types/src/comonad.js.flow
  95. +0 −497 packages/funfix-types/src/comonad.ts
  96. +0 −42 packages/funfix-types/src/eq.js.flow
  97. +0 −144 packages/funfix-types/src/eq.ts
  98. +0 −40 packages/funfix-types/src/functor.js.flow
  99. +0 −178 packages/funfix-types/src/functor.ts
  100. +0 −24 packages/funfix-types/src/index.ts
  101. +0 −166 packages/funfix-types/src/instances.js.flow
  102. +0 −530 packages/funfix-types/src/instances.ts
  103. +0 −44 packages/funfix-types/src/kinds.js.flow
  104. +0 −205 packages/funfix-types/src/kinds.ts
  105. +0 −91 packages/funfix-types/src/monad.js.flow
  106. +0 −926 packages/funfix-types/src/monad.ts
  107. +0 −88 packages/funfix-types/test/flow/applicative.test.js.flow
  108. +0 −79 packages/funfix-types/test/flow/applicativeError.test.js.flow
  109. +0 −80 packages/funfix-types/test/flow/apply.test.js.flow
  110. +0 −44 packages/funfix-types/test/flow/coflatMap.test.js.flow
  111. +0 −51 packages/funfix-types/test/flow/comonad.test.js.flow
  112. +0 −60 packages/funfix-types/test/flow/either.test.js.flow
  113. +0 −60 packages/funfix-types/test/flow/eq.test.js.flow
  114. +0 −58 packages/funfix-types/test/flow/eval.test.js.flow
  115. +0 −96 packages/funfix-types/test/flow/flatMap.test.js.flow
  116. +0 −56 packages/funfix-types/test/flow/functor.test.js.flow
  117. +0 −64 packages/funfix-types/test/flow/future.test.js.flow
  118. +0 −64 packages/funfix-types/test/flow/io.test.js.flow
  119. +0 −116 packages/funfix-types/test/flow/monad.test.js.flow
  120. +0 −100 packages/funfix-types/test/flow/monadError.test.js.flow
  121. +0 −60 packages/funfix-types/test/flow/option.test.js.flow
  122. +0 −71 packages/funfix-types/test/flow/try.test.js.flow
  123. +0 −51 packages/funfix-types/test/ts/asserts.ts
  124. +0 −309 packages/funfix-types/test/ts/box.ts
  125. +0 −28 packages/funfix-types/test/ts/either.test.ts
  126. +0 −95 packages/funfix-types/test/ts/eq.test.ts
  127. +0 −46 packages/funfix-types/test/ts/eval.test.ts
  128. +0 −49 packages/funfix-types/test/ts/future.test.ts
  129. +0 −165 packages/funfix-types/test/ts/instances.ts
  130. +0 −51 packages/funfix-types/test/ts/io.test.ts
  131. +0 −92 packages/funfix-types/test/ts/laws.test.ts
  132. +0 −445 packages/funfix-types/test/ts/laws.ts
  133. +0 −28 packages/funfix-types/test/ts/option.test.ts
  134. +0 −28 packages/funfix-types/test/ts/try.test.ts
  135. +0 −1 packages/funfix-types/tsconfig.json
  136. +0 −1 packages/funfix-types/tslint.json
  137. +2 −2 packages/funfix/package.json
  138. +0 −1 packages/funfix/src/index.js.flow
  139. +0 −1 packages/funfix/src/index.ts
  140. +4 −3 packages/funfix/test/flow/import-es5-deps.test.js.flow
  141. +4 −2 packages/funfix/test/flow/import.test.js.flow
  142. +4 −3 packages/funfix/test/ts/import.test.ts
  143. +7 −0 packages/funfix/yarn.lock
  144. +1 −1 scripts/generate-docs.js
  145. +6 −2 scripts/npm-publish.js
  146. +42 −0 test-common/applicative-tests.ts
  147. +32 −0 test-common/apply-tests.ts
  148. +33 −0 test-common/chain-rec-tests.ts
  149. +37 −0 test-common/chain-tests.ts
  150. +28 −0 test-common/functor-tests.ts
  151. +15 −0 test-common/index.ts
  152. +46 −0 test-common/monad-tests.ts
  153. +29 −0 test-common/setoid-tests.ts
  154. +635 −672 yarn.lock
@@ -11,3 +11,5 @@ coverage
dist
compiled
.rpt2_cache
package-lock.json
.docs
@@ -5,9 +5,9 @@ cache:
notifications:
email: false
node_js:
- '7.10'
- '8.9'
before_script:
- npm prune && npm cache clean
- npm prune && npm cache verify
- npm install
script:
- npm run build && npm run test:prod
@@ -161,38 +161,6 @@ The exposed data types:
| [Eval](https://funfix.org/api/effect/classes/eval.html) | lawful, lazy, monadic data type, that can control evaluation, inspired by the `Eval` type in [Typelevel Cats](http://typelevel.org/cats/) and by the `Coeval` type in [Monix](https://monix.io), a more simple `IO`-like type that can only handle immediate execution, no async boundaries, no error handling, not being meant for suspending side effects. |
| [IO](https://funfix.org/api/effect/classes/io.html) | lawful, lazy, monadic data type, capable of expressing and composing side effectful actions, including asynchronous, being the most potent and capable alternative to JavaScript's `Promise`, inspired by Haskell's `IO` and by the [Monix Task](https://monix.io/docs/2x/eval/task.html) |

### funfix-types

Defines type classes inspired by Haskell's standard library and
by [Typelevel Cats](https://typelevel.org/cats/).

**[See JSDoc documentation](https://funfix.org/api/types/)**.

For an à la carte install:

```
npm install --save funfix-types
```

[Type classes](https://en.wikipedia.org/wiki/Type_class) inspired by
Haskell's standard library and by
[Typelevel Cats](https://typelevel.org/cats/):

| | |
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Eq](https://funfix.org/api/types/classes/eq.html) | type class for determining equality between instances of the same type and that obeys the laws defined in [EqLaws](https://funfix.org/api/types/classes/eqlaws.html) |
| [Functor](https://funfix.org/api/types/classes/functor.html) | type class exposing `map` and that obeys the laws defined in [FunctorLaws](https://funfix.org/api/types/classes/functorlaws.html) |
| [Apply](https://funfix.org/api/types/classes/apply.html) | type class that extends `Functor`, exposing `ap` and that obeys the laws defined in [ApplyLaws](https://funfix.org/api/types/classes/applylaws.html) |
| [Applicative](https://funfix.org/api/types/classes/applicative.html) | type class that extends `Functor` and `Apply`, exposing `pure` and that obeys the laws defined in [ApplicativeLaws](https://funfix.org/api/types/classes/applicativelaws.html) |
| [ApplicativeError](https://funfix.org/api/types/classes/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/types/classes/applicativeerrorlaws.html) |
| [FlatMap](https://funfix.org/api/types/classes/flatmap.html) | type class that extends `Functor` and `Apply`, exposing `flatMap` and `tailRecM` and that obeys the laws defined in [FlatMapLaws](https://funfix.org/api/types/classes/flatmaplaws.html) |
| [Monad](https://funfix.org/api/types/classes/monad.html) | type class that extends `Applicative` and `FlatMap` and that obeys the laws defined in [MonadLaws](https://funfix.org/api/types/classes/monadlaws.html) |
| [MonadError](https://funfix.org/api/types/classes/monaderror.html) | 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/types/classes/monaderrorlaws.html) |
| [CoflatMap](https://funfix.org/api/types/classes/coflatmap.html) | type class that extends `Functor`, the dual of `FlatMap`, obeying the laws defined in [CoflatMapLaws](https://funfix.org/api/types/classes/coflatmaplaws.html) |
| [Comonad](https://funfix.org/api/types/classes/comonad.html) | type class that extends `CoflatMap`, the dual of `Monad`, for data types that providing `extract`, obeying the laws defined in [ComonadLaws](https://funfix.org/api/types/classes/comonadlaws.html) |

More is coming 😉

## TypeScript or Flow?

Funfix supports both [TypeScript](https://www.typescriptlang.org/)
@@ -1,7 +1,6 @@
[ignore]
<PROJECT_ROOT>/coverage/.*
<PROJECT_ROOT>/dist/.*
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/index.js.flow

[include]
@@ -33,7 +33,7 @@
"node": ">=6.0.0"
},
"scripts": {
"lint": "flow check && tslint --type-check --project tsconfig.json -e **/node_modules/** -e **/dist/** -t codeFrame src/**/*.ts",
"lint": "flow check && tslint --project tsconfig.json -e **/node_modules/** -e **/dist/** -t codeFrame src/**/*.ts",
"doc": "../../scripts/generate-docs.js .",
"clean": "rimraf dist && rimraf coverage && rimraf .nyc_output",
"prebuild": "npm run clean",
@@ -2,7 +2,7 @@
"compilerOptions": {
"moduleResolution": "node",
"target": "es2015",
"lib": ["es2015", "es2016", "es2017", "dom"],
"lib": ["es2015", "dom.iterable"],
"strict": true,
"sourceMap": true,
"declaration": true,
@@ -17,6 +17,7 @@
"ter-indent": false,
"no-unused-variable": false,
"brace-style": false,
"one-line": false
"one-line": false,
"semicolon": false
}
}
@@ -1,8 +1,9 @@
{
"lerna": "2.0.0-rc.5",
"lerna": "2.9.0",
"packages": [
"packages/*"
],
"version": "0.0.0-development",
"hoist": true
"hoist": false,
"npmClient": "yarn"
}
@@ -12,8 +12,7 @@
"test:prod": "lerna run test:prod",
"lint": "lerna run lint",
"build": "lerna run build",
"clean": "lerna run clean",
"commitmsg": "validate-commit-msg"
"clean": "lerna run clean"
},
"devDependencies": {
"@types/mocha": "^2.2.42",
@@ -23,14 +22,13 @@
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015-rollup": "^3.0.0",
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.0.0",
"flow-bin": "^0.60.1",
"flow-bin": "^0.63.1",
"fs-extra": "^5.0.0",
"funland-laws": "^0.1.4",
"husky": "^0.14.3",
"jsverify": "^0.8.2",
"lerna": "^2.2.0",
"mocha": "^4.0.0",
"jsverify": "^0.8.3",
"lerna": "^2.9.0",
"mocha": "^4.1.0",
"nyc": "^11.2.1",
"rimraf": "^2.6.1",
"rollup": "^0.53.4",
@@ -40,20 +38,11 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"source-map-support": "^0.5.0",
"ts-node": "^4.1.0",
"tslint": "^5.5.0",
"tsc-watch": "^1.0.16",
"tslint": "^5.9.1",
"tslint-config-standard": "^6.0.1",
"tslint-eslint-rules": "^4.1.1",
"typedoc": "^0.9.0",
"typescript": "^2.5.3",
"validate-commit-msg": "^2.14.0"
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
},
"validate-commit-msg": {
"types": "conventional-commit-types",
"helpMessage": "Use \"npm run commit\" instead, we use conventional-changelog format :) (https://github.com/commitizen/cz-cli)"
}
"typedoc": "^0.10.0",
"typescript": "~2.7.2"
}
}
@@ -7,7 +7,7 @@
"es5module": "dist/es5.js",
"typings": "dist/index.d.ts",
"scripts": {
"lint": "flow check && tslint --type-check --project tsconfig.json -e **/node_modules/** -e **/dist/** -t codeFrame src/**/*.ts",
"lint": "flow check && tslint --project tsconfig.json -e **/node_modules/** -e **/dist/** -t codeFrame src/**/*.ts",
"doc": "../../scripts/generate-docs.js .",
"clean": "rimraf dist && rimraf coverage && rimraf .nyc_output",
"prebuild": "npm run clean",
@@ -25,6 +25,9 @@
"src",
"index.js.flow"
],
"dependencies": {
"funland": "^0.1.4"
},
"repository": {
"type": "git",
"url": "https://github.com/funfix/funfix.git"
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2017 by The Funfix Project Developers.
* Copyright (c) 2017-2018 by The Funfix Project Developers.
* Some rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2017 by The Funfix Project Developers.
* Copyright (c) 2017-2018 by The Funfix Project Developers.
* Some rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,9 +17,13 @@

/* @flow */

import type { HK, HK2 } from "funland"
import { Setoid, Monad } from "funland"
import type { Throwable } from "./errors"

declare export class Either<+L, +R> {
+value: L | R;

get(): R;
getOrElse<RR>(fallback: RR): R | RR;
getOrElseL<RR>(thunk: () => RR): R | RR;
@@ -36,22 +40,21 @@ declare export class Either<+L, +R> {
forEach(cb: (r: R) => void): void;
swap(): Either<R, L>;
toOption(): Option<R>;
equals(other: Either<L, R>): boolean;
equals(that: Either<L, R>): boolean;
hashCode(): number;

+_funKindF: Either<L, any>;
+_funKindA: R;

// Implements Constructor<T>
static +_funErasure: Either<any, any>;
static +_Class: Either<any, any>;

static left<L, R>(value: L): Either<L, R>;
static right<L, R>(value: R): Either<L, R>;

static map2<A1,A2,L,R>(fa1: Either<L,A1>, fa2: Either<L,A2>,
f: (A1, A2) => R): Either<L, R>;
static map3<A1,A2,A3,L,R>(fa1: Either<L,A1>, fa2: Either<L,A2>, fa3: Either<L,A3>,
f: (A1, A2, A3) => R): Either<L, R>;
static map2<A1,A2,L,R>(
fa1: Either<L,A1>, fa2: Either<L,A2>,
f: (A1, A2) => R): Either<L, R>;
static map3<A1,A2,A3,L,R>(
fa1: Either<L,A1>, fa2: Either<L,A2>, fa3: Either<L,A3>,
f: (A1, A2, A3) => R): Either<L, R>;
static map4<A1,A2,A3,A4,L,R>(
fa1: Either<L,A1>, fa2: Either<L,A2>, fa3: Either<L,A3>, fa4: Either<L,A4>,
f: (A1, A2, A3, A4) => R): Either<L, R>;
@@ -65,10 +68,26 @@ declare export class Either<+L, +R> {
static tailRecM<L, A, B>(a: A, f: (a: A) => Either<L, Either<A, B>>): Either<L, B>;
}

declare export function Left<L>(value: L): Either<L, empty>;
declare export function Right<R>(value: R): Either<empty, R>;
declare export class TLeft<+L> extends Either<L, empty> {
+value: L;
}

declare export class TRight<+R> extends Either<empty, R> {
+value: R;
}

declare export function Left<L>(value: L): TLeft<L>;
declare export function Right<R>(value: R): TRight<R>;

export type EitherURI = <U, L, A>(x: [U, L, A]) => Either<L, A>;
export type EitherK<L, R> = HK2<EitherURI, L, R>;

export type EitherTypes = Setoid<Either<any, any>> & Monad<EitherURI>;
declare export var EitherModule: EitherTypes;

declare export class Option<+A> {
+value: void | A;

get(): A;
getOrElse<AA>(fallback: AA): A | AA;
getOrElseL<AA>(thunk: () => AA): A | AA;
@@ -89,28 +108,26 @@ declare export class Option<+A> {
hashCode(): number;
isEmpty(): boolean;
map<B>(f: (a: A) => B): Option<B>;
mapN<B>(f: (a: A) => ?B): Option<B>;
nonEmpty(): boolean;

// Implements HK<F, A>
+_funKindF: Option<any>;
+_funKindA: A;

// Implements Constructor<T>
static +_funErasure: Option<any>;
static +_Class: Option<any>;

static empty<A>(): Option<A>;
static none(): Option<empty>;
static none<A>(): Option<A>;
static of<A>(value: ?A): Option<A>;
static pure<A>(value: A): Option<A>;
static some<A>(value: A): Option<A>;

static map2<A1,A2,R>(fa1: Option<A1>, fa2: Option<A2>,
f: (A1, A2) => R): Option<R>;
static map3<A1,A2,A3,R>(fa1: Option<A1>, fa2: Option<A2>, fa3: Option<A3>,
f: (A1, A2, A3) => R): Option<R>;
static map4<A1,A2,A3,A4,R>(fa1: Option<A1>, fa2: Option<A2>, fa3: Option<A3>, fa4: Option<A4>,
f: (A1, A2, A3, A4) => R): Option<R>;
static map2<A1,A2,R>(
fa1: Option<A1>, fa2: Option<A2>,
f: (A1, A2) => R): Option<R>;
static map3<A1,A2,A3,R>(
fa1: Option<A1>, fa2: Option<A2>, fa3: Option<A3>,
f: (A1, A2, A3) => R): Option<R>;
static map4<A1,A2,A3,A4,R>(
fa1: Option<A1>, fa2: Option<A2>, fa3: Option<A3>, fa4: Option<A4>,
f: (A1, A2, A3, A4) => R): Option<R>;
static map5<A1,A2,A3,A4,A5,R>(
fa1: Option<A1>, fa2: Option<A2>, fa3: Option<A3>, fa4: Option<A4>, fa5: Option<A5>,
f: (A1, A2, A3, A4, A5) => R): Option<R>;
@@ -121,10 +138,26 @@ declare export class Option<+A> {
static tailRecM<A, B>(a: A, f: (a: A) => Option<Either<A, B>>): Option<B>;
}

declare export function Some<A>(value: A): Option<A>;
declare export var None: Option<empty>;
declare export class TSome<A> extends Option<A> {
+value: A;
}

declare export class TNone extends Option<empty> {
+value: void;
}

declare export function Some<A>(value: A): TSome<A>;
declare export var None: TNone;

export type OptionURI = <U, L, A>(x: [U, L, A]) => Option<A>;
export type OptionK<A> = HK<OptionURI, A>;

export type OptionTypes = Setoid<Option<any>> & Monad<OptionURI>;
declare export var OptionModule: OptionTypes;

declare export class Try<+A> {
+value: Throwable | A;

get(): A;
getOrElse<AA>(fallback: AA): A | AA;
getOrElseL<AA>(thunk: () => AA): A | AA;
@@ -149,19 +182,15 @@ declare export class Try<+A> {
equals(that: Try<A>): boolean;
hashCode(): number;

// Implements HK<F, A>
+_funKindF: Try<any>;
+_funKindA: A;

// Implements Constructor<T>
static +_funErasure: Try<any>;
static +_Class: Try<any>;

static of<A>(thunk: () => A): Try<A>;
static pure<A>(value: A): Try<A>;
static unit(): Try<void>;
static success<A>(value: A): Try<A>;
static failure(e: Throwable): Try<empty>;
static raise(e: Throwable): Try<empty>;
static failure<A>(e: Throwable): Try<A>;
static raise<A>(e: Throwable): Try<A>;

static map2<A1,A2,R>(
fa1: Try<A1>, fa2: Try<A2>,
@@ -182,5 +211,19 @@ declare export class Try<+A> {
static tailRecM<A, B>(a: A, f: (a: A) => Try<Either<A, B>>): Try<B>;
}

declare export function Success<A>(value: A): Try<A>;
declare export function Failure(e: Throwable): Try<empty>;
declare export class TSuccess<A> extends Try<A> {
+value: A;
}

declare export class TFailure extends Try<empty> {
+value: void;
}

declare export function Success<A>(value: A): TSuccess<A>;
declare export function Failure(e: Throwable): TFailure;

export type TryURI = <U, L, A>(x: [U, L, A]) => Try<A>;
export type TryK<A> = HK<TryURI, A>;

export type TryTypes = Setoid<Try<any>> & Monad<TryURI>;
declare export var TryModule: TryTypes;
Oops, something went wrong.

0 comments on commit 3d4dd5c

Please sign in to comment.
You can’t perform that action at this time.