Skip to content

Commit

Permalink
Run ./bin/format
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesku committed Jan 17, 2022
1 parent 9304920 commit 71f0dde
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 97 deletions.
17 changes: 10 additions & 7 deletions 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
46 changes: 24 additions & 22 deletions flake.nix
Expand Up @@ -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: [
Expand All @@ -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);
Expand All @@ -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";
};
Expand Down
122 changes: 61 additions & 61 deletions plutarch.cabal
@@ -1,39 +1,32 @@
cabal-version: 2.4
name: plutarch
version: 1.0.0

author: Las Safin <me@las.rs>
license: MIT

author: Las Safin <me@las.rs>
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
Expand All @@ -50,11 +43,14 @@ common c
ImplicitPrelude
InstanceSigs
KindSignatures
LambdaCase
MonomorphismRestriction
MultiParamTypeClasses
NamedFieldPuns
NamedWildCards
NumericUnderscores
OverloadedStrings
PartialTypeSignatures
PatternGuards
PolyKinds
PostfixOperators
Expand All @@ -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
Expand All @@ -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

17 changes: 10 additions & 7 deletions 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

0 comments on commit 71f0dde

Please sign in to comment.