{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}

module Cardano.Chain.Genesis.Hash (
  GenesisHash (..),
) where

import Cardano.Crypto.Hashing (Hash)
import Cardano.Crypto.Raw (Raw)
import Cardano.Ledger.Binary (DecCBOR, EncCBOR)
import Cardano.Prelude
import Data.Aeson (ToJSON)
import NoThunks.Class (NoThunks (..))

newtype GenesisHash = GenesisHash
  { GenesisHash -> Hash Raw
unGenesisHash :: Hash Raw
  }
  deriving (GenesisHash -> GenesisHash -> Bool
(GenesisHash -> GenesisHash -> Bool)
-> (GenesisHash -> GenesisHash -> Bool) -> Eq GenesisHash
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenesisHash -> GenesisHash -> Bool
== :: GenesisHash -> GenesisHash -> Bool
$c/= :: GenesisHash -> GenesisHash -> Bool
/= :: GenesisHash -> GenesisHash -> Bool
Eq, (forall x. GenesisHash -> Rep GenesisHash x)
-> (forall x. Rep GenesisHash x -> GenesisHash)
-> Generic GenesisHash
forall x. Rep GenesisHash x -> GenesisHash
forall x. GenesisHash -> Rep GenesisHash x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GenesisHash -> Rep GenesisHash x
from :: forall x. GenesisHash -> Rep GenesisHash x
$cto :: forall x. Rep GenesisHash x -> GenesisHash
to :: forall x. Rep GenesisHash x -> GenesisHash
Generic, GenesisHash -> ()
(GenesisHash -> ()) -> NFData GenesisHash
forall a. (a -> ()) -> NFData a
$crnf :: GenesisHash -> ()
rnf :: GenesisHash -> ()
NFData, Typeable GenesisHash
Typeable GenesisHash =>
(forall s. Decoder s GenesisHash)
-> (forall s. Proxy GenesisHash -> Decoder s ())
-> (Proxy GenesisHash -> Text)
-> DecCBOR GenesisHash
Proxy GenesisHash -> Text
forall s. Decoder s GenesisHash
forall a.
Typeable a =>
(forall s. Decoder s a)
-> (forall s. Proxy a -> Decoder s ())
-> (Proxy a -> Text)
-> DecCBOR a
forall s. Proxy GenesisHash -> Decoder s ()
$cdecCBOR :: forall s. Decoder s GenesisHash
decCBOR :: forall s. Decoder s GenesisHash
$cdropCBOR :: forall s. Proxy GenesisHash -> Decoder s ()
dropCBOR :: forall s. Proxy GenesisHash -> Decoder s ()
$clabel :: Proxy GenesisHash -> Text
label :: Proxy GenesisHash -> Text
DecCBOR, Typeable GenesisHash
Typeable GenesisHash =>
(GenesisHash -> Encoding)
-> ((forall t. EncCBOR t => Proxy t -> Size)
    -> Proxy GenesisHash -> Size)
-> ((forall t. EncCBOR t => Proxy t -> Size)
    -> Proxy [GenesisHash] -> Size)
-> EncCBOR GenesisHash
GenesisHash -> Encoding
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [GenesisHash] -> Size
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy GenesisHash -> Size
forall a.
Typeable a =>
(a -> Encoding)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> EncCBOR a
$cencCBOR :: GenesisHash -> Encoding
encCBOR :: GenesisHash -> Encoding
$cencodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy GenesisHash -> Size
encodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy GenesisHash -> Size
$cencodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [GenesisHash] -> Size
encodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [GenesisHash] -> Size
EncCBOR, Context -> GenesisHash -> IO (Maybe ThunkInfo)
Proxy GenesisHash -> String
(Context -> GenesisHash -> IO (Maybe ThunkInfo))
-> (Context -> GenesisHash -> IO (Maybe ThunkInfo))
-> (Proxy GenesisHash -> String)
-> NoThunks GenesisHash
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
$cnoThunks :: Context -> GenesisHash -> IO (Maybe ThunkInfo)
noThunks :: Context -> GenesisHash -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> GenesisHash -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> GenesisHash -> IO (Maybe ThunkInfo)
$cshowTypeOf :: Proxy GenesisHash -> String
showTypeOf :: Proxy GenesisHash -> String
NoThunks)

deriving instance Show GenesisHash

-- Used for debugging purposes only
instance ToJSON GenesisHash