Skip to content

Commit

Permalink
Bump hackage.nix + index-state & Revert to using PyF (#4864)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeme-wana committed Sep 27, 2022
1 parent 1a6de85 commit 607e73a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Bump this if you need newer packages
index-state: 2022-08-31T00:00:00Z
index-state: 2022-09-26T00:00:00Z

packages: doc
plutus-benchmark
Expand Down Expand Up @@ -73,4 +73,4 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/Win32-network
tag: 3825d3abf75f83f406c1f7161883c438dac7277d
tag: 3825d3abf75f83f406c1f7161883c438dac7277d
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions plutus-ledger-api/plutus-ledger-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ library plutus-ledger-api-testlib
PlutusLedgerApi.Test.Scripts

build-depends:
, base >=4.9 && <5
, base >=4.9 && <5
, base64-bytestring
, bytestring
, plutus-core ^>=1.0
, plutus-core ^>=1.0
, plutus-ledger-api
, plutus-tx ^>=1.0
, plutus-tx ^>=1.0
, prettyprinter
, PyF >=0.11.1.0
, serialise
, string-interpolate
, text

test-suite plutus-ledger-api-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import Codec.Serialise (Serialise (..))
import Data.ByteString.Base64 qualified as Base64
import Data.ByteString.Short qualified as BS
import Data.List.NonEmpty (NonEmpty, toList)
import Data.String.Interpolate (__i)
import Data.Text.Encoding qualified as Text
import GHC.Generics (Generic)
import Prettyprinter
import PyF (fmt)


data ScriptEvaluationResult = ScriptEvaluationSuccess | ScriptEvaluationFailure
Expand Down Expand Up @@ -144,15 +144,15 @@ data TestFailure
renderTestFailure :: TestFailure -> String
renderTestFailure = \case
InvalidResult err -> display err
MissingCostParametersFor ver -> [__i|
Missing cost parameters for #{show ver}.
MissingCostParametersFor ver -> [fmt|
Missing cost parameters for {show ver}.
Report this as a bug against the script dumper in plutus-apps.
|]

renderTestFailures :: NonEmpty TestFailure -> String
renderTestFailures xs = [__i|
Number of failed test cases: #{length xs}
#{unlines . fmap renderTestFailure $ toList xs}
renderTestFailures xs = [fmt|
Number of failed test cases: {length xs}
{unlines . fmap renderTestFailure $ toList xs}
|]

-- | Re-evaluate an on-chain script evaluation event.
Expand Down
16 changes: 8 additions & 8 deletions plutus-tx-plugin/app/GeneratePluginOptionsDoc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import PlutusTx.Options qualified as O

import Control.Lens
import Data.Map qualified as Map
import Data.String.Interpolate (__i)
import Data.Text (Text)
import Data.Text qualified as Text
import Data.Text.IO qualified as Text
import Options.Applicative qualified as OA
import Prettyprinter
import PyF (fmt)


newtype Params = Params
Expand All @@ -40,7 +40,7 @@ main = do
Text.writeFile (Text.unpack $ paramOutputFile params) optionsTable

optionsTable :: Text
optionsTable = [__i|
optionsTable = [fmt|
..
This file is generated by running plutus-tx-plugin:gen-plugin-opts-doc.
Do not modify by hand.
Expand All @@ -54,15 +54,15 @@ optionsTable = [__i|
- Default
- Description

#{Text.unlines $ uncurry genRow <$> Map.toList O.pluginOptions}
{Text.unlines $ uncurry genRow <$> Map.toList O.pluginOptions}
|]

genRow :: O.OptionKey -> O.PluginOption -> Text
genRow k (O.PluginOption tr _ field desc) = [__i|
* - ``#{k}``
- #{show tr}
- #{show (pretty defaultValue)}
- #{desc}
genRow k (O.PluginOption tr _ field desc) = [fmt|
* - ``{k}``
- {show tr}
- {show (pretty defaultValue)}
- {desc}
|]
where
defaultValue = O.defaultPluginOptions ^. field
12 changes: 6 additions & 6 deletions plutus-tx-plugin/plutus-tx-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ library

build-depends:
, array
, base >=4.9 && <5
, base >=4.9 && <5
, bytestring
, containers
, either
Expand All @@ -79,10 +79,10 @@ library
, ghc-prim
, lens
, mtl
, plutus-core ^>=1.0
, plutus-tx ^>=1.0
, plutus-core ^>=1.0
, plutus-tx ^>=1.0
, prettyprinter
, string-interpolate
, PyF >=0.11.1.0
, template-haskell
, text
, transformers
Expand All @@ -101,13 +101,13 @@ executable gen-plugin-opts-doc
hs-source-dirs: app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
, base >=4.7 && <5
, base >=4.7 && <5
, containers
, lens
, optparse-applicative
, plutus-tx-plugin
, prettyprinter
, string-interpolate
, PyF >=0.11.1.0
, text

default-language: Haskell2010
Expand Down
16 changes: 8 additions & 8 deletions plutus-tx-plugin/src/PlutusTx/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import Data.List.NonEmpty (NonEmpty)
import Data.Map (Map)
import Data.Map qualified as Map
import Data.Proxy
import Data.String.Interpolate (__i)
import Data.Text (Text)
import Data.Text qualified as Text
import Data.Type.Equality
import GhcPlugins qualified as GHC
import Prettyprinter
import PyF (fmt)

import Text.Read (readMaybe)
import Type.Reflection
Expand Down Expand Up @@ -89,25 +89,25 @@ newtype ParseErrors = ParseErrors (NonEmpty ParseError)
deriving newtype (Semigroup)

instance Show ParseErrors where
show (ParseErrors errs) = [__i|
show (ParseErrors errs) = [fmt|
PlutusTx.Plugin: failed to parse options:
#{Text.intercalate "\n" (fmap renderParseError (toList errs))}
{Text.intercalate "\n" (fmap renderParseError (toList errs))}
|]

instance Exception ParseErrors

renderParseError :: ParseError -> Text
renderParseError = \case
CannotParseValue k v tr ->
[__i|Cannot parse value #{v} for option #{k} into type #{show tr}.|]
[fmt|Cannot parse value {v} for option {k} into type {show tr}.|]
UnexpectedValue k v ->
[__i|Option #{k} is a flag and does not take a value, but was given #{v}.|]
[fmt|Option {k} is a flag and does not take a value, but was given {v}.|]
MissingValue k ->
[__i|Option #{k} needs a value.|]
[fmt|Option {k} needs a value.|]
UnrecognisedOption k suggs ->
[__i|Unrecognised option: #{k}.|] <> case suggs of
[fmt|Unrecognised option: {k}.|] <> case suggs of
[] -> ""
_ -> [__i|\nDid you mean one of:\n#{Text.intercalate "\n" suggs}|]
_ -> [fmt|\nDid you mean one of:\n{Text.intercalate "\n" suggs}|]

{- | Definition of plugin options.
Expand Down

0 comments on commit 607e73a

Please sign in to comment.