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

[ADP-3350] Fix Cardano.Wallet.Read.Block.SlotNo #4535

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

HeinrichApfelmus
Copy link
Contributor

@HeinrichApfelmus HeinrichApfelmus commented Apr 12, 2024

This pull request fixes the Cardano.Wallet.Read.Block.SlotNo module which encountered some difficulties with type class resolution and orphan instances, to the point where I suspected a compiler bug.

I have also added NoThunks and Generic instances for the Cardano.Wallet.Read.SlotNo type in preparation for future pull requests.

Issue Number

Discovered during ADP-3350

@HeinrichApfelmus HeinrichApfelmus self-assigned this Apr 12, 2024
Copy link
Contributor

@jonathanknowles jonathanknowles left a comment

Choose a reason for hiding this comment

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

👍🏻
(Just one small suggestion)

Comment on lines +68 to +70
deriving (Eq, Ord, Show, Generic)

instance NoThunks SlotNo
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be shortened to:

Suggested change
deriving (Eq, Ord, Show, Generic)
instance NoThunks SlotNo
deriving stock (Eq, Ord, Show, Generic)
deriving anyclass NoThunks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

… but this is only shorter if you don't count the lines

{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DeriveAnyClass #-}

that would have to be added at the top of the file. 🤓

I prefer to keep this code as is, as the intent is clear. In general, I only support new language extensions

  • if they provide value with a good value/cost ratio
  • and if they are established as part of the "team dialect of Haskell". (mental load)

Copy link
Contributor

@paweljakubas paweljakubas left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -56,6 +56,8 @@ import qualified Ouroboros.Consensus.Shelley.Ledger as O
type ConsensusBlock = O.CardanoBlock O.StandardCrypto

-- Family of era-specific block types
-- TODO: The results of this type family should be ledger types,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we avoid TODOs without a ticket attached ?

Copy link
Contributor Author

@HeinrichApfelmus HeinrichApfelmus Apr 15, 2024

Choose a reason for hiding this comment

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

Fair enough. I have created ADP-3351 to track this, and recorded it here.

@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-3350/fix-slotno branch from c3825df to c81fb4f Compare April 15, 2024 12:09
@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-3350/fix-slotno branch from c81fb4f to 82d1b6c Compare April 15, 2024 13:19
@HeinrichApfelmus HeinrichApfelmus added this pull request to the merge queue Apr 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 15, 2024
@HeinrichApfelmus HeinrichApfelmus added this pull request to the merge queue Apr 15, 2024
Merged via the queue into master with commit ea95825 Apr 15, 2024
3 checks passed
@HeinrichApfelmus HeinrichApfelmus deleted the HeinrichApfelmus/ADP-3350/fix-slotno branch April 15, 2024 15:31
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.

4 participants