-
Notifications
You must be signed in to change notification settings - Fork 23
Consolidate script interface #1217
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
Conversation
| readCertificateScriptWitnesses certs = | ||
| mapM | ||
| ( \(vFile, mCert) -> do | ||
| case mCert of | ||
| Nothing -> return (vFile, AnyKeyWitnessPlaceholder) | ||
| Just cert -> do | ||
| sWit <- readCertificateScriptWitness cert | ||
| return (vFile, sWit) | ||
| ) | ||
| certs |
Check warning
Code scanning / HLint
Eta reduce Warning
Found:
readCertificateScriptWitnesses certs
= mapM
(\\ (vFile, mCert)
-> do case mCert of
Nothing -> return (vFile, AnyKeyWitnessPlaceholder)
Just cert
-> do sWit <- readCertificateScriptWitness cert
return (vFile, sWit))
certs
Perhaps:
readCertificateScriptWitnesses
= mapM
(\\ (vFile, mCert)
-> do case mCert of
Nothing -> return (vFile, AnyKeyWitnessPlaceholder)
Just cert
-> do sWit <- readCertificateScriptWitness cert
return (vFile, sWit))
| [ (,mSwit) | ||
| <$> ( fmap (Exp.convertToNewCertificate Exp.useEra) $ | ||
| fromEitherIOCli @(FileError TextEnvelopeError) $ | ||
| shelleyBasedEraConstraints eon $ | ||
| readFileTextEnvelope (File certFile) | ||
| ) |
Check notice
Code scanning / HLint
Move brackets to avoid $ Note
Found:
(, mSwit)
<$>
(fmap (Exp.convertToNewCertificate Exp.useEra)
$ fromEitherIOCli @(FileError TextEnvelopeError)
$ shelleyBasedEraConstraints eon
$ readFileTextEnvelope (File certFile))
Perhaps:
(, mSwit)
<$>
fmap
(Exp.convertToNewCertificate Exp.useEra)
(fromEitherIOCli @(FileError TextEnvelopeError)
$ shelleyBasedEraConstraints eon
$ readFileTextEnvelope (File certFile))
| [ (,mSwit) | ||
| <$> ( fmap (Exp.convertToNewCertificate Exp.useEra) $ | ||
| shelleyBasedEraConstraints sbe $ | ||
| fromEitherIOCli $ | ||
| readFileTextEnvelope (File certFile) | ||
| ) |
Check notice
Code scanning / HLint
Move brackets to avoid $ Note
Found:
(, mSwit)
<$>
(fmap (Exp.convertToNewCertificate Exp.useEra)
$ shelleyBasedEraConstraints sbe
$ fromEitherIOCli $ readFileTextEnvelope (File certFile))
Perhaps:
(, mSwit)
<$>
fmap
(Exp.convertToNewCertificate Exp.useEra)
(shelleyBasedEraConstraints sbe
$ fromEitherIOCli $ readFileTextEnvelope (File certFile))
| [ (,mSwit) | ||
| <$> ( fmap (Exp.convertToNewCertificate Exp.useEra) $ | ||
| fromEitherIOCli $ | ||
| readFileTextEnvelope (File certFile) | ||
| ) |
Check notice
Code scanning / HLint
Move brackets to avoid $ Note
Found:
(, mSwit)
<$>
(fmap (Exp.convertToNewCertificate Exp.useEra)
$ fromEitherIOCli $ readFileTextEnvelope (File certFile))
Perhaps:
(, mSwit)
<$>
fmap
(Exp.convertToNewCertificate Exp.useEra)
(fromEitherIOCli $ readFileTextEnvelope (File certFile))
6751eb0 to
a08f3ca
Compare
32604f4 to
1e71580
Compare
19ad6a5 to
8da24cc
Compare
8da24cc to
9ccc4c0
Compare
nbacquey
left a comment
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.
Just some stylistic remarks. I'm not familiar enough with the semantics to have a relevant opinion
| SimpleReferenceScript | ||
| :: SimpleRefScriptCliArgs witnessable -> ScriptRequirements witnessable | ||
|
|
||
| deriving instance Show (ScriptRequirements Exp.VoterItem) |
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.
Why not instance Show a => Show (ScriptRequirements a)?
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.
Eventually it will ask for Show (OptionalDatum a) and I will have to provide manual instances for it because you cannot automatically derive instance for type families.
| | InlineDatum | ||
| deriving Show | ||
|
|
||
| deriving instance Show (OnDiskPlutusScriptCliArgs Exp.VoterItem) |
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.
Same here about Show instances
| -> ExecutionUnits | ||
| -> PlutusRefScriptCliArgs witnessable | ||
|
|
||
| deriving instance Show (PlutusRefScriptCliArgs Exp.VoterItem) |
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.
ditto
| data SimpleRefScriptCliArgs witnessable where | ||
| SimpleRefScriptArgs :: TxIn -> MintPolicyId witnessable -> SimpleRefScriptCliArgs witnessable | ||
|
|
||
| deriving instance Show (SimpleRefScriptCliArgs Exp.VoterItem) |
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.
ditto
9ccc4c0 to
8be9beb
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.
Nice simplification! I don't see any issues in the PR (except for the underscore, which seems odd), and types here go a long way. But I would get some more approvals because it is a big PR and my understanding of the changes is limited
This is designed to handle reading simple and plutus scripts from disk
dd34973 to
d6a08be
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