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

paweljakubas commented on this pull request.

> + %» upperBound=»%build
+ %» }»)
+ bucketName
+ bucketUpperBound
+
+
+data UtxoStatistics = UtxoStatistics
+ { theHistogram :: ![HistogramBar]
+ , theAllStakes :: !Word64
+ } deriving (Show, Generic, Ord)
+
+toMap :: [HistogramBar] -> Map Text Word64
+toMap = Map.fromList . map (\(HistogramBarCount key val) -> (key,val))
+
+instance Eq UtxoStatistics where
+ (UtxoStatistics h s) == (UtxoStatistics h’ s’) = s == s’ && toMap h == toMap h’

JSON format, I believe, is not restrictive about what is the order of fields in a object. To make it robust I need when comparing object’s content go outside list equality. The number of buckets is very low (17) so I bet it is not going to kill us in terms of performance