IntersectMBO / IntersectMBO/cardano-ledger
Switch to using `Data.Vector.Strict` with `VMap`
- Dominant language
- Haskell
- Stars
- 295
- Forks
- 179
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 30
Description
Currently, `Data.Vector (Vector)` is used for boxed storage in `VMap`, for example in `Snapshots`:
```
data SnapShot = SnapShot
{
...
, ssDelegations :: VMap VB VB (Credential Staking) (KeyHash StakePool)
, ssPoolParams :: VMap VB VB (KeyHash StakePool) StakePoolParams
, ssStakePoolsSnapShot :: !(VMap VB VB (KeyHash StakePool) StakePoolSnapShot)
}
```
Once we switch to `vector-0.13.2.0` , we can use `Data.Vector.Strict` wherever we want to make sure there are no thunks.
The `NoThunks` instance for `Data.Vector.Strict` has already been implemented in this PR: https://github.com/IntersectMBO/cardano-ledger/pull/5545.
With the switch, we should also implement the now commented out functions: `mapValsKVVector` and `mapWithKeyKVVector` in `Data.VMap.KVVector` and then switch to them in the respective function `map` and `mapWithKey` in the `Data.VMap` module.
Contributor guide
Research direction
Start in Data.VMap.KVVector by reading the commented-out mapValsKVVector and mapWithKeyKVVector functions, then inspect the corresponding map and mapWithKey functions in Data.VMap. Use the vector-0.13.2.0 requirement and PR 5545 as context; done means VMap uses Data.Vector.Strict for the relevant boxed storage and those functions are implemented and selected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- blockchain
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100