Skip to content

Commit

Permalink
Merge pull request #103 from input-output-hk/newhoggy/new-shelleyBase…
Browse files Browse the repository at this point in the history
…dEraConstraints-function

New `shelleyBasedEraConstraints` function
  • Loading branch information
newhoggy authored Jul 5, 2023
2 parents ea56e4e + 0ad5520 commit 0df480e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cardano-api/internal/Cardano/Api/Eras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module Cardano.Api.Eras
, IsShelleyBasedEra(..)
, AnyShelleyBasedEra(..)
, InAnyShelleyBasedEra(..)
, shelleyBasedEraConstraints
, shelleyBasedToCardanoEra

-- ** Mapping to era types from the Shelley ledger library
Expand Down Expand Up @@ -579,3 +580,15 @@ cardanoEraConstraints = \case
AlonzoEra -> id
BabbageEra -> id
ConwayEra -> id

shelleyBasedEraConstraints :: ()
=> ShelleyBasedEra era
-> (Typeable era => IsShelleyBasedEra era => a)
-> a
shelleyBasedEraConstraints = \case
ShelleyBasedEraShelley -> id
ShelleyBasedEraAllegra -> id
ShelleyBasedEraMary -> id
ShelleyBasedEraAlonzo -> id
ShelleyBasedEraBabbage -> id
ShelleyBasedEraConway -> id
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module Cardano.Api (
CardanoEraStyle(..),
cardanoEraStyle,
shelleyBasedToCardanoEra,
shelleyBasedEraConstraints,

-- * Assertions on era
requireShelleyBasedEra,
Expand Down

0 comments on commit 0df480e

Please sign in to comment.