Skip to content

Commit 67fee3d

Browse files
committed
Deprecate all patterns that were not abbreviating a complex expression (that's nearly all of them)
1 parent d9fa5c7 commit 67fee3d

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

cardano-api/internal/Cardano/Api/Address.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,13 @@ instance HasTypeProxy addrtype => HasTypeProxy (Address addrtype) where
211211
data AsType (Address addrtype) = AsAddress (AsType addrtype)
212212
proxyToAsType _ = AsAddress (proxyToAsType (Proxy :: Proxy addrtype))
213213

214+
{-# DEPRECATED AsByronAddress "Use AsAddress AsByronAddr instead" #-}
214215
pattern AsByronAddress :: AsType (Address ByronAddr)
215216
pattern AsByronAddress = AsAddress AsByronAddr
216217

217218
{-# COMPLETE AsByronAddress #-}
218219

220+
{-# DEPRECATED AsShelleyAddress "Use AsAddress AsShelleyAddr instead" #-}
219221
pattern AsShelleyAddress :: AsType (Address ShelleyAddr)
220222
pattern AsShelleyAddress = AsAddress AsShelleyAddr
221223

cardano-api/internal/Cardano/Api/Block.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
{-# LANGUAGE TypeFamilies #-}
1212
{-# LANGUAGE TypeOperators #-}
1313
{-# LANGUAGE ViewPatterns #-}
14+
-- TODO Delete me when the patterns of this file are removed (they are the ones using deprecated - other - patterns)
15+
{-# OPTIONS_GHC -Wno-deprecations #-}
1416

1517
-- | Blocks in the blockchain
1618
module Cardano.Api.Block

cardano-api/internal/Cardano/Api/LedgerState.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,36 +325,43 @@ applyBlock
325325
applyBlock env oldState validationMode =
326326
applyBlock' env oldState validationMode . toConsensusBlock
327327

328+
{-# DEPRECATED LedgerStateByron "Use 'LedgerState $ Consensus.LedgerStateByron' instead" #-}
328329
pattern LedgerStateByron
329330
:: Ledger.LedgerState Byron.ByronBlock
330331
-> LedgerState
331332
pattern LedgerStateByron st <- LedgerState (Consensus.LedgerStateByron st)
332333

334+
{-# DEPRECATED LedgerStateShelley "Use 'LedgerState $ Consensus.LedgerStateShelley' instead" #-}
333335
pattern LedgerStateShelley
334336
:: Ledger.LedgerState Shelley.StandardShelleyBlock
335337
-> LedgerState
336338
pattern LedgerStateShelley st <- LedgerState (Consensus.LedgerStateShelley st)
337339

340+
{-# DEPRECATED LedgerStateAllegra "Use 'LedgerState $ Consensus.LedgerStateAllegra' instead" #-}
338341
pattern LedgerStateAllegra
339342
:: Ledger.LedgerState Shelley.StandardAllegraBlock
340343
-> LedgerState
341344
pattern LedgerStateAllegra st <- LedgerState (Consensus.LedgerStateAllegra st)
342345

346+
{-# DEPRECATED LedgerStateMary "Use 'LedgerState $ Consensus.LedgerStateMary' instead" #-}
343347
pattern LedgerStateMary
344348
:: Ledger.LedgerState Shelley.StandardMaryBlock
345349
-> LedgerState
346350
pattern LedgerStateMary st <- LedgerState (Consensus.LedgerStateMary st)
347351

352+
{-# DEPRECATED LedgerStateAlonzo "Use 'LedgerState $ Consensus.LedgerAlonzo' instead" #-}
348353
pattern LedgerStateAlonzo
349354
:: Ledger.LedgerState Shelley.StandardAlonzoBlock
350355
-> LedgerState
351356
pattern LedgerStateAlonzo st <- LedgerState (Consensus.LedgerStateAlonzo st)
352357

358+
{-# DEPRECATED LedgerStateBabbage "Use 'LedgerState $ Consensus.LedgerBabbage' instead" #-}
353359
pattern LedgerStateBabbage
354360
:: Ledger.LedgerState Shelley.StandardBabbageBlock
355361
-> LedgerState
356362
pattern LedgerStateBabbage st <- LedgerState (Consensus.LedgerStateBabbage st)
357363

364+
{-# DEPRECATED LedgerStateConway "Use 'LedgerState $ Consensus.LedgerConway' instead" #-}
358365
pattern LedgerStateConway
359366
:: Ledger.LedgerState Shelley.StandardConwayBlock
360367
-> LedgerState

cardano-api/internal/Cardano/Api/Script.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ fromAlonzoExUnits Alonzo.ExUnits{Alonzo.exUnitsSteps, Alonzo.exUnitsMem} =
929929
-- Alonzo mediator pattern
930930
--
931931

932+
{-# DEPRECATED PlutusScriptBinary "Use Plutus.Plutus (Plutus.PlutusBinary script) instead" #-}
932933
pattern PlutusScriptBinary :: Plutus.PlutusLanguage l => ShortByteString -> Plutus.Plutus l
933934
pattern PlutusScriptBinary script = Plutus.Plutus (Plutus.PlutusBinary script)
934935

cardano-api/internal/Cardano/Api/Tx/Sign.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,19 @@ instance HasTypeProxy era => HasTypeProxy (Tx era) where
183183
data AsType (Tx era) = AsTx (AsType era)
184184
proxyToAsType _ = AsTx (proxyToAsType (Proxy :: Proxy era))
185185

186+
{-# DEPRECATED AsMaryTx "Use 'AsTx AsMaryEra' instead." #-}
186187
pattern AsMaryTx :: AsType (Tx MaryEra)
187188
pattern AsMaryTx = AsTx AsMaryEra
188189

189190
{-# COMPLETE AsMaryTx #-}
190191

192+
{-# DEPRECATED AsAllegraTx "Use 'AsTx AsAllegraEra' instead." #-}
191193
pattern AsAllegraTx :: AsType (Tx AllegraEra)
192194
pattern AsAllegraTx = AsTx AsAllegraEra
193195

194196
{-# COMPLETE AsAllegraTx #-}
195197

198+
{-# DEPRECATED AsAlonzoTx "Use 'AsTx AsAlonzoEra' instead." #-}
196199
pattern AsAlonzoTx :: AsType (Tx AlonzoEra)
197200
pattern AsAlonzoTx = AsTx AsAlonzoEra
198201

@@ -473,16 +476,19 @@ instance HasTypeProxy era => HasTypeProxy (TxBody era) where
473476
data AsType (TxBody era) = AsTxBody (AsType era)
474477
proxyToAsType _ = AsTxBody (proxyToAsType (Proxy :: Proxy era))
475478

479+
{-# DEPRECATED AsByronTxBody "Use 'AsTxBody AsByronEra' instead." #-}
476480
pattern AsByronTxBody :: AsType (TxBody ByronEra)
477481
pattern AsByronTxBody = AsTxBody AsByronEra
478482

479483
{-# COMPLETE AsByronTxBody #-}
480484

485+
{-# DEPRECATED AsShelleyTxBody "Use 'AsTxBody AsShelleyEra' instead." #-}
481486
pattern AsShelleyTxBody :: AsType (TxBody ShelleyEra)
482487
pattern AsShelleyTxBody = AsTxBody AsShelleyEra
483488

484489
{-# COMPLETE AsShelleyTxBody #-}
485490

491+
{-# DEPRECATED AsMaryTxBody "Use 'AsTxBody AsMaryEra' instead." #-}
486492
pattern AsMaryTxBody :: AsType (TxBody MaryEra)
487493
pattern AsMaryTxBody = AsTxBody AsMaryEra
488494

@@ -658,11 +664,13 @@ instance HasTypeProxy era => HasTypeProxy (KeyWitness era) where
658664
data AsType (KeyWitness era) = AsKeyWitness (AsType era)
659665
proxyToAsType _ = AsKeyWitness (proxyToAsType (Proxy :: Proxy era))
660666

667+
{-# DEPRECATED AsByronWitness "Use AsKeyWitness AsByronEra instead" #-}
661668
pattern AsByronWitness :: AsType (KeyWitness ByronEra)
662669
pattern AsByronWitness = AsKeyWitness AsByronEra
663670

664671
{-# COMPLETE AsByronWitness #-}
665672

673+
{-# DEPRECATED AsShelleyWitness "Use AsKeyWitness AsShelleyEra instead" #-}
666674
pattern AsShelleyWitness :: AsType (KeyWitness ShelleyEra)
667675
pattern AsShelleyWitness = AsKeyWitness AsShelleyEra
668676

@@ -741,6 +749,7 @@ instance IsCardanoEra era => HasTextEnvelope (KeyWitness era) where
741749
getTxBodyAndWitnesses :: Tx era -> (TxBody era, [KeyWitness era])
742750
getTxBodyAndWitnesses tx = (getTxBody tx, getTxWitnesses tx)
743751

752+
-- | This pattern will be deprecated in the future. We advise against introducing new usage of it.
744753
pattern Tx :: TxBody era -> [KeyWitness era] -> Tx era
745754
pattern Tx txbody ws <- (getTxBodyAndWitnesses -> (txbody, ws))
746755
where

0 commit comments

Comments
 (0)