{-# 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
showList :: [NetworkMagic] -> ShowS
$cshowList :: [NetworkMagic] -> ShowS
show :: NetworkMagic -> String
$cshow :: NetworkMagic -> String
showsPrec :: Int -> NetworkMagic -> ShowS
$cshowsPrec :: Int -> NetworkMagic -> ShowS
Show, NetworkMagic -> NetworkMagic -> Bool
(NetworkMagic -> NetworkMagic -> Bool)
-> (NetworkMagic -> NetworkMagic -> Bool) -> Eq NetworkMagic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkMagic -> NetworkMagic -> Bool
$c/= :: NetworkMagic -> NetworkMagic -> Bool
== :: NetworkMagic -> NetworkMagic -> Bool
$c== :: 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
$cto :: forall x. Rep NetworkMagic x -> NetworkMagic
$cfrom :: forall x. NetworkMagic -> Rep NetworkMagic x
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
showTypeOf :: Proxy NetworkMagic -> String
$cshowTypeOf :: Proxy NetworkMagic -> String
wNoThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
noThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> NetworkMagic -> IO (Maybe ThunkInfo)
NoThunks)