From 71f0dde77057d06a7ce81d0b4c813624fd9c9cdb Mon Sep 17 00:00:00 2001 From: Sergey Kurgak Date: Mon, 17 Jan 2022 12:04:22 +1100 Subject: [PATCH] Run ./bin/format --- default.nix | 17 ++++--- flake.nix | 46 ++++++++++--------- plutarch.cabal | 122 ++++++++++++++++++++++++------------------------- shell.nix | 17 ++++--- 4 files changed, 105 insertions(+), 97 deletions(-) diff --git a/default.nix b/default.nix index 39bacff61..89308a388 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,10 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).defaultNix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).defaultNix diff --git a/flake.nix b/flake.nix index 110defdd0..80ff7e87b 100644 --- a/flake.nix +++ b/flake.nix @@ -107,7 +107,7 @@ nativeBuildInputs = [ pkgs.cabal-install pkgs.hlint pkgs.haskellPackages.fourmolu pkgs.haskellPackages.cabal-fmt pkgs.nixpkgs-fmt ]; tools = { - haskell-language-server = {}; # Must use haskell.nix, because the compiler version should match + haskell-language-server = { }; # Must use haskell.nix, because the compiler version should match }; additional = ps: [ @@ -118,25 +118,26 @@ }; }; - formatCheckFor = system: - let - pkgs = nixpkgsFor system; - in - pkgs.runCommand "format-check" { - nativeBuildInputs = [ pkgs.haskellPackages.fourmolu ]; - } '' - export LC_CTYPE=C.UTF-8 - export LC_ALL=C.UTF-8 - export LANG=C.UTF-8 - cd ${self} - ./bin/format || (echo " Please run ./bin/format" ; exit 1) - mkdir $out - '' - ; + formatCheckFor = system: + let + pkgs = nixpkgsFor system; + in + pkgs.runCommand "format-check" + { + nativeBuildInputs = [ pkgs.haskellPackages.fourmolu ]; + } '' + export LC_CTYPE=C.UTF-8 + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + cd ${self} + ./bin/format || (echo " Please run ./bin/format" ; exit 1) + mkdir $out + '' + ; in { project = perSystem projectFor; - flake = perSystem (system: (projectFor system).flake {}); + flake = perSystem (system: (projectFor system).flake { }); # this could be done automatically, but would reduce readability packages = perSystem (system: self.flake.${system}.packages); @@ -148,14 +149,15 @@ } ); check = perSystem (system: - (nixpkgsFor system).runCommand "combined-test" { - nativeBuildInputs = builtins.attrValues self.checks.${system}; - } "touch $out" + (nixpkgsFor system).runCommand "combined-test" + { + nativeBuildInputs = builtins.attrValues self.checks.${system}; + } "touch $out" ); - apps = perSystem (system: + apps = perSystem (system: self.flake.${system}.apps // { - benchmark = { + benchmark = { type = "app"; program = "${self.flake.${system}.packages."plutarch:bench:perf"}/bin/perf"; }; diff --git a/plutarch.cabal b/plutarch.cabal index 471e69ecf..744524626 100644 --- a/plutarch.cabal +++ b/plutarch.cabal @@ -1,39 +1,32 @@ cabal-version: 2.4 name: plutarch version: 1.0.0 - -author: Las Safin -license: MIT - +author: Las Safin +license: MIT extra-source-files: README.md flag development description: Enable tracing functions within plutarch. - manual: True - default: False + manual: True + default: False common c - default-language: Haskell2010 + default-language: Haskell2010 default-extensions: - DataKinds - DeriveAnyClass - DerivingStrategies - LambdaCase - TypeFamilies - OverloadedStrings - PartialTypeSignatures - ViewPatterns - -- poor man's GHC2021 + NoStarIsType BangPatterns BinaryLiterals ConstrainedClassMethods ConstraintKinds + DataKinds + DeriveAnyClass DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable + DerivingStrategies DerivingVia DoAndIfThenElse EmptyCase @@ -50,11 +43,14 @@ common c ImplicitPrelude InstanceSigs KindSignatures + LambdaCase MonomorphismRestriction MultiParamTypeClasses NamedFieldPuns NamedWildCards NumericUnderscores + OverloadedStrings + PartialTypeSignatures PatternGuards PolyKinds PostfixOperators @@ -63,88 +59,93 @@ common c ScopedTypeVariables StandaloneDeriving StandaloneKindSignatures - NoStarIsType TraditionalRecordSyntax TupleSections TypeApplications + TypeFamilies TypeOperators TypeSynonymInstances + ViewPatterns + + -- poor man's GHC2021 ghc-options: - -Wall -Wcompat -Wincomplete-uni-patterns -Wno-partial-type-signatures - -Wmissing-export-lists -Werror -Wincomplete-record-updates - -Wmissing-deriving-strategies -Wno-name-shadowing -Wunused-foralls - -fprint-explicit-foralls -fprint-explicit-kinds + -Wall -Wcompat -Wincomplete-uni-patterns + -Wno-partial-type-signatures -Wmissing-export-lists -Werror + -Wincomplete-record-updates -Wmissing-deriving-strategies + -Wno-name-shadowing -Wunused-foralls -fprint-explicit-foralls + -fprint-explicit-kinds library - import: c + import: c exposed-modules: + Plutarch + Plutarch.Bool + Plutarch.Builtin + Plutarch.ByteString + Plutarch.Crypto + Plutarch.DataRepr + Plutarch.Either Plutarch.Evaluate + Plutarch.Integer Plutarch.Internal - Plutarch - Plutarch.Prelude + Plutarch.Lift + Plutarch.List + Plutarch.Maybe Plutarch.Pair + Plutarch.Prelude Plutarch.Rational Plutarch.Rec Plutarch.Rec.TH - Plutarch.Either - Plutarch.Integer - Plutarch.Bool - Plutarch.String - Plutarch.ByteString - Plutarch.Builtin - Plutarch.DataRepr Plutarch.ScriptContext - Plutarch.Maybe - Plutarch.List - Plutarch.Unit - Plutarch.Crypto - Plutarch.Lift + Plutarch.String Plutarch.Trace + Plutarch.Unit + build-depends: , base - , plutus-core - , plutus-ledger-api - , text - , hashable , bytestring , containers , cryptonite - , plutus-tx - , mtl , flat + , hashable + , mtl + , plutus-core + , plutus-ledger-api + , plutus-tx , rank2classes , template-haskell + , text , transformers if flag(development) cpp-options: -DDevelopment test-suite examples - import: c - type: exitcode-stdio-1.0 - main-is: Main.hs + import: c + type: exitcode-stdio-1.0 + main-is: Main.hs hs-source-dirs: examples other-modules: - Examples.Tracing - Examples.PlutusType - Examples.List Examples.LetRec - Utils + Examples.List + Examples.PlutusType Examples.Recursion + Examples.Tracing + Utils + build-depends: + , aeson , base , bytestring - , text , plutarch - , rank2classes >= 1.4.4 - , tasty - , tasty-hunit - , text - , plutus-ledger-api , plutus-core - , aeson + , plutus-ledger-api , plutus-tx + , rank2classes >=1.4.4 , shrinker + , tasty + , tasty-hunit + , text if flag(development) cpp-options: -DDevelopment @@ -154,19 +155,18 @@ benchmark perf type: exitcode-stdio-1.0 hs-source-dirs: bench main-is: Main.hs - other-modules: Benchmark + other-modules: Benchmark build-depends: , base , boxes , bytestring , cassava + , data-default + , flat , foldl , mtl , plutarch - , serialise , plutus-core , plutus-ledger-api + , serialise , text - , flat - , data-default - diff --git a/shell.nix b/shell.nix index 77db547fb..47458ad8c 100644 --- a/shell.nix +++ b/shell.nix @@ -1,7 +1,10 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).shellNix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).shellNix