Conversation
…tent with other Array functions
| * import { either } from 'fp-ts/lib/Either' | ||
| * | ||
| * either.map(right(12, double) // right(24) | ||
| * either.map(left(23, double) // left(23) |
There was a problem hiding this comment.
missing ) after 12 and 23
| const a = as[i] | ||
| if (a.isRight()) { | ||
| r.push(a.value) | ||
| if (a._tag === 'Right') { |
There was a problem hiding this comment.
is this for perf reasons (instead of using isRight())?
There was a problem hiding this comment.
to avoid a runtime dependency
| */ | ||
| export const fromEither = <L, A>(fa: Either<L, A>): TaskEither<L, A> => { |
There was a problem hiding this comment.
this is now taskEither.fromEither from MonadThrow, correct?
It seems a bit weird to only have this removed (and not e.g. fromLeft which would be already available as taskEither.throwError)
There was a problem hiding this comment.
@giogonzo fromLeft and taskEither.throwError have different signatures (i.e. never in the former).
We can re-add a redundant fromEither later, I just want a clean baseline to start from.
| } | ||
|
|
||
| const filter = <A>(fa: Option<A>, p: Predicate<A>): Option<A> => fa.filter(p) | ||
| const filter = <A>(fa: Option<A>, p: Predicate<A>): Option<A> => (isNone(fa) ? fa : p(fa.value) ? fa : none) |
There was a problem hiding this comment.
@gcanti I think we still need also the equivalent of the old .filter method, accepting a Refinement<A, B>. This is some code that doesn't compile anymore:
import { option, some } from 'fp-ts/lib/Option';
declare const a: string | number;
declare function isString(x: any): x is string;
const b: Option<string> = option.filter(some(a), isString);There was a problem hiding this comment.
@giogonzo I think that we can handle refinements (in filter and partition) once for all by adding proper overloads to the Filterable type class. This is beneficial for v1 too, I'll send a PR for v.1.17.2
|
Could you explain why you started replacing const arrow functions with regular functions? Are they faster/better in some way? |
|
@semyon2105 no it's just a matter of style. The first docs generator I wrote had some problems but the current one can handle |
No description provided.