Skip to content

Commit

Permalink
New inEonForEraMaybe function
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Sep 28, 2023
1 parent c8b1d1b commit 490be69
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions cardano-api/internal/Cardano/Api/Eras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Cardano.Api.Eras

-- * IsEon
, Eon(..)
, inEonForEraMaybe
, forEraInEon
, forEraInEonMaybe
, forEraMaybeEon
Expand Down
9 changes: 9 additions & 0 deletions cardano-api/internal/Cardano/Api/Eras/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Cardano.Api.Eras.Core

-- * IsEon
, Eon(..)
, inEonForEraMaybe
, forEraInEon
, forEraInEonMaybe
, forEraMaybeEon
Expand Down Expand Up @@ -115,6 +116,14 @@ class Eon (eon :: Type -> Type) where
-> CardanoEra era -- ^ Era to check
-> a -- ^ The value to use

inEonForEraMaybe :: ()
=> Eon eon
=> (eon era -> a) -- ^ Function to get the value to use if the eon includes the era
-> CardanoEra era -- ^ Era to check
-> Maybe a -- ^ The value to use
inEonForEraMaybe yes =
inEonForEra Nothing (Just . yes)

forEraInEon :: ()
=> Eon eon
=> CardanoEra era -- ^ Era to check
Expand Down
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module Cardano.Api (

-- * Eon support
Eon(..),
inEonForEraMaybe,
forEraInEon,
forEraInEonMaybe,
forEraMaybeEon,
Expand Down

0 comments on commit 490be69

Please sign in to comment.