From 739c62c21fad363483c5ec70f1050393bd14964c Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Mon, 10 Dec 2018 09:37:14 -0500 Subject: Show instances for TCP relay handshake. --- src/Data/Tox/Relay.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Data') diff --git a/src/Data/Tox/Relay.hs b/src/Data/Tox/Relay.hs index 1fe6d256..02300866 100644 --- a/src/Data/Tox/Relay.hs +++ b/src/Data/Tox/Relay.hs @@ -4,6 +4,8 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE UndecidableInstances #-} module Data.Tox.Relay where import Data.ByteString as B @@ -108,6 +110,8 @@ instance Serialize RelayPacket where -- | Initial client-to-server handshake message. newtype Hello (f :: * -> *) = Hello (Asymm (f HelloData)) +deriving instance Show (f HelloData) => Show (Hello f) + helloFrom :: Hello f -> PublicKey helloFrom (Hello x) = senderKey x @@ -140,6 +144,7 @@ data HelloData = HelloData { sessionPublicKey :: PublicKey , sessionBaseNonce :: Nonce24 } + deriving Show instance Sized HelloData where size = ConstSize 56 @@ -153,6 +158,8 @@ data Welcome (f :: * -> *) = Welcome , welcomeData :: f HelloData } +deriving instance Show (f HelloData) => Show (Welcome f) + instance Rank2.Functor Welcome where f <$> Welcome n dta = Welcome n (f dta) -- cgit v1.2.3