Skip to content

Commit

Permalink
fourmolu 0.5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
L-as committed Jan 17, 2022
1 parent 50e59bc commit cbeafe1
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Plutarch/Builtin.hs
Expand Up @@ -157,7 +157,7 @@ data PAsDataLifted (a :: PType)
instance PUnsafeLiftDecl (PAsDataLifted a) (PAsData a) where
type PLifted (PAsData a) = PAsDataLifted a
type PLiftedRepr (PAsData a) = Data
pliftToRepr = \case
pliftToRepr = \case {}
pliftFromRepr _ = Nothing

pforgetData :: Term s (PAsData a) -> Term s PData
Expand Down
2 changes: 1 addition & 1 deletion Plutarch/Crypto.hs
Expand Up @@ -7,7 +7,7 @@ module Plutarch.Crypto (

import Plutarch (punsafeBuiltin)

--import Plutarch.Api.V1 (PDatumHash, PPubKey (..), PPubKeyHash (..), PSignature (..))
-- import Plutarch.Api.V1 (PDatumHash, PPubKey (..), PPubKeyHash (..), PSignature (..))
import Plutarch.Bool (PBool)
import Plutarch.ByteString (PByteString)
import Plutarch.Prelude
Expand Down
4 changes: 2 additions & 2 deletions Plutarch/Internal.hs
Expand Up @@ -151,7 +151,7 @@ plam' f = Term $ \i ->
t@(getTerm -> RLamAbs n (RApply t'@(getArity -> Just n') args))
| (maybe False (== [0 .. n + 1]) $ traverse (\case RVar n -> Just n; _ -> Nothing) args)
&& n' >= n + 1 ->
t {getTerm = t'}
t {getTerm = t'}
-- increment arity
t@(getTerm -> RLamAbs n t') -> t {getTerm = RLamAbs (n + 1) t'}
-- new lambda
Expand Down Expand Up @@ -318,7 +318,7 @@ rawTermToUPLC m l (RForce t) = UPLC.Force () (rawTermToUPLC m l t)
rawTermToUPLC _ _ (RBuiltin f) = UPLC.Builtin () f
rawTermToUPLC _ _ (RConstant c) = UPLC.Constant () c
rawTermToUPLC _ _ RError = UPLC.Error ()
--rawTermToUPLC m l (RHoisted hoisted) = UPLC.Var () . DeBruijn . Index $ l - m hoisted
-- rawTermToUPLC m l (RHoisted hoisted) = UPLC.Var () . DeBruijn . Index $ l - m hoisted
rawTermToUPLC m l (RHoisted hoisted) = m hoisted l -- UPLC.Var () . DeBruijn . Index $ l - m hoisted

-- The logic is mostly for hoisting
Expand Down
2 changes: 1 addition & 1 deletion Plutarch/Rational.hs
Expand Up @@ -232,7 +232,7 @@ pround = phoistAcyclic $
(pif (rem #< pdiv # b # 2) 0 1)
)

--(pdiv # b # 2 + pmod # b # 2 #<= pmod # a # b) 1 0
-- (pdiv # b # 2 + pmod # b # 2 #<= pmod # a # b) 1 0

ptruncate :: Term s (PRational :--> PInteger)
ptruncate = phoistAcyclic $
Expand Down
12 changes: 6 additions & 6 deletions bench/Benchmark.hs
Expand Up @@ -66,12 +66,12 @@ benchmarkScript' =
Right exbudget -> exbudget

data Benchmark = Benchmark
{ -- | CPU budget used by the script
exBudgetCPU :: ExCPU
, -- | Memory budget used by the script
exBudgetMemory :: ExMemory
, -- | Size of Plutus script in bytes
scriptSizeBytes :: ScriptSizeBytes
{ exBudgetCPU :: ExCPU
-- ^ CPU budget used by the script
, exBudgetMemory :: ExMemory
-- ^ Memory budget used by the script
, scriptSizeBytes :: ScriptSizeBytes
-- ^ Size of Plutus script in bytes
}
deriving stock (Show, Generic)

Expand Down
2 changes: 1 addition & 1 deletion bin/format
Expand Up @@ -2,4 +2,4 @@

set -xe

find -type f -name '*.hs' ! -path '*/dist-newstyle/*' | xargs fourmolu -o-XTypeApplications -m inplace
find -type f -name '*.hs' ! -path '*/dist-newstyle/*' | xargs fourmolu -o-XTypeApplications -o-XQualifiedDo -m inplace
12 changes: 6 additions & 6 deletions examples/Examples/Api.hs
Expand Up @@ -127,8 +127,8 @@ getValidator =
-}

---- | Get first CurrencySymbol from Value
--getSym :: Term s (PValue :--> PAsData PCurrencySymbol)
--getSym =
-- getSym :: Term s (PValue :--> PAsData PCurrencySymbol)
-- getSym =
-- plam $ \v -> pfstBuiltin #$ phead #$ v

tests :: HasTester => TestTree
Expand All @@ -138,14 +138,14 @@ tests =
[ testCase "ScriptContext" $ do
ctx `equal'` ctx_compiled
-- FIXME
--, testCase "getting txInfo" $ do
-- , testCase "getting txInfo" $ do
-- plift (getTxInfo # ctx) @?= info
--, testCase "getting mint" $ do
-- , testCase "getting mint" $ do
-- plift (getMint #$ pfromData $ getTxInfo # ctx) @?= mint
--, testCase "getting validator" $ do
-- , testCase "getting validator" $ do
-- plift (getValidator #$ pfromData $ getInputs #$ pfromData $ getTxInfo # ctx)
-- @?= validator
--, testCase "getting sym" $ do
-- , testCase "getting sym" $ do
-- plift (getSym #$ pfromData $ getMint #$ pfromData $ getTxInfo # ctx)
-- @?= sym
]
Expand Down
7 changes: 3 additions & 4 deletions examples/Examples/List.hs
Expand Up @@ -68,9 +68,8 @@ tests = do
(pfoldl' (-) # 0 # integerList [])
#== pconstant 0
, testCase "pmatch" $ do
let
t = P.do
_ <- integerList [1, 3, 1]
perror
let t = P.do
_ <- integerList [1, 3, 1]
perror
in printTerm t @?= ""
]
2 changes: 1 addition & 1 deletion examples/Examples/Rationals.hs
Expand Up @@ -11,7 +11,7 @@ import Plutarch.Builtin
import Plutarch.Pair
import Plutarch.Rational

--import Data.Ratio ((%))
-- import Data.Ratio ((%))

tests :: HasTester => TestTree
tests = do
Expand Down
4 changes: 2 additions & 2 deletions examples/Main.hs
Expand Up @@ -72,8 +72,8 @@ uglyDouble = plam $ \n -> plet n $ \n1 -> plet n1 $ \n2 -> n2 + n2
-- loopHoisted :: Term (PInteger :--> PInteger)
-- loopHoisted = phoistAcyclic $ plam $ \x -> loop # x

--_shrinkTests :: TestTree
--_shrinkTests = testGroup "shrink tests" [let ?tester = shrinkTester in tests]
-- _shrinkTests :: TestTree
-- _shrinkTests = testGroup "shrink tests" [let ?tester = shrinkTester in tests]

standardTests :: TestTree
standardTests = testGroup "standard tests" [let ?tester = standardTester in tests]
Expand Down
2 changes: 1 addition & 1 deletion examples/Utils.hs
Expand Up @@ -13,7 +13,7 @@ import qualified Plutus.V1.Ledger.Scripts as Scripts
import PlutusCore.Evaluation.Machine.ExBudget (ExBudget (ExBudget))
import qualified PlutusCore.Evaluation.Machine.ExMemory as ExMemory

--import Shrink (shrinkScript)
-- import Shrink (shrinkScript)
import Test.Tasty.HUnit

newtype EvalImpl = EvalImpl {runEvalImpl :: forall (a :: PType). HasCallStack => ClosedTerm a -> IO Scripts.Script}
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

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

4 changes: 3 additions & 1 deletion flake.nix
Expand Up @@ -182,14 +182,16 @@

# We use the ones from Nixpkgs, since they are cached reliably.
# Eventually we will probably want to build these with haskell.nix.
nativeBuildInputs = [ pkgs'.cabal-install pkgs'.hlint pkgs'.haskellPackages.fourmolu ];
nativeBuildInputs = [ pkgs'.cabal-install pkgs'.hlint ];

# FIXME: add HLS back
# Use https://github.com/haskell/haskell-language-server/pull/2503 ?
# tools = {
# haskell-language-server = {}; # Must use haskell.nix, because the compiler version should match
# };

tools.fourmolu = {};

additional = ps: [
ps.plutus-ledger-api
#ps.shrinker
Expand Down

0 comments on commit cbeafe1

Please sign in to comment.