indexM in Representable?
- Dominant language
- Haskell
- Stars
- 45
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
There should be a function called something like `indexM` in the Representable typeclass, with the type
``` haskell
indexM :: (Representable f, Monad m) => f a -> Rep f -> m a
```
Its default definition would simply be
``` haskell
indexM f k = return $ index f k
```
But for some `Representable`s, it could produce a more defined result, for the same reasons as in `Data.Vector`. An example for `Product`:
``` haskell
indexM (Pair a _) (Left i) = indexM a i
indexM (Pair _ b) (Right j) = indexM b j
```
The result passed to `return` contains no reference to the original `Product` value. This could be a win for people using `Representable`s for memoization.
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named. Locate the Representable typeclass, its index implementation, and the Product representation first; then compare the proposed behavior with Data.Vector. Done means the indexM API and its default and Product-specific behavior have been agreed and covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100