\begin{code}
{-# LANGUAGE Safe #-}
{-# LANGUAGE StrictData #-}
module Network.Tox.DHT.ClientNode where
import Control.Applicative ((<$>), (<*>))
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
import Network.Tox.NodeInfo.NodeInfo (NodeInfo)
import Network.Tox.Time (Timestamp)
data ClientNode = ClientNode
{ ClientNode -> NodeInfo
nodeInfo :: NodeInfo
, ClientNode -> Timestamp
lastCheck :: Timestamp
, ClientNode -> Int
checkCount :: Int
}
deriving (ClientNode -> ClientNode -> Bool
(ClientNode -> ClientNode -> Bool)
-> (ClientNode -> ClientNode -> Bool) -> Eq ClientNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientNode -> ClientNode -> Bool
$c/= :: ClientNode -> ClientNode -> Bool
== :: ClientNode -> ClientNode -> Bool
$c== :: ClientNode -> ClientNode -> Bool
Eq, ReadPrec [ClientNode]
ReadPrec ClientNode
Int -> ReadS ClientNode
ReadS [ClientNode]
(Int -> ReadS ClientNode)
-> ReadS [ClientNode]
-> ReadPrec ClientNode
-> ReadPrec [ClientNode]
-> Read ClientNode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClientNode]
$creadListPrec :: ReadPrec [ClientNode]
readPrec :: ReadPrec ClientNode
$creadPrec :: ReadPrec ClientNode
readList :: ReadS [ClientNode]
$creadList :: ReadS [ClientNode]
readsPrec :: Int -> ReadS ClientNode
$creadsPrec :: Int -> ReadS ClientNode
Read, Int -> ClientNode -> ShowS
[ClientNode] -> ShowS
ClientNode -> String
(Int -> ClientNode -> ShowS)
-> (ClientNode -> String)
-> ([ClientNode] -> ShowS)
-> Show ClientNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClientNode] -> ShowS
$cshowList :: [ClientNode] -> ShowS
show :: ClientNode -> String
$cshow :: ClientNode -> String
showsPrec :: Int -> ClientNode -> ShowS
$cshowsPrec :: Int -> ClientNode -> ShowS
Show)
newNode :: Timestamp -> NodeInfo -> ClientNode
newNode :: Timestamp -> NodeInfo -> ClientNode
newNode Timestamp
time NodeInfo
node = NodeInfo -> Timestamp -> Int -> ClientNode
ClientNode NodeInfo
node Timestamp
time Int
0
instance Arbitrary ClientNode where
arbitrary :: Gen ClientNode
arbitrary = NodeInfo -> Timestamp -> Int -> ClientNode
ClientNode (NodeInfo -> Timestamp -> Int -> ClientNode)
-> Gen NodeInfo -> Gen (Timestamp -> Int -> ClientNode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen NodeInfo
forall a. Arbitrary a => Gen a
arbitrary Gen (Timestamp -> Int -> ClientNode)
-> Gen Timestamp -> Gen (Int -> ClientNode)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Timestamp
forall a. Arbitrary a => Gen a
arbitrary Gen (Int -> ClientNode) -> Gen Int -> Gen ClientNode
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Int
forall a. Arbitrary a => Gen a
arbitrary
\end{code}