-
Notifications
You must be signed in to change notification settings - Fork 51
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
Patch API differences #183
Comments
I'll take a look at the functions, bit by bit, starting with the Are you looking to implement these functions specifically for Doesn't make sense with
|
Thanks for digging into this.
Planning on implementing specifically for
I think For the others, I'm leaning towards returning a basic catMaybes :: forall a. c (Maybe a) -> canEmpty a
drop :: forall a. Int -> c a -> canEmpty a
dropWhile :: forall a. (a -> Boolean) -> c a -> canEmpty a
filter :: forall a. (a -> Boolean) -> c a -> canEmpty a
filterM :: forall m a. Monad m => (a -> m Boolean) -> c a -> m (canEmpty a)
mapMaybe :: forall a b. (a -> Maybe b) -> c a -> canEmpty b
partition :: forall a. (a -> Boolean) -> c a -> { no :: canEmpty a, yes :: canEmpty a }
span :: forall a. (a -> Boolean) -> c a -> { init :: canEmpty a, rest :: canEmpty a }
take :: forall a. Int -> c a -> canEmpty a
takeEnd :: forall a. Int -> c a -> canEmpty a
takeWhile :: forall a. (a -> Boolean) -> c a -> canEmpty a
Your
I've also wondered why we don't make more use of typeclasses, but have read that this can lead to more issues later on. Some more discussion (and links to other related info) can be found in #184. For the "weird type error", I'm guessing these are |
Here's a patched API proposal: Instances:
Functions:
Summary of changes: All functions that were previously available to BOTH
Questions: Should cons' :: forall a. a -> List a -> NonEmptyList a -- existing for NonEmpty
cons' :: forall a. a -> NonEmptyList a -> List a -- new for Basic Is it correct to assume that the Should specialized versions of Should Should there be a |
See #183 (comment) for a proposed API
It looks like there are a few missing
functions
andinstances
across the different list modules in this library. To tackle this more systematically, I found the contents of each of the cells of a 4-way Venn diagram created by comparing the following modules:I've only looked over the
instances
so far. These appear to be the gaps:Lazy
missing fromLazyNonEmptyList
Eq1
,Ord1
missing fromNonEmptyList
,LazyNonEmptyList
Foldable1
,Traversable1
missing fromLazyNonEmptyList
Here are some notes on the remaining differences, which appear to be fine:
*NonEmptyList
Comonad
is only in*NonEmptyList
, since you can'textract
something from an empty list.Newtype
convenience wrapper.I still need to look through the
functions
. Feel free to help me flag or dismiss any of those differences.Here's a brief explanation of how to read an entry in the listing of cells. For example in this entry:
It means that
Comonad
appears only inLazyNonEmpty
andNonEmpty
, but not in any other modules. More specifically,Comonad
is the output of:This diagram might help with visualizing the "cells":
Here's the full listing (empty cells omitted).
Instances:
Functions:
The text was updated successfully, but these errors were encountered: