@@ -341,7 +341,16 @@ readFileTxKeyWitness
341341 -> IO (Either (FileError TextEnvelopeError ) (InAnyShelleyBasedEra KeyWitness ))
342342readFileTxKeyWitness fp = do
343343 file <- fileOrPipe fp
344- readFileInAnyShelleyBasedEra AsKeyWitness file
344+ readFileOrPipeTextEnvelopeAnyOf fromSomeShelleyTxWitness file
345+
346+ fromSomeShelleyTxWitness :: [FromSomeType HasTextEnvelope (InAnyShelleyBasedEra KeyWitness )]
347+ fromSomeShelleyTxWitness =
348+ [ shelleyBasedEraConstraints sbe $ FromSomeType (makeWitnessProxy sbe) (InAnyShelleyBasedEra sbe)
349+ | AnyShelleyBasedEra sbe <- [minBound .. maxBound ]
350+ ]
351+ where
352+ makeWitnessProxy :: HasTypeProxy era => ShelleyBasedEra era -> AsType (KeyWitness era )
353+ makeWitnessProxy _ = AsKeyWitness (proxyToAsType (Proxy :: Proxy era ))
345354
346355txWitnessTextEnvelopeTypes :: [Text ]
347356txWitnessTextEnvelopeTypes =
@@ -614,29 +623,6 @@ readCostModels (File fp) = do
614623 when (null $ fromAlonzoCostModels costModels) $ throwE $ CostModelsErrorEmpty fp
615624 return costModels
616625
617- -- Misc
618-
619- readFileInAnyShelleyBasedEra
620- :: ( HasTextEnvelope (thing ShelleyEra )
621- , HasTextEnvelope (thing AllegraEra )
622- , HasTextEnvelope (thing MaryEra )
623- , HasTextEnvelope (thing AlonzoEra )
624- , HasTextEnvelope (thing BabbageEra )
625- , HasTextEnvelope (thing ConwayEra )
626- )
627- => (forall era . AsType era -> AsType (thing era ))
628- -> FileOrPipe
629- -> IO (Either (FileError TextEnvelopeError ) (InAnyShelleyBasedEra thing ))
630- readFileInAnyShelleyBasedEra asThing =
631- readFileOrPipeTextEnvelopeAnyOf
632- [ FromSomeType (asThing AsShelleyEra ) (InAnyShelleyBasedEra ShelleyBasedEraShelley )
633- , FromSomeType (asThing AsAllegraEra ) (InAnyShelleyBasedEra ShelleyBasedEraAllegra )
634- , FromSomeType (asThing AsMaryEra ) (InAnyShelleyBasedEra ShelleyBasedEraMary )
635- , FromSomeType (asThing AsAlonzoEra ) (InAnyShelleyBasedEra ShelleyBasedEraAlonzo )
636- , FromSomeType (asThing AsBabbageEra ) (InAnyShelleyBasedEra ShelleyBasedEraBabbage )
637- , FromSomeType (asThing AsConwayEra ) (InAnyShelleyBasedEra ShelleyBasedEraConway )
638- ]
639-
640626-- | We need a type for handling files that may be actually be things like
641627-- pipes. Currently the CLI makes no guarantee that a "file" will only
642628-- be read once. This is a problem for a user who who expects to be able to pass
0 commit comments