flow-static-land
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -15,2 +15,8 @@ # Changelog | ||
## 0.2.6 | ||
- **Bug fix** | ||
- fix `ChainRec` definition [@gcanti] | ||
- fix `State` definition [@gcanti] | ||
## 0.2.5 | ||
@@ -17,0 +23,0 @@ |
@@ -79,3 +79,3 @@ 'use strict'; | ||
function chainRec(f, a) { | ||
return (0, _ChainRec.tailRec)((0, _Fun.compose)(extract, f), a); | ||
return inj((0, _ChainRec.tailRec)((0, _Fun.compose)(extract, f), a)); | ||
} | ||
@@ -82,0 +82,0 @@ |
@@ -80,3 +80,4 @@ 'use strict'; | ||
return inj(function (s) { | ||
return tuple.inj([f(evalState(fa, s)), s]); | ||
var t = runState(fa, s); | ||
return tuple.inj([f(tuple.fst(t)), tuple.snd(t)]); | ||
}); | ||
@@ -99,3 +100,4 @@ } | ||
return inj(function (s) { | ||
return prj(f(evalState(fa, s)))(s); | ||
var t = runState(fa, s); | ||
return runState(f(tuple.fst(t)), tuple.snd(t)); | ||
}); | ||
@@ -102,0 +104,0 @@ } |
{ | ||
"name": "flow-static-land", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Implementation of common algebraic types in JavaScript + Flow", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -9,3 +9,3 @@ // @flow | ||
export interface ChainRec<M> extends Chain<M> { | ||
chainRec<A, B>(f: (a: A) => HKT<M, Either<A, B>>, a: A): B; | ||
chainRec<A, B>(f: (a: A) => HKT<M, Either<A, B>>, a: A): HKT<M, B>; | ||
} | ||
@@ -12,0 +12,0 @@ |
@@ -68,4 +68,4 @@ // @flow | ||
export function chainRec<A, B>(f: (a: A) => Identity<Either<A, B>>, a: A): B { | ||
return tailRec(compose(extract, f), a) | ||
export function chainRec<A, B>(f: (a: A) => Identity<Either<A, B>>, a: A): Identity<B> { | ||
return inj(tailRec(compose(extract, f), a)) | ||
} | ||
@@ -72,0 +72,0 @@ |
@@ -51,3 +51,6 @@ // @flow | ||
export function map<S, A, B>(f: (a: A) => B, fa: State<S, A>): State<S, B> { | ||
return inj(s => tuple.inj([f(evalState(fa, s)), s])) | ||
return inj(s => { | ||
const t = runState(fa, s) | ||
return tuple.inj([f(tuple.fst(t)), tuple.snd(t)]) | ||
}) | ||
} | ||
@@ -64,3 +67,6 @@ | ||
export function chain<S, A, B>(f: (a: A) => State<S, B>, fa: State<S, A>): State<S, B> { | ||
return inj(s => prj(f(evalState(fa, s)))(s)) | ||
return inj(s => { | ||
const t = runState(fa, s) | ||
return runState(f(tuple.fst(t)), tuple.snd(t)) | ||
}) | ||
} | ||
@@ -67,0 +73,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
266013
5682