-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add 'ToPairs' type family with the ability to have list of pairs #97
Comments
This is very bad because it would break any code which uses Either create |
@neongreen Yeah, one more thing is breaking something like: maximum :: Ord (Element t) => t -> Element t which doesn't make much sense... Solution with So do you propose the following interface? class ToPairs t where
type Key t :: *
type Val t :: *
toPairs :: t -> [(Key t, Val t)]
keys :: t -> [Key t]
elems :: t -> [Val t] -- maybe `vals` or `values`? |
Currently
toList
forkey-value
containers returns list of values only:I think it might be more useful to return list of
(key, value)
. This can be implemented as default here:universum/src/Universum/Container/Class.hs
Lines 92 to 94 in 8333039
Like this for example:
But this immediately will break behavior of all
Foldable
-like functions. Maybe this change is too radical...The text was updated successfully, but these errors were encountered: