Skip to content

Conversation

@erikd
Copy link
Contributor

@erikd erikd commented Nov 30, 2025

Description

The expression lovelaceToAda. MkFixed . fromIntegral incorrectly places the decimal point 12 spaces from the RH end instead of 6 places. Removing the MkFixed portion fixes the conversion.

Also change the type of lovelaceToAda so it cannot be used incorrectly.

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu on version 0.17.0.0 (which can be run with scripts/fourmolize.sh)
  • Self-reviewed the diff

Migrations

  • The pr causes a breaking change of type a,b or c
  • If there is a breaking change, the pr includes a database migration and/or a fix process for old values, so that upgrade is possible
  • Resyncing and running the migrations provided will result in the same database semantically

If there is a breaking change, especially a big one, please add a justification here. Please elaborate
more what the migration achieves, what it cannot achieve or why a migration is not possible.

erikd added 2 commits December 1, 2025 08:02
The expression `lovelaceToAda. MkFixed . fromIntegral` incorrectly
places the decimal point 12 spaces from the RH end instead of 6
places. Removing the `MkFixed` portion fixes the conversion.

Closes: #2031
The old version of this function had type `Micro -> Ada`, but that
type allowed its use in `lovelaceToAda . MkFixed . fromIntegral` AND
as `lovelaceToAda . fromIntegral` with the former giving INCORRECT
results.
By switching the type to `Integer -> Ada` it is no longer possible
to use this function incorrectly.

Related: #2031
@erikd erikd requested a review from a team as a code owner November 30, 2025 21:14
@erikd erikd merged commit 698ffde into master Dec 1, 2025
10 checks passed
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