-
Notifications
You must be signed in to change notification settings - Fork 93
[#20] Add Zippable type class with zip and zipWith methods #48
Conversation
Core/Array/Boxed.hs
Outdated
| otherwise = | ||
if predicate (unsafeIndex c i) then Just i else Nothing | ||
|
||
instance C.Zipable (Array ty) where |
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.
I think it's spelt Zippable
https://en.wiktionary.org/wiki/zippable
Damn it. GHC HEAD won't let me make
|
For tuples sizes >= 3 I didn't implement a type specific |
Only works for boxed arrays and lists so far.
The type class essentially was building lazy list of values, so calling a lazy `toList` on a collection also works and makes this obsolete.
Apparently GHC HEAD can identify type class function that can never be used in an instance of the type class because of type constraints. E.g. `zip` can never be used with `String` as a target collection. `zip` is no in another type class that automatically has an instance for every `Sequential` collection type that can store tuples.
I don't like tuples. 😒
wow @JanGe. didn't have time to read it all yet, but this seems great ! Will try to process over the weekend |
Well, actually the
(And GHC HEAD catches that at compile time!) Still thinking about how I could best solve this... Edit: Working now. My polymorphic
Is there any way I could require |
Define single instances for boxed arrays and lists. Move `unzip*` functions to `BoxedZippable` where they belong.
Nice work. we can improve on the building side of things later on I think |
Issue #20
Array
,UArray
andString
with better performance