3AQ5X2GY5OBCA2WBECG3VQHWKZ5PHDP2MAEZBMNT2S6X2I52EWQQC
instance {-# OVERLAPPING #-} FromJSON (IntMap IndexItem) where
parseJSON = withArray "AlBhed.Index" parseValues
where
parseVec = sequence . Vector.toList . Vector.map fromJSON
parseValues array = case parseVec array of
Success x -> pure . IMap.fromList . map (\item@(IndexItem (primer, _)) -> (primer ^. volume & fromVolume, item)) $ x
_ -> fail "Unable to parse values"