From 107db1303dc8cb2cec7f093095846dde68f57daa Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Mon, 28 Mar 2022 14:59:53 +0200 Subject: [PATCH] fix docs, hlint errors --- agora-test/Spec.hs | 2 +- agora-test/Spec/Model/MultiSig.hs | 4 ++-- agora-test/Spec/Stake.hs | 2 +- agora/Agora/Effect.hs | 2 +- agora/Agora/Governor.hs | 5 +++-- agora/Agora/MultiSig.hs | 4 ++-- agora/Agora/Proposal.hs | 9 +++++++-- agora/Agora/SafeMoney.hs | 5 +++-- agora/Agora/Utils.hs | 8 ++++---- 9 files changed, 24 insertions(+), 17 deletions(-) diff --git a/agora-test/Spec.hs b/agora-test/Spec.hs index 502cb27..6442ae8 100644 --- a/agora-test/Spec.hs +++ b/agora-test/Spec.hs @@ -11,7 +11,7 @@ import Test.Tasty (defaultMain, testGroup) import Spec.Model.MultiSig qualified as MultiSig import Spec.Stake qualified as Stake --- | The Agora test suite +-- | The Agora test suite. main :: IO () main = defaultMain $ diff --git a/agora-test/Spec/Model/MultiSig.hs b/agora-test/Spec/Model/MultiSig.hs index 15dcfae..47dfda0 100644 --- a/agora-test/Spec/Model/MultiSig.hs +++ b/agora-test/Spec/Model/MultiSig.hs @@ -171,7 +171,7 @@ instance HasScriptRunner MultiSigProp MultiSigModel where (pcon PUnit) perror --- | Consistency tests for the 'HasParameterisedGenerator' instance of 'MultiSigModel' +-- | Consistency tests for the 'HasParameterisedGenerator' instance of 'MultiSigModel'. genTests :: TestTree genTests = testGroup "genTests" $ @@ -182,7 +182,7 @@ genTests = Yes ] --- | Tests for the 'HasScriptRunner' instance of 'MultiSigModel' +-- | Tests for the 'HasScriptRunner' instance of 'MultiSigModel'. plutarchTests :: TestTree plutarchTests = testGroup "plutarchTests" $ diff --git a/agora-test/Spec/Stake.hs b/agora-test/Spec/Stake.hs index 5ce5d79..ccd16e7 100644 --- a/agora-test/Spec/Stake.hs +++ b/agora-test/Spec/Stake.hs @@ -29,7 +29,7 @@ import Spec.Util (policyFailsWith, policySucceedsWith, toDatum, validatorFailsWi -------------------------------------------------------------------------------- --- | Stake tests +-- | Stake tests. tests :: [TestTree] tests = [ testGroup diff --git a/agora/Agora/Effect.hs b/agora/Agora/Effect.hs index fccb32e..82764d2 100644 --- a/agora/Agora/Effect.hs +++ b/agora/Agora/Effect.hs @@ -13,7 +13,7 @@ import Plutarch.Monadic qualified as P -------------------------------------------------------------------------------- --- | Helper 'template' for creating effect validator. +-- | Helper "template" for creating effect validator. makeEffect :: forall (datum :: PType) (s :: S). PIsData datum => diff --git a/agora/Agora/Governor.hs b/agora/Agora/Governor.hs index f44eda1..55b480e 100644 --- a/agora/Agora/Governor.hs +++ b/agora/Agora/Governor.hs @@ -9,9 +9,10 @@ module Agora.Governor (GovernorDatum (..), GovernorRedeemer (..)) where import Agora.Proposal (ProposalThresholds) -data GovernorDatum = GovernorDatum +-- | Datum for the Governor script. +newtype GovernorDatum = GovernorDatum { proposalThresholds :: ProposalThresholds - -- ^ Gets copied over upon creation of a 'Proposal'. + -- ^ Gets copied over upon creation of a 'Agora.Proposal.ProposalDatum'. } {- | Redeemer for Governor script. diff --git a/agora/Agora/MultiSig.hs b/agora/Agora/MultiSig.hs index 6e8270d..93cf3e6 100644 --- a/agora/Agora/MultiSig.hs +++ b/agora/Agora/MultiSig.hs @@ -77,13 +77,13 @@ deriving via (DerivePConstantViaData MultiSig PMultiSig) instance (PConstant Mul -------------------------------------------------------------------------------- --- | Check if a Haskell-level MultiSig signs this transaction +-- | Check if a Haskell-level MultiSig signs this transaction. validatedByMultisig :: MultiSig -> Term s (PTxInfo :--> PBool) validatedByMultisig params = phoistAcyclic $ pvalidatedByMultisig # pconstant params --- | Check if a Plutarch-level MultiSig signs this transaction +-- | Check if a Plutarch-level MultiSig signs this transaction. pvalidatedByMultisig :: Term s (PMultiSig :--> PTxInfo :--> PBool) pvalidatedByMultisig = phoistAcyclic $ diff --git a/agora/Agora/Proposal.hs b/agora/Agora/Proposal.hs index 596a169..0584b99 100644 --- a/agora/Agora/Proposal.hs +++ b/agora/Agora/Proposal.hs @@ -9,6 +9,7 @@ Proposal scripts encoding effects that operate on the system. -} module Agora.Proposal ( -- * Haskell-land + Proposal (..), ProposalDatum (..), ProposalStatus (..), ProposalThresholds (..), @@ -50,6 +51,7 @@ import Agora.SafeMoney (Discrete, GTTag, PDiscrete) @ -} newtype ResultTag = ResultTag {getResultTag :: Integer} + deriving stock (Eq, Show) deriving newtype (PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData) {- | The "status" of the proposal. This is only useful for state transitions, @@ -102,7 +104,7 @@ data ProposalThresholds = ProposalThresholds PlutusTx.makeIsDataIndexed ''ProposalThresholds [('ProposalThresholds, 0)] {- | Map which encodes the total tally for each result. - It's important that the 'shape' is consistent with the shape of 'effects'. + It's important that the "shape" is consistent with the shape of 'effects'. e.g. if the 'effects' field looks like the following: @@ -136,6 +138,9 @@ data ProposalDatum = ProposalDatum PlutusTx.makeIsDataIndexed ''ProposalDatum [('ProposalDatum, 0)] +-- | Parameters that identify the Proposal validator script. +data Proposal = Proposal + -------------------------------------------------------------------------------- -- Plutarch-land @@ -158,7 +163,7 @@ data PProposalStatus (s :: S) via PIsDataReprInstances PProposalStatus -- | Plutarch-level version of 'ProposalThresholds'. -data PProposalThresholds (s :: S) = PProposalThresholds +newtype PProposalThresholds (s :: S) = PProposalThresholds { getProposalThresholds :: Term s diff --git a/agora/Agora/SafeMoney.hs b/agora/Agora/SafeMoney.hs index 0862cef..d8c3da0 100644 --- a/agora/Agora/SafeMoney.hs +++ b/agora/Agora/SafeMoney.hs @@ -50,10 +50,10 @@ import Agora.Utils ( -------------------------------------------------------------------------------- -- Example tags --- | Governance token +-- | Governance token. data GTTag --- | ADA +-- | ADA. data ADATag -------------------------------------------------------------------------------- @@ -136,6 +136,7 @@ pdiscreteValue (AssetClassRef (AssetClass (cs, tn))) = phoistAcyclic $ # pconstant tn # p +-- | Get a `Value` from a `Discrete`. discreteValue :: forall (tag :: Type). AssetClassRef tag -> diff --git a/agora/Agora/Utils.hs b/agora/Agora/Utils.hs index 9c5224a..2f875b0 100644 --- a/agora/Agora/Utils.hs +++ b/agora/Agora/Utils.hs @@ -183,21 +183,21 @@ passetClassValueOf' :: AssetClass -> Term s (PValue :--> PInteger) passetClassValueOf' (AssetClass (sym, token)) = passetClassValueOf # pconstant sym # pconstant token --- | Return '>=' on two values comparing by only a particular AssetClass +-- | Return '>=' on two values comparing by only a particular AssetClass. pgeqByClass :: Term s (PCurrencySymbol :--> PTokenName :--> PValue :--> PValue :--> PBool) pgeqByClass = phoistAcyclic $ plam $ \cs tn a b -> passetClassValueOf # cs # tn # b #<= passetClassValueOf # cs # tn # a --- | Return '>=' on two values comparing by only a particular CurrencySymbol +-- | Return '>=' on two values comparing by only a particular CurrencySymbol. pgeqBySymbol :: Term s (PCurrencySymbol :--> PValue :--> PValue :--> PBool) pgeqBySymbol = phoistAcyclic $ plam $ \cs a b -> psymbolValueOf # cs # b #<= psymbolValueOf # cs # a --- | Return '>=' on two values comparing by only a particular Haskell-level AssetClass +-- | Return '>=' on two values comparing by only a particular Haskell-level AssetClass. pgeqByClass' :: AssetClass -> Term s (PValue :--> PValue :--> PBool) pgeqByClass' ac = phoistAcyclic $ @@ -233,7 +233,7 @@ pmapUnionWith = phoistAcyclic $ # ys pcon (PMap $ pconcat # ls # rs) --- | Add two 'PValue's together +-- | Add two 'PValue's together. paddValue :: forall s. Term s (PValue :--> PValue :--> PValue) paddValue = phoistAcyclic $ plam $ \a' b' -> P.do