diff --git a/libs/cardano-ledger-core/CHANGELOG.md b/libs/cardano-ledger-core/CHANGELOG.md index 109fe0a166a..b849b754c77 100644 --- a/libs/cardano-ledger-core/CHANGELOG.md +++ b/libs/cardano-ledger-core/CHANGELOG.md @@ -2,6 +2,7 @@ ## 1.17.0.0 +* Extract `indexProxy` from `HashAnnotated` type class and deprecate it. * Extract `hashTxAuxData` from `EraTxAuxData` into a standalone function. * Add `TxAuxDataHash` and deprecate `AuxiliaryDayaHash` in its favor. * Deprecate `Cardano.Ledger.Crypto` module in favor of `cardano-protocol-tpraos:Cardano.Protocol.Crypto` diff --git a/libs/cardano-ledger-core/src/Cardano/Ledger/Hashes.hs b/libs/cardano-ledger-core/src/Cardano/Ledger/Hashes.hs index 751d0481ee7..09b5b1ad262 100644 --- a/libs/cardano-ledger-core/src/Cardano/Ledger/Hashes.hs +++ b/libs/cardano-ledger-core/src/Cardano/Ledger/Hashes.hs @@ -76,7 +76,6 @@ module Cardano.Ledger.Hashes ( -- ** Other operations castSafeHash, extractHash, - indexProxy, ) where @@ -386,10 +385,6 @@ instance Hash.HashAlgorithm h => SafeToHash (Hash.Hash h i) where -- can be easily derived (because their methods have default methods when the type is a -- newtype around a type that is 'SafeToHash'). For example, class SafeToHash x => HashAnnotated x i | x -> i where - -- TODO: move outside of type class - indexProxy :: x -> Proxy i - indexProxy _ = Proxy @i - -- | Create a @('SafeHash' i)@, given @(`HashAnnotated` x i)@ instance. hashAnnotated :: x -> SafeHash i hashAnnotated = makeHashWithExplicitProxys (Proxy @i) diff --git a/libs/cardano-ledger-core/src/Cardano/Ledger/SafeHash.hs b/libs/cardano-ledger-core/src/Cardano/Ledger/SafeHash.hs index e3adb237cab..a465eda6c06 100644 --- a/libs/cardano-ledger-core/src/Cardano/Ledger/SafeHash.hs +++ b/libs/cardano-ledger-core/src/Cardano/Ledger/SafeHash.hs @@ -1,3 +1,7 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-redundant-constraints #-} + module Cardano.Ledger.SafeHash {-# DEPRECATED "Use `Cardano.Ledger.Hashes` instead" #-} ( -- * SafeHash and SafeToHash @@ -26,3 +30,8 @@ module Cardano.Ledger.SafeHash where import Cardano.Ledger.Hashes +import Data.Proxy + +indexProxy :: forall x i. HashAnnotated x i => x -> Proxy i +indexProxy _ = Proxy @i +{-# DEPRECATED indexProxy "As useless and unused" #-}