functions for Scott-style deconstruction of V2,V3, etc.? [question]
- Dominant language
- Haskell
- Stars
- 220
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
in various occasions I was missing functions for the short vectors (`V0` to `V4`) that would serve a similar purpose as `curry`&`uncurry` do for tuples, roughly as this:
```hs
v2rry :: (a -> a -> b) -> (V2 a -> b)
unv2rry :: (V2 a -> b) -> (a -> a -> b)
v3rry :: (a -> a -> a -> b) -> (V3 a -> b)
unv3rry :: (V3 a -> b) -> (a -> a -> a -> b)
-- ...etc...
```
This is super convenient esp. for conversions to different kinds of data (`v3rry (,,)`, `v2rry ImVec2`, ...) and computations not specific to `linear` that would work with the whole vector (`v3rry rgbLuminosity`). I'd assume it would be natural to have this in `linear`, as such functions are kinda same to `Vn`'s as e.g. `foldr` to lists or `maybe` to Maybes. So I was surprised to find there's no such functionality in the package.
Questions:
- did I miss a way to do this conveniently with existing functions?
- if I didn't miss it, is there ay reason why including such helpers in `linear` would be counterproductive? (/me curious)
Thank you!
-mk
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.