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

Add Classy versions of Era witness functions #537

Closed
wants to merge 1 commit into from

Conversation

locallycompact
Copy link
Contributor

@locallycompact locallycompact commented May 16, 2024

Changelog

- description: |
    Add `IsAllegraBasedEra`, `IsAlonzoBasedEra`, `IsBabbageBasedEra`, `IsConwayBasedEra`, `IsMaryBasedEra` type classes.
    Add `ToAlonzoScript` and `HasScriptLanguageInEra` type classes.
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@smelc
Copy link
Contributor

smelc commented May 17, 2024

cc @newhoggy who is the main author of the era system.

@locallycompact
Copy link
Contributor Author

Any opinions on this @newhoggy ?

@smelc
Copy link
Contributor

smelc commented Jun 6, 2024

cc @carbolymer

Copy link
Contributor

@carbolymer carbolymer 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, left a few remarks about naming things

Comment on lines 8 to 9
class IsAllegraEraOnwards era where
allegraEraOnwards :: AllegraEraOnwards era
Copy link
Contributor

Choose a reason for hiding this comment

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

This class is similar to IsShelleyBasedEra in Cardano.Api.Eon.ShelleyBasedEra. I propose two things:

  1. Move it to Cardano.Api.Eon.AlonzoEraOnwards
  2. Rename it, to keep things consistent:
Suggested change
class IsAllegraEraOnwards era where
allegraEraOnwards :: AllegraEraOnwards era
class IsAllegraBasedEra era where
allegraBasedEra :: AllegraEraOnwards era

ShelleyBasedEra things are quite proliferated in CLI and testnet so it would make more sense to stick to this naming convention instead of using eon-like (ShelleyEraOnwards) imo.


-- | Type class to produce 'AlonzoEraOnwards' witness values while staying
-- parameterized by era.
class IsAlonzoEraOnwards era where
Copy link
Contributor

Choose a reason for hiding this comment

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

same remark as for IsAllegraEraOnwards


-- | Type class to produce 'BabbageEraOnwards' witness values while staying
-- parameterized by era.
class IsBabbageEraOnwards era where
Copy link
Contributor

Choose a reason for hiding this comment

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

same remark as for IsAllegraEraOnwards


-- | Type class to produce 'MaryEraOnwards' witness values while staying
-- parameterized by era.
class IsMaryEraOnwards era where
Copy link
Contributor

Choose a reason for hiding this comment

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

same remark as for IsAllegraEraOnwards

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should go to Cardano.Api.Script

@palas palas force-pushed the classy branch 2 times, most recently from 058936a to b6914a5 Compare July 6, 2024 01:00
@palas
Copy link
Contributor

palas commented Jul 6, 2024

FYI: I have rebased your branch because we have done changes to the formatting. I have made a copy of the unrebased branch here: backup/locallycompact/classy

@locallycompact
Copy link
Contributor Author

@carbolymer Could I get a re-review on this?

Copy link
Contributor

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@smelc
Copy link
Contributor

smelc commented Jul 15, 2024

Closing as it was duplicated in #585 (which I can sign, since it's on this repo; instead of a clone).

@smelc smelc closed this Jul 15, 2024
auto-merge was automatically disabled July 15, 2024 15:24

Pull request was closed

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