{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Ouroboros.Network.Magic where

import Data.Word (Word32)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)


-- | NetworkMagic is used to differentiate between different networks during the initial handshake.
newtype NetworkMagic  = NetworkMagic { NetworkMagic -> Word32
unNetworkMagic :: Word32 }
  deriving (Int -> NetworkMagic -> ShowS
[NetworkMagic] -> ShowS
NetworkMagic -> String
(Int -> NetworkMagic -> ShowS)
-> (NetworkMagic -> String)
-> ([NetworkMagic] -> ShowS)
-> Show NetworkMagic
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NetworkMagic -> ShowS
showsPrec :: Int -> NetworkMagic -> ShowS
$cshow :: NetworkMagic -> String
show :: NetworkMagic -> String
$cshowList :: [NetworkMagic] -> ShowS
showList :: [NetworkMagic] -> ShowS
Show, NetworkMagic -> NetworkMagic -> Bool
(NetworkMagic -> NetworkMagic -> Bool)
-> (NetworkMagic -> NetworkMagic -> Bool) -> Eq NetworkMagic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NetworkMagic -> NetworkMagic -> Bool
== :: NetworkMagic -> NetworkMagic -> Bool
$c/= :: NetworkMagic -> NetworkMagic -> Bool
/= :: NetworkMagic -> NetworkMagic -> Bool
Eq, (forall x. NetworkMagic -> Rep NetworkMagic x)
-> (forall x. Rep NetworkMagic x -> NetworkMagic)
-> Generic NetworkMagic
forall x. Rep NetworkMagic x -> NetworkMagic
forall x. NetworkMagic -> Rep NetworkMagic x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. NetworkMagic -> Rep NetworkMagic x
from :: forall x. NetworkMagic -> Rep NetworkMagic x
$cto :: forall x. Rep NetworkMagic x -> NetworkMagic
to :: forall x. Rep NetworkMagic x -> NetworkMagic
Generic, Context -> NetworkMagic -> IO (Maybe ThunkInfo)
Proxy NetworkMagic -> String
(Context -> NetworkMagic -> IO (Maybe ThunkInfo))
-> (Context -> NetworkMagic -> IO (Maybe ThunkInfo))
-> (Proxy NetworkMagic -> String)
-> NoThunks NetworkMagic
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
$cnoThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
noThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
$cshowTypeOf :: Proxy NetworkMagic -> String
showTypeOf :: Proxy NetworkMagic -> String
NoThunks)