Skip to content
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

cardano-data cleanup #2709

Merged
merged 1 commit into from
Apr 1, 2022
Merged

cardano-data cleanup #2709

merged 1 commit into from
Apr 1, 2022

Conversation

goolord
Copy link
Contributor

@goolord goolord commented Mar 29, 2022

  • removes some usages of fromSJust
  • move encodeKeyedStrictMaybe to cardano-data
  • Introduce ofield and invalidField. I'm not totally sold on these actually, but they're both common patterns and it would be nice if the api nudged you towards writing the SparseKeyed fields in the way it wants you to. A really easy mistake I'm trying to prevent is field (\x foo -> foo { fooX = x }) (From :: Decoder ('Closed d) (StrictMaybe X)) where x is actually omittable
  • Introduce MapE
  • Split up the definite and indefinite length branches of getSparseBlock, into separate functions should very mildly reduce allocations and help branch prediction

@lehins lehins requested a review from TimSheard March 29, 2022 23:57
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have enough familiarity with coders package to say anything definitely about the correctness of the PR, but at a high level it looks great. I've requested @TimSheard to review it, since he'll probably be the best judge in this area.

libs/cardano-data/src/Data/Coders.hs Outdated Show resolved Hide resolved
Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (but always happy to have another review, if Tim still wants to have a look)

@JaredCorduan JaredCorduan merged commit 889897d into master Apr 1, 2022
@iohk-bors iohk-bors bot deleted the zc/cardano-data-cleanup branch April 1, 2022 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants