Skip to content

Commit

Permalink
Simplify anyAddressInEra
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Oct 28, 2023
1 parent c8ed7de commit 93d71ad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cardano-api/internal/Cardano/Api/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,13 @@ anyAddressInShelleyBasedEra sbe = \case
anyAddressInEra :: CardanoEra era
-> AddressAny
-> Either String (AddressInEra era)
anyAddressInEra _ (AddressByron addr) =
anyAddressInEra era = \case
AddressByron addr ->
Right (AddressInEra ByronAddressInAnyEra addr)

anyAddressInEra era (AddressShelley addr) =
case cardanoEraStyle era of
LegacyByronEra -> Left "Expected Byron based era address"
ShelleyBasedEra era' -> Right (AddressInEra (ShelleyAddressInEra era') addr)
AddressShelley addr ->
forEraInEon era
(Left "Expected Byron based era address")
(\sbe -> Right (AddressInEra (ShelleyAddressInEra sbe) addr))

toAddressAny :: Address addr -> AddressAny
toAddressAny a@ShelleyAddress{} = AddressShelley a
Expand Down

0 comments on commit 93d71ad

Please sign in to comment.