Skip to content

Simplify record fields#114

Merged
jorisdral merged 4 commits intohaskell-cryptography:mainfrom
willbasky:simple_fields
Jan 13, 2026
Merged

Simplify record fields#114
jorisdral merged 4 commits intohaskell-cryptography:mainfrom
willbasky:simple_fields

Conversation

@willbasky
Copy link
Contributor

Resolve #96

@willbasky willbasky requested a review from jorisdral as a code owner January 3, 2026 04:40
data MutableBlockCipher = MkMutableBlockCipher
{ mutableBlockCipherType :: BlockCipher
, mutableBlockCipherCtx :: Low.BlockCipher
{ algo :: BlockCipher
Copy link
Contributor Author

@willbasky willbasky Jan 3, 2026

Choose a reason for hiding this comment

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

Not sure if algo is good the replacement for the type...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe something like inner?

@willbasky
Copy link
Contributor Author

There newtypes unwrapper and runners. Do you need them to be reduced?

@jorisdral
Copy link
Collaborator

There newtypes unwrapper and runners. Do you need them to be reduced?

Ideally yes. For example, I think

newtype BotanHash = MkBotanHash { runBotanHash :: Ptr BotanHashStruct }

could be changed to

newtype BotanHash = MkBotanHash { ptr :: Ptr BotanHashStruct }

Copy link
Collaborator

@jorisdral jorisdral left a comment

Choose a reason for hiding this comment

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

Thanks!

data MutableBlockCipher = MkMutableBlockCipher
{ mutableBlockCipherType :: BlockCipher
, mutableBlockCipherCtx :: Low.BlockCipher
{ algo :: BlockCipher
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe something like inner?

@willbasky
Copy link
Contributor Author

Botan's newtypes reduced to un.
Botan-bindings' newtypes reduced to ptr.
Botan-low's newtypess reduced to foreignPtr.

Copy link
Collaborator

@jorisdral jorisdral left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for your contribution.

One small thing you missed, and then we can merge this. I'll add changelog entries in a separate PR

Co-authored-by: Joris Dral <jorisjdral@gmail.com>
@jorisdral
Copy link
Collaborator

There are some CI failures, I see. Do you want to take care of them? I could also do it, but I'd have to copy your branch and open a separate PR

@willbasky
Copy link
Contributor Author

Sure, let me see it.

@jorisdral jorisdral added this pull request to the merge queue Jan 13, 2026
Merged via the queue into haskell-cryptography:main with commit 6c83b8d Jan 13, 2026
35 checks passed
jorisdral added a commit that referenced this pull request Jan 13, 2026
jorisdral added a commit that referenced this pull request Jan 13, 2026
We should probably keep the record field the same name as the `ConstPtr` type
from `base`.
jorisdral added a commit that referenced this pull request Jan 13, 2026
@jorisdral
Copy link
Collaborator

jorisdral commented Jan 13, 2026

@willbasky merged now. Thanks for your contribution!

FYI: I've opened #117 with just a few small follow-ups, nothing major

Also, just asking out of interest: are you using these libraries in your own projects?

jorisdral added a commit that referenced this pull request Jan 14, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 14, 2026
…-fields-followup

Add changelogs for PR #114, small tweaks
@willbasky
Copy link
Contributor Author

@jorisdral
I haven't used it yet. I just love writing something with Haskell and due to lack of a job I contribute to open source projects.

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.

Use DuplicateRecordFields, NoFieldSelectors, and OverloadedRecordDot

2 participants