2KZPOGRBY6KBMO76F55ZKIVOLSG3O63VP3RHRZVANXYT3OLZ3OWQC
7DBNV3GV773FH5ZLQWFX4RBOS4Q3CIK2RYZNNABY3ZOETYZCXRNQC
EQXRXRZDYCM7BDAVBOXQYPG6C7IJT3OFGNIXCDAHJJBRKAXNGL7AC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
NVOCQVASZWTKQJG7GPH7KHKZZR7NUG4WLV5YY4KAIRPCJRWCZPIAC
JUUMYIQEXSYRMPCQSHIRIG6TBHAR5LU46FE5WI3UHYX6KA4ESH7AC
bifunctors,
containers == 0.5.*,
import Data.Bifunctorimport Data.Function
import Data.Bifunctor
import Data.Function
import Control.Arrow
instance Ord LogEntry where compare a b = compare (logTime a) (logTime b)
instance Ord LogEntry where
compare a b = compare (logTime a) (logTime b)
pushEntry entry idx = consLeft entry $ findWithDefault ([], []) (btcAddr entry) idx where consLeft a (ex, ix) = (a : ex, ix)
pushEntry entry idx = consLeft entry $ findWithDefault ([], []) (btcAddr entry) idx where
consLeft a (ex, ix) = (a : ex, ix)
pushEntry entry = first (entry :) . findWithDefault ([], []) (btcAddr entry)
import Data.Map.Strict as M
testAddrs = catMaybes [ Ananke.btcAddr $ T.pack "123" , Ananke.btcAddr $ T.pack "456" , Ananke.btcAddr $ T.pack "789" ]
testAddrs = catMaybes [ Ananke.btcAddr $ T.pack "123"
, Ananke.btcAddr $ T.pack "456"
, Ananke.btcAddr $ T.pack "789" ]
testAddrs = catMaybes [ parseBtcAddr $ T.pack "123" , parseBtcAddr $ T.pack "456" , parseBtcAddr $ T.pack "789" ]
testAddrs = catMaybes [ parseBtcAddr $ T.pack "123"
, parseBtcAddr $ T.pack "456"
, parseBtcAddr $ T.pack "789" ]
expected = do
testIntervals = do
maybeToList . fmap (LogInterval addr) $ I.interval start end
return $ LogInterval addr (I.interval start end) expected = M.map (\i -> ([], i)) . fromListWith (++) . fmap (intervalBtcAddr &&& return) $ testIntervals
return $ LogInterval addr (I.interval start end)
expected = M.map (\i -> ([], i)) . fromListWith (++) . fmap (intervalBtcAddr &&& return) $ testIntervals