[input-output-hk/cardano-sl] [CO-347] Wallet’s UTXO histogram view (#3402)

paweljakubas commented on this pull request.

> + | ErrHistogramUpperBoundsNegative
+ | ErrAllStakesNegative
+ deriving (Show)
+
+validateUtxoStatistics :: HashMap Text Word64 -> Word64 -> Either UtxoStatisticsError (HashMap Text Word64, Word64)
+validateUtxoStatistics histogram allStakes
+ | histogramBinNumCond histogram = Left ErrHistogramEmpty
+ | histogramKeysCond histogram = Left ErrHistogramNamesInvalid
+ | histogramValsCond histogram = Left ErrHistogramUpperBoundsNegative
+ | allStakesCond allStakes = Left ErrAllStakesNegative
+ | otherwise = Right (histogram, allStakes)
+ where
+ histogramBinNumCond histo = (length $ HMS.keys histo) <= 0 + validateKeys = any (\key -> notElem key $ map show (NL.toList $ generateBounds Log10) )
+ histogramKeysCond = validateKeys . HMS.keys
+ validateVals = any (< 0) we are fine with zero values as bar represent count