{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}

module Cardano.Ledger.AuxiliaryData (
  AuxiliaryDataHash (..),
)
where

import Cardano.Ledger.Binary (DecCBOR, EncCBOR)
import Cardano.Ledger.Crypto (Crypto)
import Cardano.Ledger.Hashes (EraIndependentTxAuxData)
import Cardano.Ledger.SafeHash (SafeHash)
import Control.DeepSeq (NFData (..))
import Data.Aeson (ToJSON)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks (..))

newtype AuxiliaryDataHash c = AuxiliaryDataHash
  { forall c. AuxiliaryDataHash c -> SafeHash c EraIndependentTxAuxData
unsafeAuxiliaryDataHash :: SafeHash c EraIndependentTxAuxData
  }
  deriving (Int -> AuxiliaryDataHash c -> ShowS
forall c. Int -> AuxiliaryDataHash c -> ShowS
forall c. [AuxiliaryDataHash c] -> ShowS
forall c. AuxiliaryDataHash c -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuxiliaryDataHash c] -> ShowS
$cshowList :: forall c. [AuxiliaryDataHash c] -> ShowS
show :: AuxiliaryDataHash c -> String
$cshow :: forall c. AuxiliaryDataHash c -> String
showsPrec :: Int -> AuxiliaryDataHash c -> ShowS
$cshowsPrec :: forall c. Int -> AuxiliaryDataHash c -> ShowS
Show, AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
$c/= :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
== :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
$c== :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
Eq, AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
AuxiliaryDataHash c -> AuxiliaryDataHash c -> Ordering
AuxiliaryDataHash c -> AuxiliaryDataHash c -> AuxiliaryDataHash c
forall c. Eq (AuxiliaryDataHash c)
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 c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Ordering
forall c.
AuxiliaryDataHash c -> AuxiliaryDataHash c -> AuxiliaryDataHash c
min :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> AuxiliaryDataHash c
$cmin :: forall c.
AuxiliaryDataHash c -> AuxiliaryDataHash c -> AuxiliaryDataHash c
max :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> AuxiliaryDataHash c
$cmax :: forall c.
AuxiliaryDataHash c -> AuxiliaryDataHash c -> AuxiliaryDataHash c
>= :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
$c>= :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
> :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
$c> :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
<= :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
$c<= :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
< :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
$c< :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Bool
compare :: AuxiliaryDataHash c -> AuxiliaryDataHash c -> Ordering
$ccompare :: forall c. AuxiliaryDataHash c -> AuxiliaryDataHash c -> Ordering
Ord, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall c x. Rep (AuxiliaryDataHash c) x -> AuxiliaryDataHash c
forall c x. AuxiliaryDataHash c -> Rep (AuxiliaryDataHash c) x
$cto :: forall c x. Rep (AuxiliaryDataHash c) x -> AuxiliaryDataHash c
$cfrom :: forall c x. AuxiliaryDataHash c -> Rep (AuxiliaryDataHash c) x
Generic, Context -> AuxiliaryDataHash c -> IO (Maybe ThunkInfo)
Proxy (AuxiliaryDataHash c) -> String
forall c. Context -> AuxiliaryDataHash c -> IO (Maybe ThunkInfo)
forall c. Proxy (AuxiliaryDataHash c) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (AuxiliaryDataHash c) -> String
$cshowTypeOf :: forall c. Proxy (AuxiliaryDataHash c) -> String
wNoThunks :: Context -> AuxiliaryDataHash c -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall c. Context -> AuxiliaryDataHash c -> IO (Maybe ThunkInfo)
noThunks :: Context -> AuxiliaryDataHash c -> IO (Maybe ThunkInfo)
$cnoThunks :: forall c. Context -> AuxiliaryDataHash c -> IO (Maybe ThunkInfo)
NoThunks, AuxiliaryDataHash c -> ()
forall c. AuxiliaryDataHash c -> ()
forall a. (a -> ()) -> NFData a
rnf :: AuxiliaryDataHash c -> ()
$crnf :: forall c. AuxiliaryDataHash c -> ()
NFData)

deriving instance Crypto c => EncCBOR (AuxiliaryDataHash c)

deriving instance Crypto c => DecCBOR (AuxiliaryDataHash c)

deriving newtype instance Crypto c => ToJSON (AuxiliaryDataHash c)