Skip to content

remove classes + other breaking changes#850

Merged
gcanti merged 76 commits intov2from
v2-class
Apr 25, 2019
Merged

remove classes + other breaking changes#850
gcanti merged 76 commits intov2from
v2-class

Conversation

@gcanti
Copy link
Copy Markdown
Owner

@gcanti gcanti commented Apr 23, 2019

No description provided.

Comment thread src/Either.ts Outdated
* import { either } from 'fp-ts/lib/Either'
*
* either.map(right(12, double) // right(24)
* either.map(left(23, double) // left(23)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ) after 12 and 23

Comment thread src/Array.ts
const a = as[i]
if (a.isRight()) {
r.push(a.value)
if (a._tag === 'Right') {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this for perf reasons (instead of using isRight())?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid a runtime dependency

@gcanti gcanti merged commit 93bc493 into v2 Apr 25, 2019
@gcanti gcanti deleted the v2-class branch April 25, 2019 09:06
Comment thread src/TaskEither.ts
*/
export const fromEither = <L, A>(fa: Either<L, A>): TaskEither<L, A> => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Comment thread src/Option.ts
}

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)
Copy link
Copy Markdown
Collaborator

@giogonzo giogonzo Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@gcanti gcanti added this to the 2.0 milestone Apr 26, 2019
@semyon2105
Copy link
Copy Markdown

Could you explain why you started replacing const arrow functions with regular functions? Are they faster/better in some way?

@gcanti
Copy link
Copy Markdown
Owner Author

gcanti commented Apr 27, 2019

@semyon2105 no it's just a matter of style. The first docs generator I wrote had some problems but the current one can handle functions just fine, even with overloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants