-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve TxSeq
decoders
#4904
base: master
Are you sure you want to change the base?
Improve TxSeq
decoders
#4904
Conversation
and reuse it in all `TxSeq` decoders
68bc780
to
e5934d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just one suggestion with simplification.
Thank you
@@ -242,6 +226,21 @@ txSeqDecoder lax = do | |||
Seq.zipWith3 segWitAnnTx bodies wits metadata | |||
pure $ TxSeq' <$> txns <*> bodiesAnn <*> witsAnn <*> metadataAnn | |||
|
|||
auxDataSeqDecoder :: | |||
Int -> IntMap (m (TxAuxData era)) -> Bool -> Decoder s (Seq (Maybe (m (TxAuxData era)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow you to avoid using runIdentity
Int -> IntMap (m (TxAuxData era)) -> Bool -> Decoder s (Seq (Maybe (m (TxAuxData era)))) | |
Int -> IntMap a -> Bool -> Decoder s (Seq (Maybe a)) |
fmap (fmap runIdentity) | ||
<$> auxDataSeqDecoder bodiesLength (fmap pure auxDataMap) False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to complicate the normal decoder
fmap (fmap runIdentity) | |
<$> auxDataSeqDecoder bodiesLength (fmap pure auxDataMap) False | |
auxDataSeqDecoder bodiesLength auxDataMap False |
Description
Changes the decoders of the
TxAuxData
withinTxSeq
to deserialize asIntMap
instead ofMap Int
Closes #4900
Checklist
CHANGELOG.md
files updated for packages with externally visible changesNew section is never added with the code changes. (See RELEASING.md)
.cabal
andCHANGELOG.md
files when necessary, according to theversioning process.
.cabal
files updated when necessaryIf you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
scripts/fourmolize.sh
)scripts/cabal-format.sh
)hie.yaml
updated (usescripts/gen-hie.sh
)