Skip to content

Commit

Permalink
connection-manager: use pretty-simple in cm test
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed Oct 20, 2021
1 parent 9989cf9 commit 8a77e54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 2 additions & 0 deletions ouroboros-network-framework/ouroboros-network-framework.cabal
Expand Up @@ -132,7 +132,9 @@ test-suite test
, dns
, iproute
, network
, pretty-simple
, serialise
, text
, time
, quiet

Expand Down
Expand Up @@ -55,7 +55,9 @@ import Data.Map (Map)
import qualified Data.Map.Strict as Map
import Data.Monoid (All (..), Any (..))
import qualified Data.Set as Set
import qualified Data.Text.Lazy as Text
import Data.Void (Void)
import Text.Pretty.Simple (pShowOpt, defaultOutputOptionsNoColor)
import Quiet

import Network.Mux.Types
Expand Down Expand Up @@ -1240,25 +1242,15 @@ prop_shrinker_RefinedSchedule a@(Schedule s) =
--
newtype ScheduleMap' addr extra =
ScheduleMap { getScheduleMap :: Map addr (Schedule extra) }
deriving (Eq, Functor, Show)


{-
prettyScheduleMap :: (Show addr, Show extra)
=> ScheduleMap' addr extra -> String
prettyScheduleMap (ScheduleMap schedule) =
concat
. map (\(addr, schedule') ->
concat
[ show addr
, "\n"
, intercalate "\n" (map (('\t' :) . show) schedule')
])
. Map.assocs
. fmap getSchedule
$ schedule
-}

deriving (Eq, Functor)

instance (Show addr, Show extra)
=> Show (ScheduleMap' addr extra) where
show (ScheduleMap schedule) =
concat [ "ScheduleMap ( "
, Text.unpack (pShowOpt defaultOutputOptionsNoColor schedule)
, "\n )"
]

instance Ord addr => Semigroup (ScheduleMap' addr extra) where
ScheduleMap a <> ScheduleMap b = ScheduleMap (Map.unionWith f a b)
Expand Down

0 comments on commit 8a77e54

Please sign in to comment.