From 19aa76afa7349cc3c91111b38ab3012f63380433 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 4 Jan 2017 00:28:03 -0500 Subject: Simpler 'shape' function. --- src/Network/BitTorrent/DHT/Routing.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/Network') diff --git a/src/Network/BitTorrent/DHT/Routing.hs b/src/Network/BitTorrent/DHT/Routing.hs index ba1f6799..8705a5a2 100644 --- a/src/Network/BitTorrent/DHT/Routing.hs +++ b/src/Network/BitTorrent/DHT/Routing.hs @@ -365,9 +365,7 @@ type NodeCount = Int -- | Internally, routing table is similar to list of buckets or a -- /matrix/ of nodes. This function returns the shape of the matrix. shape :: Table ip -> [BucketSize] -shape (Tip _ _ bucket) = [PSQ.size bucket] -shape (Zero t bucket) = PSQ.size bucket : shape t -shape (One bucket t ) = PSQ.size bucket : shape t +shape = map PSQ.size . toBucketList -- | Get number of nodes in the table. size :: Table ip -> NodeCount -- cgit v1.2.3