{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
module Net.Stream
where
-- import Data.Hashable
import Data.Word (Word32)
-- import Options.Applicative

-- Phantom types
data Mptcp
data Tcp
-- data Protocol = Tcp | Mptcp
-- type TcpFlagList = [TcpFlag]

-- TODO use Word instead
newtype StreamId a = StreamId Word32 deriving (Int -> StreamId a -> ShowS
[StreamId a] -> ShowS
StreamId a -> String
(Int -> StreamId a -> ShowS)
-> (StreamId a -> String)
-> ([StreamId a] -> ShowS)
-> Show (StreamId a)
forall a. Int -> StreamId a -> ShowS
forall a. [StreamId a] -> ShowS
forall a. StreamId a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamId a] -> ShowS
$cshowList :: forall a. [StreamId a] -> ShowS
show :: StreamId a -> String
$cshow :: forall a. StreamId a -> String
showsPrec :: Int -> StreamId a -> ShowS
$cshowsPrec :: forall a. Int -> StreamId a -> ShowS
Show, ReadPrec [StreamId a]
ReadPrec (StreamId a)
Int -> ReadS (StreamId a)
ReadS [StreamId a]
(Int -> ReadS (StreamId a))
-> ReadS [StreamId a]
-> ReadPrec (StreamId a)
-> ReadPrec [StreamId a]
-> Read (StreamId a)
forall a. ReadPrec [StreamId a]
forall a. ReadPrec (StreamId a)
forall a. Int -> ReadS (StreamId a)
forall a. ReadS [StreamId a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamId a]
$creadListPrec :: forall a. ReadPrec [StreamId a]
readPrec :: ReadPrec (StreamId a)
$creadPrec :: forall a. ReadPrec (StreamId a)
readList :: ReadS [StreamId a]
$creadList :: forall a. ReadS [StreamId a]
readsPrec :: Int -> ReadS (StreamId a)
$creadsPrec :: forall a. Int -> ReadS (StreamId a)
Read, StreamId a -> StreamId a -> Bool
(StreamId a -> StreamId a -> Bool)
-> (StreamId a -> StreamId a -> Bool) -> Eq (StreamId a)
forall a. StreamId a -> StreamId a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamId a -> StreamId a -> Bool
$c/= :: forall a. StreamId a -> StreamId a -> Bool
== :: StreamId a -> StreamId a -> Bool
$c== :: forall a. StreamId a -> StreamId a -> Bool
Eq, Eq (StreamId a)
Eq (StreamId a)
-> (StreamId a -> StreamId a -> Ordering)
-> (StreamId a -> StreamId a -> Bool)
-> (StreamId a -> StreamId a -> Bool)
-> (StreamId a -> StreamId a -> Bool)
-> (StreamId a -> StreamId a -> Bool)
-> (StreamId a -> StreamId a -> StreamId a)
-> (StreamId a -> StreamId a -> StreamId a)
-> Ord (StreamId a)
StreamId a -> StreamId a -> Bool
StreamId a -> StreamId a -> Ordering
StreamId a -> StreamId a -> StreamId a
forall a. Eq (StreamId a)
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. StreamId a -> StreamId a -> Bool
forall a. StreamId a -> StreamId a -> Ordering
forall a. StreamId a -> StreamId a -> StreamId a
min :: StreamId a -> StreamId a -> StreamId a
$cmin :: forall a. StreamId a -> StreamId a -> StreamId a
max :: StreamId a -> StreamId a -> StreamId a
$cmax :: forall a. StreamId a -> StreamId a -> StreamId a
>= :: StreamId a -> StreamId a -> Bool
$c>= :: forall a. StreamId a -> StreamId a -> Bool
> :: StreamId a -> StreamId a -> Bool
$c> :: forall a. StreamId a -> StreamId a -> Bool
<= :: StreamId a -> StreamId a -> Bool
$c<= :: forall a. StreamId a -> StreamId a -> Bool
< :: StreamId a -> StreamId a -> Bool
$c< :: forall a. StreamId a -> StreamId a -> Bool
compare :: StreamId a -> StreamId a -> Ordering
$ccompare :: forall a. StreamId a -> StreamId a -> Ordering
$cp1Ord :: forall a. Eq (StreamId a)
Ord)
type StreamIdTcp = StreamId Tcp
type StreamIdMptcp = StreamId Mptcp

-- showStream :: StreamId a -> Text