-
-
Notifications
You must be signed in to change notification settings - Fork 94
[email protected] #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[email protected] #475
Conversation
index.js
Outdated
//# filter :: Filterable f => (a -> Boolean) -> f a -> f a | ||
//. | ||
//. Curried version of [`Z.filter`][]. Discards every element of the given | ||
//. structure which does not satisfy the predicate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anywhere in the docs you're currently using "structure" you could be more specific by replacing it by its type class(es).
Discards every element of the given Filterable which does not satisfy the predicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, although the approach only works when there is exactly one constraint on the structure. Admittedly, this is quite often the case.
On the website, constraints in type signatures are hyperlinked, reducing the importance of links to type classes in descriptions.
I consider the above “defences” quite weak. Do you find either of them compelling, Aldwin, or do you think we should replace “structure” in contexts in which it is possible to do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the approach only works when there is exactly one constraint on the structure
In theory you could use terms like Filterable Monoid and Monadic Semigroup when having multiple constraints on one type variable, and terms like Functor of Foldable when talking about constraints on layered structures. In practice, I'm not sure if this will make things more clear.
Takes a Setoidal value and a Foldable of Setoids and returns true iff the value
is an element of the Foldable.
That starts to look like we're communicating with another species.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context for the description is already provided by the function signature itself. Perhaps we could just omit "of the given structure".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could just omit "of the given structure".
⚡
I just pushed some significant changes to this pull request. I'd appreciate another review from you, @gabejohnson, or from another member of the community. :) |
index.js
Outdated
//# takeWhile :: Filterable f => (a -> Boolean) -> f a -> f a | ||
//. | ||
//. Curried version of [`Z.takeWhile`][]. Discards the first inner value | ||
//. which does not satisfy the predicate, and all subsequent inner values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description isn't consistent with the previous two. Perhaps replace "inner value" with "element"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent suggestion! I love these small improvements. :)
⚡
94a9b3a
to
55cac19
Compare
55cac19
to
72a3f19
Compare
Closes #338
https://github.com/sanctuary-js/sanctuary-type-classes/releases/tag/v8.0.0