From c88a76cb1c6ee7e54628b78a56f1a25415a39c30 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 29 Mar 2015 01:06:34 -0400 Subject: Updates to build against newer libraries: * prettyclass instead of deprecated pretty-class * use pPrint instead of pretty * backported to iproute-1.2.11 (convenient for debian jessie) --- src/Network/BitTorrent/Exchange/Connection.hs | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/Network/BitTorrent/Exchange/Connection.hs') diff --git a/src/Network/BitTorrent/Exchange/Connection.hs b/src/Network/BitTorrent/Exchange/Connection.hs index 2d5f39bf..d65d322e 100644 --- a/src/Network/BitTorrent/Exchange/Connection.hs +++ b/src/Network/BitTorrent/Exchange/Connection.hs @@ -131,7 +131,7 @@ import Network import Network.Socket hiding (Connected) import Network.Socket.ByteString as BS import Text.PrettyPrint as PP hiding ((<>)) -import Text.PrettyPrint.Class +import Text.PrettyPrint.HughesPJClass hiding ((<>),($$)) import Text.Show.Functions () import System.Log.FastLogger (ToLogStr(..)) import System.Timeout @@ -161,7 +161,7 @@ instance Default ChannelSide where def = ThisPeer instance Pretty ChannelSide where - pretty = PP.text . show + pPrint = PP.text . show -- | A protocol errors occur when a peer violates protocol -- specification. @@ -213,7 +213,7 @@ data ProtocolError deriving Show instance Pretty ProtocolError where - pretty = PP.text . show + pPrint = PP.text . show errorPenalty :: ProtocolError -> Int errorPenalty (InvalidProtocol _) = 1 @@ -256,7 +256,7 @@ data WireFailure instance Exception WireFailure instance Pretty WireFailure where - pretty = PP.text . show + pPrint = PP.text . show -- TODO -- data Penalty = Ban | Penalty Int @@ -288,9 +288,9 @@ data FlowStats = FlowStats } deriving Show instance Pretty FlowStats where - pretty FlowStats {..} = + pPrint FlowStats {..} = PP.int messageCount <+> "messages" $+$ - pretty messageBytes + pPrint messageBytes -- | Zeroed stats. instance Default FlowStats where @@ -328,10 +328,10 @@ data ConnectionStats = ConnectionStats } deriving Show instance Pretty ConnectionStats where - pretty ConnectionStats {..} = vcat - [ "Recv:" <+> pretty incomingFlow - , "Sent:" <+> pretty outcomingFlow - , "Both:" <+> pretty (incomingFlow <> outcomingFlow) + pPrint ConnectionStats {..} = vcat + [ "Recv:" <+> pPrint incomingFlow + , "Sent:" <+> pPrint outcomingFlow + , "Both:" <+> pPrint (incomingFlow <> outcomingFlow) ] -- | Zeroed stats. @@ -493,8 +493,8 @@ data PeerStatus = PeerStatus $(makeLenses ''PeerStatus) instance Pretty PeerStatus where - pretty PeerStatus {..} = - pretty (Choking _choking) <+> "and" <+> pretty (Interested _interested) + pPrint PeerStatus {..} = + pPrint (Choking _choking) <+> "and" <+> pPrint (Interested _interested) -- | Connections start out choked and not interested. instance Default PeerStatus where @@ -535,9 +535,9 @@ data ConnectionStatus = ConnectionStatus $(makeLenses ''ConnectionStatus) instance Pretty ConnectionStatus where - pretty ConnectionStatus {..} = - "this " PP.<+> pretty _clientStatus PP.$$ - "remote" PP.<+> pretty _remoteStatus + pPrint ConnectionStatus {..} = + "this " PP.<+> pPrint _clientStatus PP.$$ + "remote" PP.<+> pPrint _remoteStatus -- | Connections start out choked and not interested. instance Default ConnectionStatus where @@ -646,7 +646,7 @@ data Connection s = Connection } instance Pretty (Connection s) where - pretty Connection {..} = "Connection" + pPrint Connection {..} = "Connection" instance ToLogStr (Connection s) where toLogStr Connection {..} = mconcat -- cgit v1.2.3