Skip to content

Commit e8f0bea

Browse files
committed
Extract indexProxy from HashAnnotated type class and deprecate it
1 parent 2182bc3 commit e8f0bea

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

libs/cardano-ledger-core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.17.0.0
44

5+
* Extract `indexProxy` from `HashAnnotated` type class and deprecate it.
56
* Extract `hashTxAuxData` from `EraTxAuxData` into a standalone function.
67
* Add `TxAuxDataHash` and deprecate `AuxiliaryDayaHash` in its favor.
78
* Deprecate `Cardano.Ledger.Crypto` module in favor of `cardano-protocol-tpraos:Cardano.Protocol.Crypto`

libs/cardano-ledger-core/src/Cardano/Ledger/Hashes.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ module Cardano.Ledger.Hashes (
7676
-- ** Other operations
7777
castSafeHash,
7878
extractHash,
79-
indexProxy,
8079
)
8180
where
8281

@@ -386,10 +385,6 @@ instance Hash.HashAlgorithm h => SafeToHash (Hash.Hash h i) where
386385
-- can be easily derived (because their methods have default methods when the type is a
387386
-- newtype around a type that is 'SafeToHash'). For example,
388387
class SafeToHash x => HashAnnotated x i | x -> i where
389-
-- TODO: move outside of type class
390-
indexProxy :: x -> Proxy i
391-
indexProxy _ = Proxy @i
392-
393388
-- | Create a @('SafeHash' i)@, given @(`HashAnnotated` x i)@ instance.
394389
hashAnnotated :: x -> SafeHash i
395390
hashAnnotated = makeHashWithExplicitProxys (Proxy @i)

libs/cardano-ledger-core/src/Cardano/Ledger/SafeHash.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
{-# LANGUAGE ScopedTypeVariables #-}
2+
{-# LANGUAGE TypeApplications #-}
3+
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
4+
15
module Cardano.Ledger.SafeHash
26
{-# DEPRECATED "Use `Cardano.Ledger.Hashes` instead" #-} (
37
-- * SafeHash and SafeToHash
@@ -26,3 +30,8 @@ module Cardano.Ledger.SafeHash
2630
where
2731

2832
import Cardano.Ledger.Hashes
33+
import Data.Proxy
34+
35+
indexProxy :: forall x i. HashAnnotated x i => x -> Proxy i
36+
indexProxy _ = Proxy @i
37+
{-# DEPRECATED indexProxy "As useless and unused" #-}

0 commit comments

Comments
 (0)