-
Notifications
You must be signed in to change notification settings - Fork 23
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 module for UTxO type and operations #710
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @Jimbo4350 thoughts?
0ce0fcf
to
a2dbc0a
Compare
a07f563
to
1e931e1
Compare
1e931e1
to
1235545
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @Jimbo4350 thoughts?
cardano-api/cardano-api.cabal
Outdated
@@ -248,6 +250,7 @@ library | |||
Cardano.Api.Ledger | |||
Cardano.Api.Network | |||
Cardano.Api.Shelley | |||
Cardano.Api.UTxO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this module hidden and expose the functionality from Cardano.Api.
We need to do an audit on how we expose things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This module by design is intended to be imported qualified, similar to container modules such as Data.Map
, as it contains function names which commonly conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This PR will remain unmerged until this change is made. The decision as to how we expose our modules is not yours to make.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Didn't mean to sound presumptuous, I assumed we were misunderstanding each other. If I do understand you correctly, do you mean to expose functions such as empty
and lookup
directly through Cardano.Api
? What I was trying to do here is provide a qualified import that deals with only this container type, because that is clear to the reader, eg import Cardano.Api.UTxO as UTxO
, and called as UTxO.empty
, UTxO.lookup
. Doing import qualified Cardano.Api as UTxO
is confusing, as it would contain functions that don't concern UTxOs, and import qualified Cardano.Api as Api
would also be confusing, as Api.empty
requires context for the reader when reading at the call site. Can you confirm if this is what you meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree here with @locallycompact . Exposing commonly used function names like empty
or singleton
through Cardano.Api
will be annoying. End users will be forced to qualify Cardano.Api
imports. Moreover, if we decide to provide another similar container utility the same way in cardano-api, then the names will be in use already, and we'll be forced to use different names e.g. emptyTxSet
, lookupTxSet
... which will be inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@locallycompact Fair point.
@carbolymer I'd like to task you with writing an ADR as to how we should expose cardano-api
's functionality. It has been sub optimal for a long time and it would help contributors if we were clearer in this regard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could pick a middle ground here: export just the UTxO
type and its instances through Cardano.Api
, the utility functions should stay in the UTxO
module exported from cardano-api
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carbolymer I think that's the current behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carbolymer I think that's the current behaviour
1235545
to
f6a3ba2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two changes need to be made
f6a3ba2
to
a7f77e2
Compare
f618f5e
to
62330c6
Compare
Can you place the new UTxO module in |
I will rebase after that work. |
e36dbb9
to
764d987
Compare
764d987
to
24478d9
Compare
Changelog
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