Skip to content

Commit

Permalink
fix ChainRec definition
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Feb 12, 2017
1 parent 36a756d commit 0f8fd10
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changelog

> **Tags:**
> - [New Feature]
> - [Bug Fix]
> - [Breaking Change]
> - [Documentation]
> - [Internal]
> - [Polish]
> - [Experimental]
**Note**: Gaps between patch versions are faulty/broken releases.
**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice.

# 0.0.2

- **Bug Fix**
- fix `ChainRec` definition (@gcanti)

# 0.0.1

Initial release

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fp-ts",
"version": "0.0.1",
"version": "0.0.2",
"description": "Functional programming in TypeScript",
"files": [
"lib",
Expand Down
4 changes: 3 additions & 1 deletion src/ChainRec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { isLeft } from './Either'
import { Function1 } from './function'

export interface ChainRec<M> extends Chain<M> {
chainRec<A, B>(f: Function1<A, HKT<M, Either<A, B>>>, a: A): B;
/** forall a b. (a -> m (Either a b)) -> a -> m b */
chainRec<A, B>(f: Function1<A, HKT<M, Either<A, B>>>, a: A): HKT<M, B>;
}

/** forall a b. (a -> Either a b) -> a -> b */
export function tailRec<A, B>(f: Function1<A, Either<A, B>>, a: A): B {
let v = f(a)
while (isLeft(v)) {
Expand Down

0 comments on commit 0f8fd10

Please sign in to comment.