summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Data/Tox/Relay.hs7
1 files changed, 7 insertions, 0 deletions
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 @@
4{-# LANGUAGE GeneralizedNewtypeDeriving #-} 4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5{-# LANGUAGE KindSignatures #-} 5{-# LANGUAGE KindSignatures #-}
6{-# LANGUAGE MultiParamTypeClasses #-} 6{-# LANGUAGE MultiParamTypeClasses #-}
7{-# LANGUAGE StandaloneDeriving #-}
8{-# LANGUAGE UndecidableInstances #-}
7module Data.Tox.Relay where 9module Data.Tox.Relay where
8 10
9import Data.ByteString as B 11import Data.ByteString as B
@@ -108,6 +110,8 @@ instance Serialize RelayPacket where
108-- | Initial client-to-server handshake message. 110-- | Initial client-to-server handshake message.
109newtype Hello (f :: * -> *) = Hello (Asymm (f HelloData)) 111newtype Hello (f :: * -> *) = Hello (Asymm (f HelloData))
110 112
113deriving instance Show (f HelloData) => Show (Hello f)
114
111helloFrom :: Hello f -> PublicKey 115helloFrom :: Hello f -> PublicKey
112helloFrom (Hello x) = senderKey x 116helloFrom (Hello x) = senderKey x
113 117
@@ -140,6 +144,7 @@ data HelloData = HelloData
140 { sessionPublicKey :: PublicKey 144 { sessionPublicKey :: PublicKey
141 , sessionBaseNonce :: Nonce24 145 , sessionBaseNonce :: Nonce24
142 } 146 }
147 deriving Show
143 148
144instance Sized HelloData where size = ConstSize 56 149instance Sized HelloData where size = ConstSize 56
145 150
@@ -153,6 +158,8 @@ data Welcome (f :: * -> *) = Welcome
153 , welcomeData :: f HelloData 158 , welcomeData :: f HelloData
154 } 159 }
155 160
161deriving instance Show (f HelloData) => Show (Welcome f)
162
156instance Rank2.Functor Welcome where 163instance Rank2.Functor Welcome where
157 f <$> Welcome n dta = Welcome n (f dta) 164 f <$> Welcome n dta = Welcome n (f dta)
158 165