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

KtorZ commented on this pull request.

> @@ -176,7 +208,14 @@ instance ToSchema UtxoStatistics where
instance Arbitrary UtxoStatistics where
arbitrary = UtxoStatistics <$> arbitrary
<*> arbitrary

+— This code goes into nonstoping computation when checking swagger integration of WalletResponse UtxoStatistics
+{— do
+ histogram <- arbitrary + let (minPossibleValue, maxPossibleValue) = getPossibleBounds histogram + let histoBars = map (uncurry HistogramBarCount) $ Map.toList histogram + allStakes <- arbitrary `suchThat` (\s -> s >= minPossibleValue && s <= maxPossibleValue) Yep, the way Quickcheck works usually makes `suchThat` a poor choice in many case because the condition becomes harder and harder to satisfy as QuickCheck looks for values in a new range. A rule of the thumb is that it's good when you have to make sure _some_ value are discarded, but when you want to pick values in a range, it's better to rely on [`choose`](https://hackage.haskell.org/package/QuickCheck-2.11.3/docs/Test-QuickCheck-Gen.html#v:choose): ```hs do histogram <- arbitrary allStakes <- choose (getPossibleBounds histogram) ... ```