From fe39eea72647759b6b5df293d466109592a2ea1b Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Wed, 24 Aug 2022 17:08:19 +0200 Subject: [PATCH] add kind signatures to all agora decls --- agora/Agora/AuthorityToken.hs | 12 ++++++------ agora/Agora/Credential.hs | 2 +- agora/Agora/Governor.hs | 4 ++-- agora/Agora/Governor/Scripts.hs | 6 ++++-- agora/Agora/Proposal.hs | 6 +++++- agora/Agora/Proposal/Time.hs | 3 ++- agora/Agora/Stake.hs | 18 ++++++++++-------- 7 files changed, 30 insertions(+), 21 deletions(-) diff --git a/agora/Agora/AuthorityToken.hs b/agora/Agora/AuthorityToken.hs index 8771027..caa0428 100644 --- a/agora/Agora/AuthorityToken.hs +++ b/agora/Agora/AuthorityToken.hs @@ -21,13 +21,13 @@ import Plutarch.Api.V1.Value (PValue (PValue)) import Plutarch.Api.V2 ( AmountGuarantees, KeyGuarantees, - PAddress (..), + PAddress (PAddress), PMintingPolicy, - PScriptContext (..), - PScriptPurpose (..), + PScriptContext (PScriptContext), + PScriptPurpose (PMinting), PTxInInfo (PTxInInfo), - PTxInfo (..), - PTxOut (..), + PTxInfo (PTxInfo), + PTxOut (PTxOut), ) import Plutarch.Extra.AssetClass (passetClass, passetClassValueOf) import Plutarch.Extra.List (plookup) @@ -74,7 +74,7 @@ newtype AuthorityToken = AuthorityToken @since 0.1.0 -} -authorityTokensValidIn :: Term s (PCurrencySymbol :--> PTxOut :--> PBool) +authorityTokensValidIn :: forall (s :: S). Term s (PCurrencySymbol :--> PTxOut :--> PBool) authorityTokensValidIn = phoistAcyclic $ plam $ \authorityTokenSym txOut'' -> unTermCont $ do PTxOut txOut' <- pmatchC txOut'' diff --git a/agora/Agora/Credential.hs b/agora/Agora/Credential.hs index b42d91b..d4743df 100644 --- a/agora/Agora/Credential.hs +++ b/agora/Agora/Credential.hs @@ -46,7 +46,7 @@ instance DerivePlutusType PAuthorizationContext where @since 1.0.0 -} authorizationContext :: - forall (s :: S) r. + forall (s :: S) (r :: Type). ( HasField "inputs" r (Term s (PBuiltinList PTxInInfo)) , HasField "signatories" r (Term s (PBuiltinList (PAsData PPubKeyHash))) ) => diff --git a/agora/Agora/Governor.hs b/agora/Agora/Governor.hs index f687054..81540af 100644 --- a/agora/Agora/Governor.hs +++ b/agora/Agora/Governor.hs @@ -232,7 +232,7 @@ deriving via (DerivePConstantViaEnum GovernorRedeemer PGovernorRedeemer) instanc @since 0.1.0 -} -pgetNextProposalId :: Term s (PProposalId :--> PProposalId) +pgetNextProposalId :: forall (s :: S). Term s (PProposalId :--> PProposalId) pgetNextProposalId = phoistAcyclic $ plam $ \(pto -> pid) -> pcon $ PProposalId $ pid + 1 {- | Get next proposal id. @@ -248,7 +248,7 @@ getNextProposalId (ProposalId pid) = ProposalId $ pid + 1 @since 0.1.0 -} -pisGovernorDatumValid :: Term s (PGovernorDatum :--> PBool) +pisGovernorDatumValid :: forall (s :: S). Term s (PGovernorDatum :--> PBool) pisGovernorDatumValid = phoistAcyclic $ plam $ \datum -> unTermCont $ do datumF <- diff --git a/agora/Agora/Governor/Scripts.hs b/agora/Agora/Governor/Scripts.hs index 07c212a..98991c2 100644 --- a/agora/Agora/Governor/Scripts.hs +++ b/agora/Agora/Governor/Scripts.hs @@ -503,7 +503,9 @@ governorValidator as = -- For a given output, check if it contains a single valid GAT -- and whether it correctly belongs to the group. - let validateGATOutput' :: Term s (PProposalEffectGroup :--> PTxOut :--> PBool) + let validateGATOutput' :: + forall (s :: S). + Term s (PProposalEffectGroup :--> PTxOut :--> PBool) validateGATOutput' = phoistAcyclic $ plam @@ -569,7 +571,7 @@ governorValidator as = Nothing -> ptraceError "Unknown redeemer" where -- The currency symbol of authority token. - atSymbol :: Term s PCurrencySymbol + atSymbol :: forall (s :: S). Term s PCurrencySymbol atSymbol = pconstant $ authorityTokenSymbol as -- The currency symbol of the proposal state token. diff --git a/agora/Agora/Proposal.hs b/agora/Agora/Proposal.hs index 97d0db9..db96b27 100644 --- a/agora/Agora/Proposal.hs +++ b/agora/Agora/Proposal.hs @@ -746,6 +746,7 @@ pisVotesEmpty = phoistAcyclic $ @since 0.1.0 -} pwinner :: + forall (s :: S). Term s ( PProposalVotes @@ -766,6 +767,7 @@ pwinner = phoistAcyclic $ @since 0.1.0 -} pwinner' :: + forall (s :: S). Term s ( PProposalVotes @@ -813,6 +815,7 @@ pwinner' = phoistAcyclic $ @since 0.1.0 -} phighestVotes :: + forall (s :: S). Term s ( PProposalVotes @@ -835,6 +838,7 @@ phighestVotes = phoistAcyclic $ @since 0.1.0 -} pneutralOption :: + forall (s :: S). Term s ( PMap 'Unsorted PResultTag PProposalEffectGroup @@ -883,7 +887,7 @@ pisProposalThresholdsValid = phoistAcyclic $ @since 0.1.0 -} -pretractVotes :: Term s (PResultTag :--> PInteger :--> PProposalVotes :--> PProposalVotes) +pretractVotes :: forall (s :: S). Term s (PResultTag :--> PInteger :--> PProposalVotes :--> PProposalVotes) pretractVotes = phoistAcyclic $ plam $ \rt count votes -> let voteMap :: Term _ (PMap 'Unsorted PResultTag PInteger) diff --git a/agora/Agora/Proposal/Time.hs b/agora/Agora/Proposal/Time.hs index 8177931..eda80ed 100644 --- a/agora/Agora/Proposal/Time.hs +++ b/agora/Agora/Proposal/Time.hs @@ -294,7 +294,7 @@ deriving via @since 0.2.0 -} -pisProposalTimingConfigValid :: Term s (PProposalTimingConfig :--> PBool) +pisProposalTimingConfigValid :: forall (s :: S). Term s (PProposalTimingConfig :--> PBool) pisProposalTimingConfigValid = phoistAcyclic $ plam $ \conf -> unTermCont $ do confF <- pletAllC conf @@ -397,6 +397,7 @@ currentProposalTime = phoistAcyclic $ @since 0.1.0 -} proposalTimeWithin :: + forall (s :: S). Term s ( PPOSIXTime diff --git a/agora/Agora/Stake.hs b/agora/Agora/Stake.hs index 07bfe2a..cb600ff 100644 --- a/agora/Agora/Stake.hs +++ b/agora/Agora/Stake.hs @@ -366,7 +366,9 @@ pstakeLocked = phoistAcyclic $ @since 0.2.0 -} -pnumCreatedProposals :: Term s (PBuiltinList (PAsData PProposalLock) :--> PInteger) +pnumCreatedProposals :: + forall (s :: S). + Term s (PBuiltinList (PAsData PProposalLock) :--> PInteger) pnumCreatedProposals = phoistAcyclic $ plam $ \l -> @@ -414,7 +416,7 @@ instance DerivePlutusType PStakeRole where @since 0.2.0 -} -pisVoter :: Term s (PStakeRole :--> PBool) +pisVoter :: forall (s :: S). Term s (PStakeRole :--> PBool) pisVoter = phoistAcyclic $ plam $ \sr -> pmatch sr $ \case PVoter _ -> pconstant True @@ -425,7 +427,7 @@ pisVoter = phoistAcyclic $ @since 0.2.0 -} -pisCreator :: Term s (PStakeRole :--> PBool) +pisCreator :: forall (s :: S). Term s (PStakeRole :--> PBool) pisCreator = phoistAcyclic $ plam $ \sr -> pmatch sr $ \case PCreator -> pconstant True @@ -437,7 +439,7 @@ pisCreator = phoistAcyclic $ @since 0.2.0 -} -pisPureCreator :: Term s (PStakeRole :--> PBool) +pisPureCreator :: forall (s :: S). Term s (PStakeRole :--> PBool) pisPureCreator = phoistAcyclic $ plam $ \sr -> pmatch sr $ \case PCreator -> pconstant True @@ -447,7 +449,7 @@ pisPureCreator = phoistAcyclic $ @since 0.2.0 -} -pisIrrelevant :: Term s (PStakeRole :--> PBool) +pisIrrelevant :: forall (s :: S). Term s (PStakeRole :--> PBool) pisIrrelevant = phoistAcyclic $ plam $ \sr -> pmatch sr $ \case PIrrelevant -> pconstant True @@ -461,7 +463,7 @@ pisIrrelevant = phoistAcyclic $ @since 0.2.0 -} -pgetStakeRole :: Term s (PProposalId :--> PBuiltinList (PAsData PProposalLock) :--> PStakeRole) +pgetStakeRole :: forall (s :: S). Term s (PProposalId :--> PBuiltinList (PAsData PProposalLock) :--> PStakeRole) pgetStakeRole = phoistAcyclic $ plam $ \pid locks -> pfoldl @@ -483,7 +485,7 @@ pgetStakeRole = phoistAcyclic $ # pcon PIrrelevant # locks where - pcombineStakeRole :: Term s (PStakeRole :--> PStakeRole :--> PStakeRole) + pcombineStakeRole :: forall (s :: S). Term s (PStakeRole :--> PStakeRole :--> PStakeRole) pcombineStakeRole = phoistAcyclic $ plam $ \x y -> let cannotCombine = ptraceError "duplicate roles" @@ -503,7 +505,7 @@ pgetStakeRole = phoistAcyclic $ @since 0.2.0 -} -pextractVoteOption :: Term s (PStakeRole :--> PResultTag) +pextractVoteOption :: forall (s :: S). Term s (PStakeRole :--> PResultTag) pextractVoteOption = phoistAcyclic $ plam $ \sr -> pmatch sr $ \case PVoter r -> r