some cleanup in dhall file

This commit is contained in:
Daniel Krueger 2021-03-08 00:37:28 +01:00
parent ee2c856221
commit 8f66fdee03
2 changed files with 130 additions and 113 deletions

View File

@ -8,9 +8,24 @@ Reducing Haskell programs for easier debugging of GHC crashes or performance reg
## Installing
1. Clone the repo
1. (Optional) Run `nix-shell`
1. Run `cabal install` or `stack install`
Clone the repo:
```bash
$ https://github.com/dnlkrgr/hsreduce.git
$ cd hsreduce
```
(Optional) Install dependencies via nix:
```bash
nix-shell
```
Build and install the project:
```bash
$ cabal install
```
## Usage

View File

@ -7,6 +7,36 @@ let prelude =
let types =
https://raw.githubusercontent.com/dhall-lang/dhall-to-cabal/1.3.4.0/dhall/types.dhall
let defaultExtensions =
[ types.Extension.DataKinds True
, types.Extension.DeriveGeneric True
, types.Extension.FlexibleContexts True
, types.Extension.FlexibleInstances True
, types.Extension.GeneralizedNewtypeDeriving True
, types.Extension.LambdaCase True
, types.Extension.MultiParamTypeClasses True
, types.Extension.OverloadedStrings True
, types.Extension.PatternSynonyms True
, types.Extension.QuasiQuotes True
, types.Extension.Rank2Types True
, types.Extension.RecordWildCards True
, types.Extension.ScopedTypeVariables True
, types.Extension.TemplateHaskell True
, types.Extension.TupleSections True
, types.Extension.TypeFamilies True
, types.Extension.TypeOperators True
, types.Extension.UndecidableInstances True
, types.Extension.ViewPatterns True
, types.Extension.TypeApplications True
]
let commonStuff =
{ default-extensions = defaultExtensions
, default-language = Some types.Language.Haskell2010
}
let makeBuildDepend = \(name : Text) -> { bounds = prelude.anyVersion, package = name }
let buildDepends =
Prelude.List.map Text types.Dependency makeBuildDepend
@ -49,99 +79,62 @@ let buildDepends =
, "transformers-base"
]
let defaultExtensions =
[ types.Extension.DataKinds True
, types.Extension.DeriveGeneric True
, types.Extension.FlexibleContexts True
, types.Extension.FlexibleInstances True
, types.Extension.GeneralizedNewtypeDeriving True
, types.Extension.LambdaCase True
, types.Extension.MultiParamTypeClasses True
, types.Extension.OverloadedStrings True
, types.Extension.PatternSynonyms True
, types.Extension.QuasiQuotes True
, types.Extension.Rank2Types True
, types.Extension.RecordWildCards True
, types.Extension.ScopedTypeVariables True
, types.Extension.TemplateHaskell True
, types.Extension.TupleSections True
, types.Extension.TypeFamilies True
, types.Extension.TypeOperators True
, types.Extension.UndecidableInstances True
, types.Extension.ViewPatterns True
, types.Extension.TypeApplications True
]
let prependReducePassesPrefix = \(prefix : Text) -> "Reduce.Passes." ++ prefix
let passes =
Prelude.List.map Text Text prependReducePassesPrefix
[ "Expr"
, "Types"
, "Pat"
, "Decls"
, "TypeFamilies"
, "Stubbing"
, "DataTypes"
, "Typeclasses"
, "Names"
, "Functions"
, "Imports"
, "Exports"
, "Pragmas"
, "Parameters"
, "TemplateHaskell"
]
in prelude.defaults.Package
⫽ { name = "hsreduce"
, version = prelude.v "0.1.0.0"
, build-type = Some types.BuildType.Simple
, cabal-version = prelude.v "2.4"
, executables =
[ { executable =
λ(config : types.Config)
→ prelude.defaults.Executable
⫽ { main-is = "Main.hs"
, build-depends =
[{ bounds = prelude.anyVersion
, package = "lib-hsreduce"
}]
# buildDepends
, compiler-options =
prelude.defaults.CompilerOptions
⫽ { GHC =
[ "-Wall"
, "-threaded"
, "-rtsopts"
, "-with-rtsopts=-T"
, "-Wno-missing-methods"
, "-Wno-orphans"
] : List Text
}
, default-extensions = defaultExtensions
, default-language = Some types.Language.Haskell2010
, hs-source-dirs = [ "src" ]
}
, name = "hsreduce"
}
]
, extra-source-files = [ "CHANGELOG.md" ]
, license =
types.License.SPDX
( prelude.SPDX.license
types.LicenseId.BSD_3_Clause
(None types.LicenseExceptionId)
)
, license-files = [ "LICENSE" ]
, sub-libraries =
[ { library =
λ(config : types.Config)
let prependReducePassesPrefix = \(prefix : Text) -> "Reduce.Passes." ++ prefix
let passes =
Prelude.List.map Text Text prependReducePassesPrefix
[ "Expr"
, "Types"
, "Pat"
, "Decls"
, "TypeFamilies"
, "Stubbing"
, "DataTypes"
, "Typeclasses"
, "Names"
, "Functions"
, "Imports"
, "Exports"
, "Pragmas"
, "Parameters"
, "TemplateHaskell"
]
in prelude.defaults.Library
⫽ { build-depends = buildDepends
, compiler-options = prelude.defaults.CompilerOptions ⫽ { GHC = [ "-Wall" ] : List Text }
, default-extensions = defaultExtensions
, default-language = Some types.Language.Haskell2010
in prelude.defaults.Package
// { name = "hsreduce"
, version = prelude.v "0.1.0.0"
, build-type = Some types.BuildType.Simple
, cabal-version = prelude.v "2.4"
, executables =
[ { executable =
\(config : types.Config)
-> prelude.defaults.Executable
// commonStuff
// { main-is = "Main.hs"
, build-depends = buildDepends # [{ bounds = prelude.anyVersion , package = "lib-hsreduce" }]
, compiler-options =
prelude.defaults.CompilerOptions
// { GHC =
[ "-Wall"
, "-threaded"
, "-rtsopts"
, "-with-rtsopts=-T"
, "-Wno-missing-methods"
, "-Wno-orphans"
] : List Text
}
, hs-source-dirs = [ "src" ]
}
, name = "hsreduce"
}
]
, sub-libraries =
[ { library =
\(config : types.Config)
->
prelude.defaults.Library
// commonStuff
// { build-depends = buildDepends
, compiler-options = prelude.defaults.CompilerOptions // { GHC = [ "-Wall" ] : List Text }
, hs-source-dirs = [ "src" ]
, other-modules = [ "Parser.Parser" ]
, exposed-modules =
@ -154,21 +147,30 @@ in prelude.defaults.Package
]
}
, name = "lib-hsreduce"
}
]
, test-suites =
[ { name = "test-hsreduce"
, test-suite =
λ(config : types.Config)
→ prelude.defaults.TestSuite
⫽ { type = types.TestType.exitcode-stdio { main-is = "Test.hs" }
, build-depends = buildDepends # Prelude.List.map Text types.Dependency makeBuildDepend [ "lib-hsreduce", "hspec" ]
, compiler-options = prelude.defaults.CompilerOptions ⫽ { GHC = [ "-Wall" ] : List Text }
, default-extensions = defaultExtensions
, default-language = Some types.Language.Haskell2010
, hs-source-dirs = [ "src", "test" ]
}
}
]
}
, name = "lib-hsreduce"
}
]
, test-suites =
[ { name = "test-hsreduce"
, test-suite =
\(config : types.Config)
-> prelude.defaults.TestSuite
// commonStuff
// { type = types.TestType.exitcode-stdio { main-is = "Test.hs" }
, build-depends =
buildDepends
# Prelude.List.map Text types.Dependency makeBuildDepend [ "lib-hsreduce", "hspec" ]
, compiler-options = prelude.defaults.CompilerOptions // { GHC = [ "-Wall" ] : List Text }
, hs-source-dirs = [ "src", "test" ]
}
}
]
, license =
types.License.SPDX
( prelude.SPDX.license
types.LicenseId.BSD_3_Clause
(None types.LicenseExceptionId)
)
, extra-source-files = [ "CHANGELOG.md" ]
, license-files = [ "LICENSE" ]
}