├── .hlint.yaml ├── .ghci ├── updo.project ├── project-dhall ├── pkgs │ └── hpack-dhall.dhall ├── pkg-groups.dhall ├── pkgs-upgrade-todo.dhall ├── ghc-9.2.8 │ ├── text-templates │ │ ├── cabal-snippet.dhall │ │ ├── stack-snippet.dhall │ │ ├── dhall2stack.dhall │ │ └── dhall2cabal.dhall │ └── constraints.dhall ├── ghc-9.4.8 │ ├── text-templates │ │ ├── cabal-snippet.dhall │ │ ├── stack-snippet.dhall │ │ ├── dhall2stack.dhall │ │ └── dhall2cabal.dhall │ └── constraints.dhall ├── ghc-9.6.5 │ ├── constraints.dhall │ └── text-templates │ │ ├── cabal-snippet.dhall │ │ ├── stack-snippet.dhall │ │ ├── dhall2stack.dhall │ │ └── dhall2cabal.dhall └── ghc-9.8.2 │ ├── constraints.dhall │ └── text-templates │ ├── cabal-snippet.dhall │ ├── stack-snippet.dhall │ ├── dhall2stack.dhall │ └── dhall2cabal.dhall ├── test-suite-golden ├── test-files │ ├── key │ │ ├── src │ │ │ └── Main.hs │ │ ├── empty-inferred │ │ │ ├── package.json │ │ │ ├── package.dhall │ │ │ ├── package.yaml │ │ │ ├── package.dhall-1.32.golden │ │ │ ├── package.dhall-1.34.golden │ │ │ ├── package.json.golden │ │ │ ├── package.yaml.golden │ │ │ ├── empty-inferred.cabal │ │ │ ├── package.yaml.cabal │ │ │ └── empty-inferred.cabal.golden │ │ ├── empty-package.dhall │ │ ├── empty-package.yaml │ │ ├── import-local │ │ │ ├── package.dhall │ │ │ ├── name.dhl │ │ │ ├── package.yaml │ │ │ ├── package.yaml.golden │ │ │ ├── package.dhall-1.32.golden │ │ │ ├── package.dhall-1.34.golden │ │ │ ├── package.json │ │ │ ├── package.json.golden │ │ │ ├── import-local.cabal │ │ │ ├── package.yaml.cabal │ │ │ └── import-local.cabal.golden │ │ ├── empty-package.yaml.golden │ │ ├── import-relative.dhl │ │ ├── empty-package.dhall-1.32.golden │ │ ├── empty-package.dhall-1.34.golden │ │ ├── import-relative │ │ │ ├── package.yaml │ │ │ ├── package.dhall │ │ │ ├── package.yaml.golden │ │ │ ├── package.dhall-1.32.golden │ │ │ ├── package.dhall-1.34.golden │ │ │ ├── package.json │ │ │ ├── package.json.golden │ │ │ ├── package.yaml.cabal │ │ │ ├── import-relative.cabal │ │ │ └── import-relative.cabal.golden │ │ ├── empty-package.json │ │ ├── empty-package.json.golden │ │ ├── when-dependencies.yaml │ │ ├── when-dependencies.yaml.golden │ │ ├── empty-package.cabal │ │ ├── empty-package.yaml.cabal │ │ ├── empty-package.cabal.golden │ │ ├── when-dependencies.cabal │ │ ├── when-dependencies.yaml.cabal │ │ ├── when-dependencies.cabal.golden │ │ ├── when-dependencies.dhall-1.32.golden │ │ ├── when-dependencies.dhall-1.34.golden │ │ ├── with-GHC2021.dhall │ │ ├── when-dependencies.dhall │ │ ├── when-dependencies.json │ │ ├── when-dependencies.json.golden │ │ ├── with-GHC2021.yaml │ │ ├── with-GHC2021.yaml.golden │ │ ├── with-GHC2021.dhall-1.34.golden │ │ ├── with-GHC2021.json │ │ ├── with-GHC2021.json.golden │ │ ├── with-GHC2021.cabal │ │ ├── with-GHC2021.yaml.cabal │ │ └── with-GHC2021.cabal.golden │ └── real-world │ │ ├── hpack │ │ ├── hpack.yaml │ │ ├── hpack.yaml.golden │ │ ├── package.yaml │ │ ├── hpack.dhall-1.32.golden │ │ ├── hpack.dhall-1.34.golden │ │ ├── hpack.dhall │ │ ├── hpack.json │ │ ├── hpack.json.golden │ │ ├── hpack.cabal │ │ ├── hpack.yaml.cabal │ │ └── hpack.cabal.golden │ │ └── stack │ │ ├── package.yaml │ │ ├── stack.yaml │ │ ├── stack.yaml.golden │ │ ├── stack.dhall-1.32.golden │ │ ├── stack.dhall-1.34.golden │ │ ├── stack.dhall │ │ └── stack.json └── src │ └── Golden.hs ├── Setup.lhs ├── .gitignore ├── .github └── workflows │ ├── whitespace.yml │ ├── hlint.yml │ ├── cabal.yml │ └── stack.yml ├── fix-whitespace.yaml ├── stack.yaml ├── cabal.project ├── project-versions.mk ├── docs ├── BUILDING.md └── MORE.md ├── dhall └── ghc-2021.dhall ├── exe ├── dhall-hpack-json │ └── JsonMain.hs ├── dhall-hpack-yaml │ └── YamlMain.hs ├── dhall-hpack-dhall │ └── DhallMain.hs ├── options │ └── Options.hs └── dhall-hpack-cabal │ └── CabalMain.hs ├── LICENSE ├── project-files.mk ├── changelog.md ├── stack.yaml.lock ├── package.dhall ├── README.md ├── Makefile ├── library └── Hpack │ ├── Fields.hs │ └── Dhall.hs └── hpack-dhall.cabal /.hlint.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ghci: -------------------------------------------------------------------------------- 1 | :set -isrc -itest 2 | -------------------------------------------------------------------------------- /updo.project: -------------------------------------------------------------------------------- 1 | packages: updo 2 | -------------------------------------------------------------------------------- /project-dhall/pkgs/hpack-dhall.dhall: -------------------------------------------------------------------------------- 1 | [ "." ] 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/src/Main.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project-dhall/pkg-groups.dhall: -------------------------------------------------------------------------------- 1 | [ "hpack-dhall" ] 2 | -------------------------------------------------------------------------------- /project-dhall/pkgs-upgrade-todo.dhall: -------------------------------------------------------------------------------- 1 | [] : List Text 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.dhall: -------------------------------------------------------------------------------- 1 | {=} 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.yaml: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | {=} -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | {=} -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.json.golden: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.yaml.golden: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.dhall: -------------------------------------------------------------------------------- 1 | { name = "empty-package" } 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.yaml: -------------------------------------------------------------------------------- 1 | name: empty-package 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.dhall: -------------------------------------------------------------------------------- 1 | ./name.dhl ⫽ {=} 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.yaml.golden: -------------------------------------------------------------------------------- 1 | name: empty-package 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/name.dhl: -------------------------------------------------------------------------------- 1 | { name = "import-local" } 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.yaml: -------------------------------------------------------------------------------- 1 | name: import-local 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative.dhl: -------------------------------------------------------------------------------- 1 | { name = "import-relative" } 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | { name = "empty-package" } -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | { name = "empty-package" } -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.yaml.golden: -------------------------------------------------------------------------------- 1 | name: import-local 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.yaml: -------------------------------------------------------------------------------- 1 | name: import-relative 2 | 3 | -------------------------------------------------------------------------------- /Setup.lhs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env runhaskell 2 | > import Distribution.Simple 3 | > main = defaultMain 4 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "empty-package" 3 | } 4 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.dhall: -------------------------------------------------------------------------------- 1 | ../import-relative.dhl ⫽ {=} 2 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "empty-package" 3 | } 4 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | { name = "import-local" } ⫽ {=} -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | { name = "import-local" } ⫽ {=} -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "import-local" 3 | } 4 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.yaml.golden: -------------------------------------------------------------------------------- 1 | name: import-relative 2 | 3 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "import-local" 3 | } 4 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | { name = "import-relative" } ⫽ {=} -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | { name = "import-relative" } ⫽ {=} -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "import-relative" 3 | } 4 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "import-relative" 3 | } 4 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.2.8/text-templates/cabal-snippet.dhall: -------------------------------------------------------------------------------- 1 | '' 2 | 3 | program-options 4 | ghc-options: -fhide-source-paths'' 5 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall: -------------------------------------------------------------------------------- 1 | '' 2 | 3 | program-options 4 | ghc-options: -fhide-source-paths'' 5 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.6.5/constraints.dhall: -------------------------------------------------------------------------------- 1 | [ { dep = "dhall", ver = "1.42.1" } 2 | , { dep = "dhall-json", ver = "1.7.12" } 3 | ] 4 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.6.5/text-templates/cabal-snippet.dhall: -------------------------------------------------------------------------------- 1 | '' 2 | 3 | program-options 4 | ghc-options: -fhide-source-paths'' 5 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.8.2/constraints.dhall: -------------------------------------------------------------------------------- 1 | [ { dep = "dhall", ver = "1.42.1" } 2 | , { dep = "dhall-json", ver = "1.7.12" } 3 | ] 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | /dist-newstyle/ 3 | .ghc.environment.* 4 | .stack-work* 5 | __bin 6 | .updo 7 | updo 8 | project-nix 9 | project-versions.nix 10 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.2.8/text-templates/stack-snippet.dhall: -------------------------------------------------------------------------------- 1 | \(_stackage-resolver : Optional Text) -> 2 | '' 3 | user-message: "WARNING: This stack project is generated." 4 | '' 5 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.4.8/text-templates/stack-snippet.dhall: -------------------------------------------------------------------------------- 1 | \(_stackage-resolver : Optional Text) -> 2 | '' 3 | user-message: "WARNING: This stack project is generated." 4 | '' 5 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.6.5/text-templates/stack-snippet.dhall: -------------------------------------------------------------------------------- 1 | \(_stackage-resolver : Optional Text) -> 2 | '' 3 | user-message: "WARNING: This stack project is generated." 4 | '' 5 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.8.2/text-templates/cabal-snippet.dhall: -------------------------------------------------------------------------------- 1 | '' 2 | 3 | program-options 4 | ghc-options: -fhide-source-paths 5 | 6 | allow-newer: 7 | dhall:* 8 | , dhall-json:* 9 | '' 10 | -------------------------------------------------------------------------------- /.github/workflows/whitespace.yml: -------------------------------------------------------------------------------- 1 | name: whitespace 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | check: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v4 13 | - uses: andreasabel/fix-whitespace-action@v1 14 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.8.2/text-templates/stack-snippet.dhall: -------------------------------------------------------------------------------- 1 | \(_stackage-resolver : Optional Text) -> 2 | '' 3 | user-message: "WARNING: This stack project is generated." 4 | 5 | allow-newer: true 6 | allow-newer-deps: 7 | - dhall 8 | - dhall-json 9 | '' 10 | -------------------------------------------------------------------------------- /fix-whitespace.yaml: -------------------------------------------------------------------------------- 1 | excluded-dirs: 2 | - "dist-newstyle" 3 | - ".updo" 4 | - "updo" 5 | 6 | included-files: 7 | - "**/*.cabal" 8 | - "**/*.dhall" 9 | - "**/*.hs" 10 | - "**/*.json" 11 | - "**/*.md" 12 | - "**/*.project" 13 | - "**/*.yaml" 14 | - "**/*.yml" 15 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.yaml: -------------------------------------------------------------------------------- 1 | name: when-dependencies 2 | when: 3 | condition: impl(ghc < 8.2.2) 4 | then: 5 | dependencies: 6 | - base == 4.* 7 | - yaml 8 | else: 9 | dependencies: 10 | - base == 4.* 11 | - yaml-pretty-extras 12 | 13 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.yaml.golden: -------------------------------------------------------------------------------- 1 | name: when-dependencies 2 | when: 3 | condition: impl(ghc < 8.2.2) 4 | then: 5 | dependencies: 6 | - base == 4.* 7 | - yaml 8 | else: 9 | dependencies: 10 | - base == 4.* 11 | - yaml-pretty-extras 12 | 13 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from empty-package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: empty-package 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from empty-package.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: empty-package 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/import-local.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: import-local 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/package.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: import-local 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/empty-inferred.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: empty-inferred 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/package.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: empty-inferred 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-package.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from empty-package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: empty-package 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/package.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: import-relative 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-local/import-local.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: import-local 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/import-relative.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: import-relative 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from when-dependencies.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: when-dependencies 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from when-dependencies.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: when-dependencies 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/empty-inferred/empty-inferred.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: empty-inferred 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/import-relative/import-relative.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: import-relative 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from when-dependencies.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: when-dependencies 8 | version: 0.0.0 9 | build-type: Simple 10 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | let deps = [ "base == 4.*" ] 2 | 3 | in { name = "when-dependencies" 4 | , when = 5 | { condition = "impl(ghc < 8.2.2)" 6 | , then.dependencies = deps # [ "yaml" ] 7 | , else.dependencies = deps # [ "yaml-pretty-extras" ] 8 | } 9 | } -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | let deps = [ "base == 4.*" ] 2 | 3 | in { name = "when-dependencies" 4 | , when = 5 | { condition = "impl(ghc < 8.2.2)" 6 | , `then`.dependencies = deps # [ "yaml" ] 7 | , `else`.dependencies = deps # [ "yaml-pretty-extras" ] 8 | } 9 | } -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.dhall: -------------------------------------------------------------------------------- 1 | -- SEE: https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Driver/Session.hs#L1376-1424 2 | { name = "with-GHC2021" 3 | , default-extensions = 4 | https://raw.githubusercontent.com/cabalism/hpack-dhall/main/dhall/ghc-2021.dhall 5 | , executable = { main = "Main.hs", source-dirs = "src" } 6 | } 7 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | user-message: "WARNING: This stack project is generated." 2 | 3 | resolver: lts-21.25 4 | 5 | packages: 6 | - ./. 7 | 8 | extra-deps: 9 | - crypton-1.0.0 10 | - crypton-connection-0.4.0 11 | - crypton-x509-1.7.6 12 | - crypton-x509-store-1.6.9 13 | - crypton-x509-system-1.6.7 14 | - crypton-x509-validation-1.6.12 15 | - hpack-0.36.0 16 | - http-client-tls-0.3.6.3 17 | - tls-2.0.5 18 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.dhall: -------------------------------------------------------------------------------- 1 | let deps = [ "base == 4.*" ] 2 | 3 | in { name = 4 | "when-dependencies" 5 | , when = 6 | { condition = 7 | "impl(ghc < 8.2.2)" 8 | , `then` = 9 | { dependencies = deps # [ "yaml" ] } 10 | , `else` = 11 | { dependencies = deps # [ "yaml-pretty-extras" ] } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | import: ./project-stackage/lts-21.25.config 2 | 3 | packages: 4 | . 5 | 6 | constraints: 7 | crypton ==1.0.0 8 | , crypton-connection ==0.4.0 9 | , crypton-x509 ==1.7.6 10 | , crypton-x509-store ==1.6.9 11 | , crypton-x509-system ==1.6.7 12 | , crypton-x509-validation ==1.6.12 13 | , hpack ==0.36.0 14 | , http-client-tls ==0.3.6.3 15 | , tls ==2.0.5 16 | 17 | program-options 18 | ghc-options: -fhide-source-paths 19 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.4.8/constraints.dhall: -------------------------------------------------------------------------------- 1 | [ { dep = "crypton", ver = "1.0.0" } 2 | , { dep = "crypton-connection", ver = "0.4.0" } 3 | , { dep = "crypton-x509", ver = "1.7.6" } 4 | , { dep = "crypton-x509-store", ver = "1.6.9" } 5 | , { dep = "crypton-x509-system", ver = "1.6.7" } 6 | , { dep = "crypton-x509-validation", ver = "1.6.12" } 7 | , { dep = "hpack", ver = "0.36.0" } 8 | , { dep = "http-client-tls", ver = "0.3.6.3" } 9 | , { dep = "tls", ver = "2.0.5" } 10 | ] 11 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "when-dependencies", 3 | "when": { 4 | "condition": "impl(ghc < 8.2.2)", 5 | "then": { 6 | "dependencies": [ 7 | "base == 4.*", 8 | "yaml" 9 | ] 10 | }, 11 | "else": { 12 | "dependencies": [ 13 | "base == 4.*", 14 | "yaml-pretty-extras" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/when-dependencies.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "when-dependencies", 3 | "when": { 4 | "condition": "impl(ghc < 8.2.2)", 5 | "then": { 6 | "dependencies": [ 7 | "base == 4.*", 8 | "yaml" 9 | ] 10 | }, 11 | "else": { 12 | "dependencies": [ 13 | "base == 4.*", 14 | "yaml-pretty-extras" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.2.8/constraints.dhall: -------------------------------------------------------------------------------- 1 | [ { dep = "crypton", ver = "1.0.0" } 2 | , { dep = "crypton-connection", ver = "0.4.0" } 3 | , { dep = "crypton-x509", ver = "1.7.6" } 4 | , { dep = "crypton-x509-store", ver = "1.6.9" } 5 | , { dep = "crypton-x509-system", ver = "1.6.7" } 6 | , { dep = "crypton-x509-validation", ver = "1.6.12" } 7 | , { dep = "hpack", ver = "0.36.0" } 8 | , { dep = "http-client-tls", ver = "0.3.6.3" } 9 | , { dep = "tls", ver = "2.0.5" } 10 | , { dep = "memory", ver = "0.18.0" } 11 | , { dep = "unix-time", ver = "0.4.12" } 12 | ] 13 | -------------------------------------------------------------------------------- /.github/workflows/hlint.yml: -------------------------------------------------------------------------------- 1 | name: hlint 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - "**.md" 7 | pull_request: 8 | paths-ignore: 9 | - "**.md" 10 | 11 | jobs: 12 | build: 13 | name: hlint-3.8 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | submodules: true 20 | 21 | - uses: haskell-actions/hlint-setup@v2 22 | name: Set up HLint 23 | with: 24 | version: "3.8" 25 | 26 | - uses: haskell-actions/hlint-run@v2 27 | name: hlint 28 | with: 29 | path: '["library/", "exe/", "test-suite-golden/src"]' 30 | fail-on: suggestion 31 | -------------------------------------------------------------------------------- /project-versions.mk: -------------------------------------------------------------------------------- 1 | # Versions of GHC and stackage resolver, the ones we're on and the next ones 2 | # we're upgrading to. 3 | GHC_VERSION ?= 9.4.8 4 | STACKAGE_VERSION ?= lts-21.25 5 | 6 | # For the upgrade, pick a matching pair of ghc-version and stack resolver. 7 | # GHC_UPGRADE ?= 9.2.8 8 | # STACKAGE_UPGRADE ?= lts-20.26 9 | # GHC_UPGRADE ?= 9.4.8 10 | # STACKAGE_UPGRADE ?= lts-21.25 11 | # GHC_UPGRADE ?= 9.6.5 12 | # STACKAGE_UPGRADE ?= lts-22.22 13 | # GHC_UPGRADE ?= 9.8.2 14 | # STACKAGE_UPGRADE ?= nightly-2024-05-18 15 | 16 | # Imports can be relative to the project or relative to importing file. 17 | # ImportRelative works with cabal-3.10 and is the default. 18 | # ProjectRelative works with cabal-3.8. 19 | CABAL_RELATIVITY ?= ImportRelative -------------------------------------------------------------------------------- /docs/BUILDING.md: -------------------------------------------------------------------------------- 1 | # Building from Source 2 | 3 | ``` 4 | $ gh repo clone cabalism/hpack-dhall 5 | $ cd hpack-dhall 6 | 7 | # installing with stack (stack itself bundles hpack) 8 | $ stack --version 9 | Version 2.7.3, Git revision 7927a3aec32e2b2e5e4fb5be76d0d50eddcc197f x86_64 hpack-0.34.4 10 | $ stack install 11 | Copied executables to /Users/pdejoux/.local/bin: 12 | - dhall-hpack-cabal 13 | - dhall-hpack-dhall 14 | - dhall-hpack-json 15 | - dhall-hpack-yaml 16 | 17 | # installing with cabal 18 | $ ghcup --version 19 | The GHCup Haskell installer, version v0.1.16.2 20 | $ ghcup set cabal 3.4.0.0 21 | [ Info ] Cabal 3.4.0.0 successfully set as default version 22 | $ ghcup set ghc 8.10.4 23 | [ Info ] GHC 8.10.4 successfully set as default version 24 | $ cabal install all:exes --overwrite-policy=always --installdir=$HOME/.cabal/bin 25 | ... 26 | Completed hpack-dhall-0.5.3 (exe:dhall-hpack-cabal) 27 | Symlinking 'dhall-hpack-dhall' to '/Users/.../.cabal/bin/dhall-hpack-dhall' 28 | Symlinking 'dhall-hpack-json' to '/Users/.../.cabal/bin/dhall-hpack-json' 29 | Symlinking 'dhall-hpack-yaml' to '/Users/.../.cabal/bin/dhall-hpack-yaml' 30 | Symlinking 'dhall-hpack-cabal' to '/Users/.../.cabal/bin/dhall-hpack-cabal' 31 | ``` 32 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.yaml: -------------------------------------------------------------------------------- 1 | name: with-GHC2021 2 | default-extensions: 3 | - ImplicitPrelude 4 | - StarIsType 5 | - MonomorphismRestriction 6 | - TraditionalRecordSyntax 7 | - EmptyDataDecls 8 | - ForeignFunctionInterface 9 | - PatternGuards 10 | - DoAndIfThenElse 11 | - FieldSelectors 12 | - RelaxedPolyRec 13 | - BangPatterns 14 | - BinaryLiterals 15 | - ConstrainedClassMethods 16 | - ConstraintKinds 17 | - DeriveDataTypeable 18 | - DeriveFoldable 19 | - DeriveFunctor 20 | - DeriveGeneric 21 | - DeriveLift 22 | - DeriveTraversable 23 | - EmptyCase 24 | - EmptyDataDeriving 25 | - ExistentialQuantification 26 | - ExplicitForAll 27 | - FlexibleContexts 28 | - FlexibleInstances 29 | - GADTSyntax 30 | - GeneralizedNewtypeDeriving 31 | - HexFloatLiterals 32 | - ImportQualifiedPost 33 | - InstanceSigs 34 | - KindSignatures 35 | - MultiParamTypeClasses 36 | - RecordPuns 37 | - NamedWildCards 38 | - NumericUnderscores 39 | - PolyKinds 40 | - PostfixOperators 41 | - RankNTypes 42 | - ScopedTypeVariables 43 | - StandaloneDeriving 44 | - StandaloneKindSignatures 45 | - TupleSections 46 | - TypeApplications 47 | - TypeOperators 48 | - TypeSynonymInstances 49 | executable: 50 | main: Main.hs 51 | source-dirs: src 52 | 53 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.yaml.golden: -------------------------------------------------------------------------------- 1 | name: with-GHC2021 2 | default-extensions: 3 | - ImplicitPrelude 4 | - StarIsType 5 | - MonomorphismRestriction 6 | - TraditionalRecordSyntax 7 | - EmptyDataDecls 8 | - ForeignFunctionInterface 9 | - PatternGuards 10 | - DoAndIfThenElse 11 | - FieldSelectors 12 | - RelaxedPolyRec 13 | - BangPatterns 14 | - BinaryLiterals 15 | - ConstrainedClassMethods 16 | - ConstraintKinds 17 | - DeriveDataTypeable 18 | - DeriveFoldable 19 | - DeriveFunctor 20 | - DeriveGeneric 21 | - DeriveLift 22 | - DeriveTraversable 23 | - EmptyCase 24 | - EmptyDataDeriving 25 | - ExistentialQuantification 26 | - ExplicitForAll 27 | - FlexibleContexts 28 | - FlexibleInstances 29 | - GADTSyntax 30 | - GeneralizedNewtypeDeriving 31 | - HexFloatLiterals 32 | - ImportQualifiedPost 33 | - InstanceSigs 34 | - KindSignatures 35 | - MultiParamTypeClasses 36 | - RecordPuns 37 | - NamedWildCards 38 | - NumericUnderscores 39 | - PolyKinds 40 | - PostfixOperators 41 | - RankNTypes 42 | - ScopedTypeVariables 43 | - StandaloneDeriving 44 | - StandaloneKindSignatures 45 | - TupleSections 46 | - TypeApplications 47 | - TypeOperators 48 | - TypeSynonymInstances 49 | executable: 50 | main: Main.hs 51 | source-dirs: src 52 | 53 | -------------------------------------------------------------------------------- /dhall/ghc-2021.dhall: -------------------------------------------------------------------------------- 1 | [ "ImplicitPrelude" 2 | , "StarIsType" 3 | , "MonomorphismRestriction" 4 | , "TraditionalRecordSyntax" 5 | , "EmptyDataDecls" 6 | , "ForeignFunctionInterface" 7 | , "PatternGuards" 8 | , "DoAndIfThenElse" 9 | , "FieldSelectors" 10 | , "RelaxedPolyRec" 11 | , "BangPatterns" 12 | , "BinaryLiterals" 13 | , "ConstrainedClassMethods" 14 | , "ConstraintKinds" 15 | , "DeriveDataTypeable" 16 | , "DeriveFoldable" 17 | , "DeriveFunctor" 18 | , "DeriveGeneric" 19 | , "DeriveLift" 20 | , "DeriveTraversable" 21 | , "EmptyCase" 22 | , "EmptyDataDeriving" 23 | , "ExistentialQuantification" 24 | , "ExplicitForAll" 25 | , "FlexibleContexts" 26 | , "FlexibleInstances" 27 | , "GADTSyntax" 28 | , "GeneralizedNewtypeDeriving" 29 | , "HexFloatLiterals" 30 | , "ImportQualifiedPost" 31 | , "InstanceSigs" 32 | , "KindSignatures" 33 | , "MultiParamTypeClasses" 34 | , "RecordPuns" 35 | , "NamedWildCards" 36 | , "NumericUnderscores" 37 | , "PolyKinds" 38 | , "PostfixOperators" 39 | , "RankNTypes" 40 | , "ScopedTypeVariables" 41 | , "StandaloneDeriving" 42 | , "StandaloneKindSignatures" 43 | , "TupleSections" 44 | , "TypeApplications" 45 | , "TypeOperators" 46 | , "TypeSynonymInstances" 47 | ] 48 | : List Text 49 | -------------------------------------------------------------------------------- /exe/dhall-hpack-json/JsonMain.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RecordWildCards #-} 2 | 3 | module Main (main) where 4 | 5 | import Paths_hpack_dhall (version) 6 | import Data.Version (showVersion) 7 | import Data.Foldable (asum) 8 | import qualified Options.Applicative as O 9 | import Options (Options(..), parseOptions, parseNumericVersion, parseVersion) 10 | import Hpack.Dhall (showJson) 11 | import qualified Hpack as H (version) 12 | 13 | data Command = NumericVersion | Version | Run Options 14 | 15 | parserInfo :: O.ParserInfo Command 16 | parserInfo = 17 | O.info parser $ 18 | O.fullDesc 19 | <> O.header "Hpack as JSON" 20 | <> O.progDesc "Show a package description as JSON." 21 | where 22 | parser = asum 23 | [ NumericVersion <$ parseNumericVersion 24 | , Version <$ parseVersion 25 | , Run <$> parseOptions 26 | ] 27 | 28 | main :: IO () 29 | main = do 30 | command <- O.execParser parserInfo 31 | 32 | case command of 33 | NumericVersion -> 34 | putStrLn $ showVersion version 35 | 36 | Version -> do 37 | putStrLn $ "dhall-hpack-json-" ++ showVersion version 38 | putStrLn $ "hpack-" ++ showVersion H.version 39 | 40 | Run Options{..} -> do 41 | s <- showJson Nothing pkgFile 42 | putStrLn s 43 | return () 44 | -------------------------------------------------------------------------------- /exe/dhall-hpack-yaml/YamlMain.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RecordWildCards #-} 2 | 3 | module Main (main) where 4 | 5 | import Paths_hpack_dhall (version) 6 | import Data.Version (showVersion) 7 | import Data.Foldable (asum) 8 | import qualified Options.Applicative as O 9 | import Options (Options(..), parseOptions, parseNumericVersion, parseVersion) 10 | import Hpack.Dhall (showYaml) 11 | import qualified Hpack as H (version) 12 | 13 | data Command = NumericVersion | Version | Run Options 14 | 15 | parserInfo :: O.ParserInfo Command 16 | parserInfo = 17 | O.info parser $ 18 | O.fullDesc 19 | <> O.header "Hpack as YAML" 20 | <> O.progDesc "Show a package description as YAML." 21 | where 22 | parser = asum 23 | [ NumericVersion <$ parseNumericVersion 24 | , Version <$ parseVersion 25 | , Run <$> parseOptions 26 | ] 27 | 28 | main :: IO () 29 | main = do 30 | command <- O.execParser parserInfo 31 | 32 | case command of 33 | NumericVersion -> 34 | putStrLn $ showVersion version 35 | 36 | Version -> do 37 | putStrLn $ "dhall-hpack-yaml-" ++ showVersion version 38 | putStrLn $ "hpack-" ++ showVersion H.version 39 | 40 | Run Options{..} -> do 41 | s <- showYaml Nothing pkgFile 42 | putStrLn s 43 | return () 44 | -------------------------------------------------------------------------------- /exe/dhall-hpack-dhall/DhallMain.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RecordWildCards #-} 2 | 3 | module Main (main) where 4 | 5 | import Paths_hpack_dhall (version) 6 | import Data.Version (showVersion) 7 | import Data.Foldable (asum) 8 | import qualified Options.Applicative as O 9 | import Options (Options(..), parseOptions, parseNumericVersion, parseVersion) 10 | import Hpack.Dhall (showDhall) 11 | import qualified Hpack as H (version) 12 | 13 | data Command = NumericVersion | Version | Run Options 14 | 15 | parserInfo :: O.ParserInfo Command 16 | parserInfo = 17 | O.info parser $ 18 | O.fullDesc 19 | <> O.header "Hpack as Dhall" 20 | <> O.progDesc "Show a package description expression with imports resolved." 21 | where 22 | parser = asum 23 | [ NumericVersion <$ parseNumericVersion 24 | , Version <$ parseVersion 25 | , Run <$> parseOptions 26 | ] 27 | 28 | main :: IO () 29 | main = do 30 | command <- O.execParser parserInfo 31 | 32 | case command of 33 | NumericVersion -> 34 | putStrLn $ showVersion version 35 | 36 | Version -> do 37 | putStrLn $ "dhall-hpack-dhall-" ++ showVersion version 38 | putStrLn $ "hpack-" ++ showVersion H.version 39 | 40 | Run Options{..} -> do 41 | s <- showDhall pkgFile 42 | putStrLn s 43 | return () 44 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.yaml: -------------------------------------------------------------------------------- 1 | name: hpack 2 | version: 0.31.1 3 | synopsis: A modern format for Haskell packages 4 | description: See README at 5 | category: Development 6 | maintainer: Simon Hengel 7 | github: sol/hpack 8 | extra-source-files: 9 | - CHANGELOG.md 10 | ghc-options: -Wall 11 | dependencies: 12 | - base >= 4.9 && < 5 13 | - bytestring 14 | - deepseq 15 | - directory 16 | - filepath 17 | - Glob >= 0.9.0 18 | - text 19 | - containers 20 | - unordered-containers 21 | - yaml >= 0.10.0 22 | - aeson >= 1.2.1.0 23 | - scientific 24 | - Cabal >= 2.2 25 | - pretty 26 | - bifunctors 27 | - cryptonite 28 | - transformers 29 | - http-types 30 | - http-client 31 | - http-client-tls 32 | - vector 33 | - infer-license >= 0.2.0 && < 0.3 34 | library: 35 | exposed-modules: 36 | - Hpack 37 | - Hpack.Config 38 | - Hpack.Render 39 | - Hpack.Yaml 40 | source-dirs: src 41 | executable: 42 | main: Main.hs 43 | source-dirs: driver 44 | dependencies: 45 | - hpack 46 | tests: 47 | spec: 48 | main: Spec.hs 49 | source-dirs: 50 | - test 51 | - src 52 | cpp-options: -DTEST 53 | dependencies: 54 | - hspec == 2.* 55 | - QuickCheck 56 | - temporary 57 | - mockery >= 0.3 58 | - interpolate 59 | - template-haskell 60 | - HUnit >= 1.6.0.0 61 | build-tools: hspec-discover 62 | 63 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.yaml.golden: -------------------------------------------------------------------------------- 1 | name: hpack 2 | version: 0.31.1 3 | synopsis: A modern format for Haskell packages 4 | description: See README at 5 | category: Development 6 | maintainer: Simon Hengel 7 | github: sol/hpack 8 | extra-source-files: 9 | - CHANGELOG.md 10 | ghc-options: -Wall 11 | dependencies: 12 | - base >= 4.9 && < 5 13 | - bytestring 14 | - deepseq 15 | - directory 16 | - filepath 17 | - Glob >= 0.9.0 18 | - text 19 | - containers 20 | - unordered-containers 21 | - yaml >= 0.10.0 22 | - aeson >= 1.2.1.0 23 | - scientific 24 | - Cabal >= 2.2 25 | - pretty 26 | - bifunctors 27 | - cryptonite 28 | - transformers 29 | - http-types 30 | - http-client 31 | - http-client-tls 32 | - vector 33 | - infer-license >= 0.2.0 && < 0.3 34 | library: 35 | exposed-modules: 36 | - Hpack 37 | - Hpack.Config 38 | - Hpack.Render 39 | - Hpack.Yaml 40 | source-dirs: src 41 | executable: 42 | main: Main.hs 43 | source-dirs: driver 44 | dependencies: 45 | - hpack 46 | tests: 47 | spec: 48 | main: Spec.hs 49 | source-dirs: 50 | - test 51 | - src 52 | cpp-options: -DTEST 53 | dependencies: 54 | - hspec == 2.* 55 | - QuickCheck 56 | - temporary 57 | - mockery >= 0.3 58 | - interpolate 59 | - template-haskell 60 | - HUnit >= 1.6.0.0 61 | build-tools: hspec-discover 62 | 63 | -------------------------------------------------------------------------------- /exe/options/Options.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RecordWildCards #-} 2 | {-# LANGUAGE ApplicativeDo #-} 3 | 4 | module Options 5 | ( Options(..) 6 | , parseNumericVersion 7 | , parseVersion 8 | , parseOptions 9 | , parsePkgFile 10 | , parseForce 11 | , parseQuiet 12 | ) where 13 | 14 | import Hpack.Dhall (packageConfig) 15 | import Options.Applicative 16 | 17 | newtype Options = Options {pkgFile :: FilePath} 18 | 19 | parseOptions :: Parser Options 20 | parseOptions = helper <*> do 21 | pkgFile <- parsePkgFile 22 | return Options{..} 23 | 24 | parsePkgFile :: Parser FilePath 25 | parsePkgFile = 26 | strOption $ 27 | long "package-dhall" 28 | <> metavar "FILE" 29 | <> value packageConfig 30 | <> showDefault 31 | <> help "A record of hpack fields" 32 | 33 | parseNumericVersion :: Parser () 34 | parseNumericVersion = 35 | flag' () $ 36 | long "numeric-version" 37 | <> help "Show version only" 38 | 39 | parseVersion :: Parser () 40 | parseVersion = 41 | flag' () $ 42 | long "version" 43 | <> help "Show app name and version" 44 | 45 | parseForce :: Parser Bool 46 | parseForce = 47 | flag False True $ 48 | long "force" 49 | <> short 'f' 50 | <> help "Overwrite of the output .cabal file unnecessarily" 51 | 52 | parseQuiet :: Parser Bool 53 | parseQuiet = 54 | flag False True $ 55 | long "silent" 56 | <> help "Suppress logging" 57 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | { name = "with-GHC2021" 2 | , default-extensions = 3 | [ "ImplicitPrelude" 4 | , "StarIsType" 5 | , "MonomorphismRestriction" 6 | , "TraditionalRecordSyntax" 7 | , "EmptyDataDecls" 8 | , "ForeignFunctionInterface" 9 | , "PatternGuards" 10 | , "DoAndIfThenElse" 11 | , "FieldSelectors" 12 | , "RelaxedPolyRec" 13 | , "BangPatterns" 14 | , "BinaryLiterals" 15 | , "ConstrainedClassMethods" 16 | , "ConstraintKinds" 17 | , "DeriveDataTypeable" 18 | , "DeriveFoldable" 19 | , "DeriveFunctor" 20 | , "DeriveGeneric" 21 | , "DeriveLift" 22 | , "DeriveTraversable" 23 | , "EmptyCase" 24 | , "EmptyDataDeriving" 25 | , "ExistentialQuantification" 26 | , "ExplicitForAll" 27 | , "FlexibleContexts" 28 | , "FlexibleInstances" 29 | , "GADTSyntax" 30 | , "GeneralizedNewtypeDeriving" 31 | , "HexFloatLiterals" 32 | , "ImportQualifiedPost" 33 | , "InstanceSigs" 34 | , "KindSignatures" 35 | , "MultiParamTypeClasses" 36 | , "RecordPuns" 37 | , "NamedWildCards" 38 | , "NumericUnderscores" 39 | , "PolyKinds" 40 | , "PostfixOperators" 41 | , "RankNTypes" 42 | , "ScopedTypeVariables" 43 | , "StandaloneDeriving" 44 | , "StandaloneKindSignatures" 45 | , "TupleSections" 46 | , "TypeApplications" 47 | , "TypeOperators" 48 | , "TypeSynonymInstances" 49 | ] 50 | , executable = { main = "Main.hs", source-dirs = "src" } 51 | } -------------------------------------------------------------------------------- /project-dhall/ghc-9.2.8/text-templates/dhall2stack.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${./stack-snippet.dhall (None Text)} 25 | ${../../../updo/text-templates/dhall2stack.dhall 26 | TYPES.Verbosity.Quiet 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | '' 35 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.4.8/text-templates/dhall2stack.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${./stack-snippet.dhall (None Text)} 25 | ${../../../updo/text-templates/dhall2stack.dhall 26 | TYPES.Verbosity.Quiet 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | '' 35 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.6.5/text-templates/dhall2stack.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${./stack-snippet.dhall (None Text)} 25 | ${../../../updo/text-templates/dhall2stack.dhall 26 | TYPES.Verbosity.Quiet 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | '' 35 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.8.2/text-templates/dhall2stack.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${./stack-snippet.dhall (None Text)} 25 | ${../../../updo/text-templates/dhall2stack.dhall 26 | TYPES.Verbosity.Quiet 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | '' 35 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.8.2/text-templates/dhall2cabal.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${../../../updo/text-templates/dhall2cabal.dhall 25 | TYPES.Verbosity.Quiet 26 | TYPES.Stackage.StackageLocal 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | ${./cabal-snippet.dhall}'' 35 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.2.8/text-templates/dhall2cabal.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${../../../updo/text-templates/dhall2cabal.dhall 25 | TYPES.Verbosity.Quiet 26 | TYPES.Stackage.StackageLocal 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | ${./cabal-snippet.dhall} 35 | '' 36 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${../../../updo/text-templates/dhall2cabal.dhall 25 | TYPES.Verbosity.Quiet 26 | TYPES.Stackage.StackageLocal 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | ${./cabal-snippet.dhall} 35 | '' 36 | -------------------------------------------------------------------------------- /project-dhall/ghc-9.6.5/text-templates/dhall2cabal.dhall: -------------------------------------------------------------------------------- 1 | let TYPES = ./../../../updo/types.dhall 2 | 3 | let empty-constraints = ./../../../updo/empty/constraints.dhall 4 | 5 | let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall 6 | 7 | let null = https://prelude.dhall-lang.org/List/null 8 | 9 | in \(pkgs-done : List Text) -> 10 | \(stackage-resolver : Text) -> 11 | let pkgs-todo = ../../pkgs-upgrade-todo.dhall 12 | 13 | let pkg-config = 14 | { constraints = ./../constraints.dhall ? empty-constraints 15 | , source-pkgs = 16 | { deps-external = ./../deps-external.dhall ? empty-source-pkgs 17 | , deps-internal = ./../deps-internal.dhall ? empty-source-pkgs 18 | , forks-external = ./../forks-external.dhall ? empty-source-pkgs 19 | , forks-internal = ./../forks-internal.dhall ? empty-source-pkgs 20 | } 21 | } 22 | 23 | in '' 24 | ${../../../updo/text-templates/dhall2cabal.dhall 25 | TYPES.Verbosity.Quiet 26 | TYPES.Stackage.StackageLocal 27 | stackage-resolver 28 | ( if null Text pkgs-todo 29 | then TYPES.PkgSet.AllPkgs pkgs-done 30 | else TYPES.PkgSet.PkgUpgrade 31 | { todo = pkgs-todo, done = pkgs-done } 32 | ) 33 | pkg-config} 34 | ${./cabal-snippet.dhall} 35 | '' 36 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/package.yaml: -------------------------------------------------------------------------------- 1 | name: hpack 2 | version: 0.31.1 3 | synopsis: A modern format for Haskell packages 4 | description: See README at 5 | maintainer: Simon Hengel 6 | github: sol/hpack 7 | category: Development 8 | extra-source-files: 9 | - CHANGELOG.md 10 | 11 | ghc-options: -Wall 12 | 13 | dependencies: 14 | - base >= 4.9 && < 5 15 | - bytestring 16 | - deepseq 17 | - directory 18 | - filepath 19 | - Glob >= 0.9.0 20 | - text 21 | - containers 22 | - unordered-containers 23 | - yaml >= 0.10.0 24 | - aeson >= 1.2.1.0 25 | - scientific 26 | - Cabal >= 2.2 27 | - pretty 28 | - bifunctors 29 | - cryptonite 30 | - transformers 31 | - http-types 32 | - http-client 33 | - http-client-tls 34 | - vector 35 | - infer-license >= 0.2.0 && < 0.3 36 | 37 | library: 38 | source-dirs: src 39 | exposed-modules: 40 | - Hpack 41 | - Hpack.Config 42 | - Hpack.Render 43 | - Hpack.Yaml 44 | 45 | executable: 46 | main: Main.hs 47 | source-dirs: driver 48 | dependencies: 49 | - hpack 50 | 51 | tests: 52 | spec: 53 | cpp-options: -DTEST 54 | main: Spec.hs 55 | source-dirs: 56 | - test 57 | - src 58 | dependencies: 59 | - hspec == 2.* 60 | - QuickCheck 61 | - temporary 62 | - mockery >= 0.3 63 | - interpolate 64 | - template-haskell 65 | - HUnit >= 1.6.0.0 66 | build-tools: hspec-discover 67 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, Phil de Joux 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the author nor the names of its contributors may be 15 | used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | { name = "hpack" 2 | , version = "0.31.1" 3 | , synopsis = "A modern format for Haskell packages" 4 | , description = "See README at " 5 | , maintainer = "Simon Hengel " 6 | , github = "sol/hpack" 7 | , category = "Development" 8 | , extra-source-files = [ "CHANGELOG.md" ] 9 | , ghc-options = "-Wall" 10 | , dependencies = 11 | [ "base >= 4.9 && < 5" 12 | , "bytestring" 13 | , "deepseq" 14 | , "directory" 15 | , "filepath" 16 | , "Glob >= 0.9.0" 17 | , "text" 18 | , "containers" 19 | , "unordered-containers" 20 | , "yaml >= 0.10.0" 21 | , "aeson >= 1.2.1.0" 22 | , "scientific" 23 | , "Cabal >= 2.2" 24 | , "pretty" 25 | , "bifunctors" 26 | , "cryptonite" 27 | , "transformers" 28 | , "http-types" 29 | , "http-client" 30 | , "http-client-tls" 31 | , "vector" 32 | , "infer-license >= 0.2.0 && < 0.3" 33 | ] 34 | , library = 35 | { source-dirs = "src" 36 | , exposed-modules = [ "Hpack", "Hpack.Config", "Hpack.Render", "Hpack.Yaml" ] 37 | } 38 | , executable = 39 | { main = "Main.hs", source-dirs = "driver", dependencies = [ "hpack" ] } 40 | , tests.spec = 41 | { cpp-options = "-DTEST" 42 | , main = "Spec.hs" 43 | , source-dirs = [ "test", "src" ] 44 | , dependencies = 45 | [ "hspec == 2.*" 46 | , "QuickCheck" 47 | , "temporary" 48 | , "mockery >= 0.3" 49 | , "interpolate" 50 | , "template-haskell" 51 | , "HUnit >= 1.6.0.0" 52 | ] 53 | , build-tools = "hspec-discover" 54 | } 55 | } -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | { name = "hpack" 2 | , version = "0.31.1" 3 | , synopsis = "A modern format for Haskell packages" 4 | , description = "See README at " 5 | , maintainer = "Simon Hengel " 6 | , github = "sol/hpack" 7 | , category = "Development" 8 | , extra-source-files = [ "CHANGELOG.md" ] 9 | , ghc-options = "-Wall" 10 | , dependencies = 11 | [ "base >= 4.9 && < 5" 12 | , "bytestring" 13 | , "deepseq" 14 | , "directory" 15 | , "filepath" 16 | , "Glob >= 0.9.0" 17 | , "text" 18 | , "containers" 19 | , "unordered-containers" 20 | , "yaml >= 0.10.0" 21 | , "aeson >= 1.2.1.0" 22 | , "scientific" 23 | , "Cabal >= 2.2" 24 | , "pretty" 25 | , "bifunctors" 26 | , "cryptonite" 27 | , "transformers" 28 | , "http-types" 29 | , "http-client" 30 | , "http-client-tls" 31 | , "vector" 32 | , "infer-license >= 0.2.0 && < 0.3" 33 | ] 34 | , library = 35 | { source-dirs = "src" 36 | , exposed-modules = [ "Hpack", "Hpack.Config", "Hpack.Render", "Hpack.Yaml" ] 37 | } 38 | , executable = 39 | { main = "Main.hs", source-dirs = "driver", dependencies = [ "hpack" ] } 40 | , tests.spec 41 | = 42 | { cpp-options = "-DTEST" 43 | , main = "Spec.hs" 44 | , source-dirs = [ "test", "src" ] 45 | , dependencies = 46 | [ "hspec == 2.*" 47 | , "QuickCheck" 48 | , "temporary" 49 | , "mockery >= 0.3" 50 | , "interpolate" 51 | , "template-haskell" 52 | , "HUnit >= 1.6.0.0" 53 | ] 54 | , build-tools = "hspec-discover" 55 | } 56 | } -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "with-GHC2021", 3 | "default-extensions": [ 4 | "ImplicitPrelude", 5 | "StarIsType", 6 | "MonomorphismRestriction", 7 | "TraditionalRecordSyntax", 8 | "EmptyDataDecls", 9 | "ForeignFunctionInterface", 10 | "PatternGuards", 11 | "DoAndIfThenElse", 12 | "FieldSelectors", 13 | "RelaxedPolyRec", 14 | "BangPatterns", 15 | "BinaryLiterals", 16 | "ConstrainedClassMethods", 17 | "ConstraintKinds", 18 | "DeriveDataTypeable", 19 | "DeriveFoldable", 20 | "DeriveFunctor", 21 | "DeriveGeneric", 22 | "DeriveLift", 23 | "DeriveTraversable", 24 | "EmptyCase", 25 | "EmptyDataDeriving", 26 | "ExistentialQuantification", 27 | "ExplicitForAll", 28 | "FlexibleContexts", 29 | "FlexibleInstances", 30 | "GADTSyntax", 31 | "GeneralizedNewtypeDeriving", 32 | "HexFloatLiterals", 33 | "ImportQualifiedPost", 34 | "InstanceSigs", 35 | "KindSignatures", 36 | "MultiParamTypeClasses", 37 | "RecordPuns", 38 | "NamedWildCards", 39 | "NumericUnderscores", 40 | "PolyKinds", 41 | "PostfixOperators", 42 | "RankNTypes", 43 | "ScopedTypeVariables", 44 | "StandaloneDeriving", 45 | "StandaloneKindSignatures", 46 | "TupleSections", 47 | "TypeApplications", 48 | "TypeOperators", 49 | "TypeSynonymInstances" 50 | ], 51 | "executable": { 52 | "main": "Main.hs", 53 | "source-dirs": "src" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "with-GHC2021", 3 | "default-extensions": [ 4 | "ImplicitPrelude", 5 | "StarIsType", 6 | "MonomorphismRestriction", 7 | "TraditionalRecordSyntax", 8 | "EmptyDataDecls", 9 | "ForeignFunctionInterface", 10 | "PatternGuards", 11 | "DoAndIfThenElse", 12 | "FieldSelectors", 13 | "RelaxedPolyRec", 14 | "BangPatterns", 15 | "BinaryLiterals", 16 | "ConstrainedClassMethods", 17 | "ConstraintKinds", 18 | "DeriveDataTypeable", 19 | "DeriveFoldable", 20 | "DeriveFunctor", 21 | "DeriveGeneric", 22 | "DeriveLift", 23 | "DeriveTraversable", 24 | "EmptyCase", 25 | "EmptyDataDeriving", 26 | "ExistentialQuantification", 27 | "ExplicitForAll", 28 | "FlexibleContexts", 29 | "FlexibleInstances", 30 | "GADTSyntax", 31 | "GeneralizedNewtypeDeriving", 32 | "HexFloatLiterals", 33 | "ImportQualifiedPost", 34 | "InstanceSigs", 35 | "KindSignatures", 36 | "MultiParamTypeClasses", 37 | "RecordPuns", 38 | "NamedWildCards", 39 | "NumericUnderscores", 40 | "PolyKinds", 41 | "PostfixOperators", 42 | "RankNTypes", 43 | "ScopedTypeVariables", 44 | "StandaloneDeriving", 45 | "StandaloneKindSignatures", 46 | "TupleSections", 47 | "TypeApplications", 48 | "TypeOperators", 49 | "TypeSynonymInstances" 50 | ], 51 | "executable": { 52 | "main": "Main.hs", 53 | "source-dirs": "src" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from with-GHC2021.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: with-GHC2021 8 | version: 0.0.0 9 | build-type: Simple 10 | 11 | executable with-GHC2021 12 | main-is: Main.hs 13 | other-modules: 14 | Paths_with_GHC2021 15 | hs-source-dirs: 16 | src 17 | default-extensions: 18 | ImplicitPrelude 19 | StarIsType 20 | MonomorphismRestriction 21 | TraditionalRecordSyntax 22 | EmptyDataDecls 23 | ForeignFunctionInterface 24 | PatternGuards 25 | DoAndIfThenElse 26 | FieldSelectors 27 | RelaxedPolyRec 28 | BangPatterns 29 | BinaryLiterals 30 | ConstrainedClassMethods 31 | ConstraintKinds 32 | DeriveDataTypeable 33 | DeriveFoldable 34 | DeriveFunctor 35 | DeriveGeneric 36 | DeriveLift 37 | DeriveTraversable 38 | EmptyCase 39 | EmptyDataDeriving 40 | ExistentialQuantification 41 | ExplicitForAll 42 | FlexibleContexts 43 | FlexibleInstances 44 | GADTSyntax 45 | GeneralizedNewtypeDeriving 46 | HexFloatLiterals 47 | ImportQualifiedPost 48 | InstanceSigs 49 | KindSignatures 50 | MultiParamTypeClasses 51 | RecordPuns 52 | NamedWildCards 53 | NumericUnderscores 54 | PolyKinds 55 | PostfixOperators 56 | RankNTypes 57 | ScopedTypeVariables 58 | StandaloneDeriving 59 | StandaloneKindSignatures 60 | TupleSections 61 | TypeApplications 62 | TypeOperators 63 | TypeSynonymInstances 64 | default-language: Haskell2010 65 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from with-GHC2021.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: with-GHC2021 8 | version: 0.0.0 9 | build-type: Simple 10 | 11 | executable with-GHC2021 12 | main-is: Main.hs 13 | other-modules: 14 | Paths_with_GHC2021 15 | hs-source-dirs: 16 | src 17 | default-extensions: 18 | ImplicitPrelude 19 | StarIsType 20 | MonomorphismRestriction 21 | TraditionalRecordSyntax 22 | EmptyDataDecls 23 | ForeignFunctionInterface 24 | PatternGuards 25 | DoAndIfThenElse 26 | FieldSelectors 27 | RelaxedPolyRec 28 | BangPatterns 29 | BinaryLiterals 30 | ConstrainedClassMethods 31 | ConstraintKinds 32 | DeriveDataTypeable 33 | DeriveFoldable 34 | DeriveFunctor 35 | DeriveGeneric 36 | DeriveLift 37 | DeriveTraversable 38 | EmptyCase 39 | EmptyDataDeriving 40 | ExistentialQuantification 41 | ExplicitForAll 42 | FlexibleContexts 43 | FlexibleInstances 44 | GADTSyntax 45 | GeneralizedNewtypeDeriving 46 | HexFloatLiterals 47 | ImportQualifiedPost 48 | InstanceSigs 49 | KindSignatures 50 | MultiParamTypeClasses 51 | RecordPuns 52 | NamedWildCards 53 | NumericUnderscores 54 | PolyKinds 55 | PostfixOperators 56 | RankNTypes 57 | ScopedTypeVariables 58 | StandaloneDeriving 59 | StandaloneKindSignatures 60 | TupleSections 61 | TypeApplications 62 | TypeOperators 63 | TypeSynonymInstances 64 | default-language: Haskell2010 65 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/key/with-GHC2021.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from with-GHC2021.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: with-GHC2021 8 | version: 0.0.0 9 | build-type: Simple 10 | 11 | executable with-GHC2021 12 | main-is: Main.hs 13 | other-modules: 14 | Paths_with_GHC2021 15 | hs-source-dirs: 16 | src 17 | default-extensions: 18 | ImplicitPrelude 19 | StarIsType 20 | MonomorphismRestriction 21 | TraditionalRecordSyntax 22 | EmptyDataDecls 23 | ForeignFunctionInterface 24 | PatternGuards 25 | DoAndIfThenElse 26 | FieldSelectors 27 | RelaxedPolyRec 28 | BangPatterns 29 | BinaryLiterals 30 | ConstrainedClassMethods 31 | ConstraintKinds 32 | DeriveDataTypeable 33 | DeriveFoldable 34 | DeriveFunctor 35 | DeriveGeneric 36 | DeriveLift 37 | DeriveTraversable 38 | EmptyCase 39 | EmptyDataDeriving 40 | ExistentialQuantification 41 | ExplicitForAll 42 | FlexibleContexts 43 | FlexibleInstances 44 | GADTSyntax 45 | GeneralizedNewtypeDeriving 46 | HexFloatLiterals 47 | ImportQualifiedPost 48 | InstanceSigs 49 | KindSignatures 50 | MultiParamTypeClasses 51 | RecordPuns 52 | NamedWildCards 53 | NumericUnderscores 54 | PolyKinds 55 | PostfixOperators 56 | RankNTypes 57 | ScopedTypeVariables 58 | StandaloneDeriving 59 | StandaloneKindSignatures 60 | TupleSections 61 | TypeApplications 62 | TypeOperators 63 | TypeSynonymInstances 64 | default-language: Haskell2010 65 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.dhall: -------------------------------------------------------------------------------- 1 | { name = 2 | "hpack" 3 | , version = 4 | "0.31.1" 5 | , synopsis = 6 | "A modern format for Haskell packages" 7 | , description = 8 | "See README at " 9 | , maintainer = 10 | "Simon Hengel " 11 | , github = 12 | "sol/hpack" 13 | , category = 14 | "Development" 15 | , extra-source-files = 16 | [ "CHANGELOG.md" ] 17 | , ghc-options = 18 | "-Wall" 19 | , dependencies = 20 | [ "base >= 4.9 && < 5" 21 | , "bytestring" 22 | , "deepseq" 23 | , "directory" 24 | , "filepath" 25 | , "Glob >= 0.9.0" 26 | , "text" 27 | , "containers" 28 | , "unordered-containers" 29 | , "yaml >= 0.10.0" 30 | , "aeson >= 1.2.1.0" 31 | , "scientific" 32 | , "Cabal >= 2.2" 33 | , "pretty" 34 | , "bifunctors" 35 | , "cryptonite" 36 | , "transformers" 37 | , "http-types" 38 | , "http-client" 39 | , "http-client-tls" 40 | , "vector" 41 | , "infer-license >= 0.2.0 && < 0.3" 42 | ] 43 | , library = 44 | { source-dirs = 45 | "src" 46 | , exposed-modules = 47 | [ "Hpack", "Hpack.Config", "Hpack.Render", "Hpack.Yaml" ] 48 | } 49 | , executable = 50 | { main = "Main.hs", source-dirs = "driver", dependencies = [ "hpack" ] } 51 | , tests = 52 | { spec = 53 | { cpp-options = 54 | "-DTEST" 55 | , main = 56 | "Spec.hs" 57 | , source-dirs = 58 | [ "test", "src" ] 59 | , dependencies = 60 | [ "hspec == 2.*" 61 | , "QuickCheck" 62 | , "temporary" 63 | , "mockery >= 0.3" 64 | , "interpolate" 65 | , "template-haskell" 66 | , "HUnit >= 1.6.0.0" 67 | ] 68 | , build-tools = 69 | "hspec-discover" 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hpack", 3 | "version": "0.31.1", 4 | "synopsis": "A modern format for Haskell packages", 5 | "description": "See README at ", 6 | "category": "Development", 7 | "maintainer": "Simon Hengel ", 8 | "github": "sol/hpack", 9 | "extra-source-files": [ 10 | "CHANGELOG.md" 11 | ], 12 | "ghc-options": "-Wall", 13 | "dependencies": [ 14 | "base >= 4.9 && < 5", 15 | "bytestring", 16 | "deepseq", 17 | "directory", 18 | "filepath", 19 | "Glob >= 0.9.0", 20 | "text", 21 | "containers", 22 | "unordered-containers", 23 | "yaml >= 0.10.0", 24 | "aeson >= 1.2.1.0", 25 | "scientific", 26 | "Cabal >= 2.2", 27 | "pretty", 28 | "bifunctors", 29 | "cryptonite", 30 | "transformers", 31 | "http-types", 32 | "http-client", 33 | "http-client-tls", 34 | "vector", 35 | "infer-license >= 0.2.0 && < 0.3" 36 | ], 37 | "library": { 38 | "exposed-modules": [ 39 | "Hpack", 40 | "Hpack.Config", 41 | "Hpack.Render", 42 | "Hpack.Yaml" 43 | ], 44 | "source-dirs": "src" 45 | }, 46 | "executable": { 47 | "main": "Main.hs", 48 | "source-dirs": "driver", 49 | "dependencies": [ 50 | "hpack" 51 | ] 52 | }, 53 | "tests": { 54 | "spec": { 55 | "main": "Spec.hs", 56 | "source-dirs": [ 57 | "test", 58 | "src" 59 | ], 60 | "cpp-options": "-DTEST", 61 | "dependencies": [ 62 | "hspec == 2.*", 63 | "QuickCheck", 64 | "temporary", 65 | "mockery >= 0.3", 66 | "interpolate", 67 | "template-haskell", 68 | "HUnit >= 1.6.0.0" 69 | ], 70 | "build-tools": "hspec-discover" 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hpack", 3 | "version": "0.31.1", 4 | "synopsis": "A modern format for Haskell packages", 5 | "description": "See README at ", 6 | "category": "Development", 7 | "maintainer": "Simon Hengel ", 8 | "github": "sol/hpack", 9 | "extra-source-files": [ 10 | "CHANGELOG.md" 11 | ], 12 | "ghc-options": "-Wall", 13 | "dependencies": [ 14 | "base >= 4.9 && < 5", 15 | "bytestring", 16 | "deepseq", 17 | "directory", 18 | "filepath", 19 | "Glob >= 0.9.0", 20 | "text", 21 | "containers", 22 | "unordered-containers", 23 | "yaml >= 0.10.0", 24 | "aeson >= 1.2.1.0", 25 | "scientific", 26 | "Cabal >= 2.2", 27 | "pretty", 28 | "bifunctors", 29 | "cryptonite", 30 | "transformers", 31 | "http-types", 32 | "http-client", 33 | "http-client-tls", 34 | "vector", 35 | "infer-license >= 0.2.0 && < 0.3" 36 | ], 37 | "library": { 38 | "exposed-modules": [ 39 | "Hpack", 40 | "Hpack.Config", 41 | "Hpack.Render", 42 | "Hpack.Yaml" 43 | ], 44 | "source-dirs": "src" 45 | }, 46 | "executable": { 47 | "main": "Main.hs", 48 | "source-dirs": "driver", 49 | "dependencies": [ 50 | "hpack" 51 | ] 52 | }, 53 | "tests": { 54 | "spec": { 55 | "main": "Spec.hs", 56 | "source-dirs": [ 57 | "test", 58 | "src" 59 | ], 60 | "cpp-options": "-DTEST", 61 | "dependencies": [ 62 | "hspec == 2.*", 63 | "QuickCheck", 64 | "temporary", 65 | "mockery >= 0.3", 66 | "interpolate", 67 | "template-haskell", 68 | "HUnit >= 1.6.0.0" 69 | ], 70 | "build-tools": "hspec-discover" 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /project-files.mk: -------------------------------------------------------------------------------- 1 | CABAL_VIA ?= dhall2cabal 2 | 3 | # How to generate project-nix/ghc-$(GHC_VERSION)/sha256map.nix? 4 | # This is copied from ghc-$(GHC_VERSION).sha256map.nix. 5 | # - false to generate from *.dhall inputs via sha256map.hs. 6 | # - true to generate from stack.yaml via sha256map.py. 7 | SHA256MAP_VIA_PYTHON ?= false 8 | 9 | # To use installed executables instead of *.hs scripts, set these to true. 10 | SHA256MAP_HS_EXE ?= true 11 | PKG_GROUPS_HS_EXE ?= true 12 | PKGS_SORTED_HS_EXE ?= true 13 | PKGS_UPGRADE_DONE_HS_EXE ?= true 14 | 15 | include project-versions.mk 16 | include updo/Makefile 17 | 18 | project-nix/ghc-%/sha256map.nix: ghc-%.sha256map.nix 19 | mkdir -p $(@D) && cp $^ $@ 20 | 21 | .PHONY: all 22 | all: \ 23 | projects \ 24 | project-nix/ghc-$(GHC_VERSION)/sha256map.nix \ 25 | project-versions.nix 26 | 27 | # To make stack.yaml or cabal.project and no other, mark the file we copy from 28 | # as intermediate. This is all we want when not doing a GHC upgrade. 29 | # 30 | # Comment out these .INTERMEDIATE targets to allow these files to be kept. 31 | .INTERMEDIATE: ghc-$(GHC_VERSION).$(CABAL_VIA).project 32 | .INTERMEDIATE: ghc-$(GHC_UPGRADE).$(CABAL_VIA).project 33 | .INTERMEDIATE: ghc-$(GHC_VERSION).$(STACK_VIA).yaml 34 | .INTERMEDIATE: ghc-$(GHC_UPGRADE).$(STACK_VIA).yaml 35 | .INTERMEDIATE: ghc-$(GHC_VERSION).sha256map.nix 36 | .INTERMEDIATE: ghc-$(GHC_UPGRADE).sha256map.nix 37 | 38 | # If true, generate the sha256map from the stack.yaml with python, 39 | # overriding the recipe for this target. 40 | ifeq ($(SHA256MAP_VIA_PYTHON), true) 41 | ghc-$(GHC_VERSION).sha256map.nix: stack.yaml 42 | updo/project-nix/sha256map.py <$^ >$@ 43 | ghc-$(GHC_UPGRADE).sha256map.nix: stack.upgrade.yaml 44 | updo/project-nix/sha256map.py <$^ >$@ 45 | endif 46 | 47 | .DEFAULT_GOAL := all 48 | 49 | UPDO_VERSION ?= 011be290d1d7ebcb2f8776565c9b50c7c843ba77 50 | UPDO_URL := https://github.com/cabalism/updo/archive/${UPDO_VERSION}.tar.gz 51 | 52 | updo/Makefile: 53 | rm -rf updo 54 | curl -sSL ${UPDO_URL} | tar -xz 55 | mv updo-* updo 56 | cabal install updo:exes --overwrite-policy=always --project-file=updo.project --with-compiler=ghc-$(GHC_VERSION) 57 | -------------------------------------------------------------------------------- /exe/dhall-hpack-cabal/CabalMain.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RecordWildCards #-} 2 | {-# LANGUAGE ApplicativeDo #-} 3 | 4 | module Main (main) where 5 | 6 | import Paths_hpack_dhall (version) 7 | import Data.Version (showVersion) 8 | import Data.Foldable (asum) 9 | import qualified Options.Applicative as O 10 | import Options 11 | ( parsePkgFile, parseNumericVersion, parseVersion 12 | , parseForce, parseQuiet 13 | ) 14 | import qualified Hpack as H (hpack, version, getOptions, setDecode) 15 | import Hpack.Dhall (fileToJson) 16 | 17 | data Command = NumericVersion | Version | Run Options 18 | 19 | data Options = 20 | Options 21 | { pkgFile :: String 22 | , force :: Bool 23 | , quiet :: Bool 24 | } 25 | 26 | parseOptions :: O.Parser Options 27 | parseOptions = O.helper <*> do 28 | pkgFile <- parsePkgFile 29 | force <- parseForce 30 | quiet <- parseQuiet 31 | return Options{..} 32 | 33 | parserInfo :: O.ParserInfo Command 34 | parserInfo = 35 | O.info parser $ 36 | O.fullDesc 37 | <> O.header "Hpack's dhalling" 38 | <> O.progDesc "Write the .cabal for a .dhall package description, resolving imports." 39 | where 40 | parser = asum 41 | [ NumericVersion <$ parseNumericVersion 42 | , Version <$ parseVersion 43 | , Run <$> parseOptions 44 | ] 45 | 46 | main :: IO () 47 | main = do 48 | command <- O.execParser parserInfo 49 | 50 | case command of 51 | NumericVersion -> 52 | putStrLn $ showVersion version 53 | 54 | Version -> do 55 | putStrLn $ "dhall-hpack-cabal-" ++ showVersion version 56 | putStrLn $ "hpack-" ++ showVersion H.version 57 | 58 | Run Options{..} -> do 59 | opts <- H.getOptions pkgFile $ 60 | mconcat 61 | [ [ "--force" | force ] 62 | , [ "--silent" | quiet ] 63 | ] 64 | case opts of 65 | Just (verbose, options) -> 66 | H.hpack verbose (H.setDecode fileToJson options) 67 | Nothing -> 68 | return () 69 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | The [latest version](https://github.com/blockscope/hpack-dhall/blob/master/changelog.md) of this changelog. 2 | 3 | ## 0.5.7 - Bump hpack and test versions 4 | * Require `hpack ^>= 0.35` and pin extra-deps for stack build and tests. 5 | 6 | ## 0.5.6 - Relax hpack version upper bound 7 | * Relax hpack bounds to `hpack >= 0.34.7` for stackage build. 8 | 9 | ## 0.5.5 - Bump hpack and test versions 10 | * Require `hpack ^>= 0.34.7`. 11 | * Test with GHC `8.8.4`, GHC `8.10.7`, GHC `9.0.2` and GHC `9.2.2`. 12 | 13 | ## 0.5.4 - Bump hpack and test versions 14 | * Require `hpack >= 0.34.6`. 15 | * Test with GHC `8.8.4`, GHC `8.10.7` and GHC `9.0.1`. 16 | 17 | ## 0.5.3 - Rewrite the README 18 | * Rewrite the README, making it shorter and splitting some details about more 19 | uses and building into separate docs. 20 | * Require `hpack >= 0.34.4`: 21 | ```diff 22 | $ dhall-hpack-cabal --version 23 | -dhall-hpack-cabal-0.5.2 24 | -hpack-0.34.2 25 | +dhall-hpack-cabal-0.5.3 26 | +hpack-0.34.4 27 | ``` 28 | * Require `base >= 4.13`, implying `GHC >= 8.8.4`. 29 | * Test with GHC `8.8.4` and `8.10.4`. 30 | * Add files for different stack GHC versions. 31 | ``` 32 | $ stack build --stack-yaml=stack/stack-8.8.4.yaml 33 | $ stack build --stack-yaml=stack/stack-8.10.4.yaml 34 | $ stack build --stack-yaml=stack/stack-9.0.1.yaml 35 | ``` 36 | * Remove the travis script and update github scripts with: 37 | ```diff 38 | - - uses: actions/setup-haskell@v1 39 | + - uses: haskell/actions/setup@v1 40 | 41 | - - uses: actions/cache@v1 42 | + - uses: actions/cache@v2 43 | ``` 44 | * Remove stale nix-related files. 45 | 46 | ## 0.5.2 - Consistent Golden Tests 47 | * Use explicit dependencies to achieve consistent golden tests in all but 48 | stack-8.6.3.yaml. 49 | 50 | ## 0.5.1 - Minor, bump in hpack version 51 | * Regenerate golden files for the bump in hpack's version: 52 | 53 | ``` 54 | ---- This file has been generated from package.yaml by hpack version 0.31.0. 55 | ++-- This file has been generated from package.yaml by hpack version 0.31.1. 56 | ``` 57 | 58 | ## 0.5.0 - Sorted Fields Pretty Printing 59 | * Sort fields when pretty printing JSON and YAML. 60 | * Add real world golden tests, using stack and hpack packages. 61 | 62 | ## 0.4.0 - Split Executables 63 | * Add licence and copyright. 64 | * Rename hpack-dhall to dhall-hpack-cabal. 65 | * Add dhall-hpack-* executables for showing dhall, json and yaml. 66 | -------------------------------------------------------------------------------- /.github/workflows/cabal.yml: -------------------------------------------------------------------------------- 1 | name: cabal 2 | 3 | on: 4 | push: 5 | branches: [main, ci-cabal] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build: 11 | name: ghc-${{ matrix.vers.ghc }} 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | cabal: ["3.10.3.0"] 16 | vers: 17 | - {ghc: "9.2.8", stackage: "lts-20.26"} 18 | - {ghc: "9.4.8", stackage: "lts-21.25"} 19 | - {ghc: "9.6.5", stackage: "lts-22.22"} 20 | - {ghc: "9.8.2", stackage: "nightly-2024-05-18"} 21 | 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - name: Set up GHC and cabal-install 26 | uses: haskell-actions/setup@v2 27 | id: setup 28 | with: 29 | ghc-version: ${{ matrix.vers.ghc }} 30 | cabal-version: ${{ matrix.cabal }} 31 | enable-stack: true 32 | stack-version: '2.15.7' 33 | 34 | - name: Update hackage index 35 | run: cabal update --ignore-project 36 | 37 | - name: Install Dhall 38 | uses: dhall-lang/setup-dhall@v4 39 | with: 40 | version: '1.42.0' 41 | 42 | - name: Updo 43 | run: GHC_VERSION=${{ matrix.vers.ghc }} STACKAGE_VERSION=${{ matrix.vers.stackage }} make -f project-files.mk cabal.project 44 | 45 | # Generate a file to cache dependencies. 46 | - name: Build dry run 47 | run: cabal build all --enable-tests --enable-benchmarks --dry-run 48 | 49 | - name: Restore cached dependencies 50 | uses: actions/cache/restore@v4 51 | id: cache 52 | env: 53 | key: ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} 54 | with: 55 | path: ${{ steps.setup.outputs.cabal-store }} 56 | key: ${{ env.key }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }} 57 | restore-keys: ${{ env.key }}- 58 | 59 | - name: Install dependencies 60 | if: steps.cache.outputs.cache-hit != 'true' 61 | run: cabal build all --only-dependencies 62 | 63 | - name: Save cached dependencies 64 | uses: actions/cache/save@v4 65 | if: steps.cache.outputs.cache-hit != 'true' 66 | with: 67 | path: ${{ steps.setup.outputs.cabal-store }} 68 | key: ${{ steps.cache.outputs.cache-primary-key }} 69 | 70 | - name: build 71 | run: cabal build all --enable-tests --enable-benchmarks 72 | 73 | - name: test golden 74 | run: cabal test test:golden --test-show-details=direct --test-option="--color=always" 75 | -------------------------------------------------------------------------------- /.github/workflows/stack.yml: -------------------------------------------------------------------------------- 1 | name: stack 2 | 3 | on: 4 | push: 5 | branches: [main, ci-stack] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build: 11 | name: ghc-${{ matrix.vers.ghc }} 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | cabal: ["3.10.3.0"] 16 | vers: 17 | - {ghc: "9.8.2", stackage: "nightly-2024-05-18"} 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Set up GHC and cabal-install 23 | uses: haskell-actions/setup@v2 24 | id: setup 25 | with: 26 | ghc-version: ${{ matrix.vers.ghc }} 27 | cabal-version: ${{ matrix.cabal }} 28 | enable-stack: true 29 | stack-version: '2.15.7' 30 | 31 | - name: Configure stack 32 | run: | 33 | stack config set system-ghc --global true 34 | stack config set install-ghc --global false 35 | stack config set resolver ${{ matrix.vers.stackage }} 36 | 37 | - name: Update hackage index 38 | run: cabal update --ignore-project 39 | 40 | - name: Install Dhall 41 | uses: dhall-lang/setup-dhall@v4 42 | with: 43 | version: '1.42.0' 44 | 45 | - name: Updo 46 | run: GHC_VERSION=${{ matrix.vers.ghc }} STACKAGE_VERSION=${{ matrix.vers.stackage }} make -f project-files.mk stack.yaml 47 | 48 | # Generate a file to cache dependencies. 49 | - name: build 50 | run: stack ls dependencies json | jq > stack-deps.json 51 | 52 | - name: build 53 | run: stack test --no-run-tests --no-terminal --only-dependencies 54 | 55 | - name: Restore cached dependency of Pantry (Stackage package index) 56 | uses: actions/cache/restore@v4 57 | id: pantry 58 | env: 59 | key: ghc-${{ steps.setup.outputs.ghc-version }}-stack-${{ steps.setup.outputs.stack-version }} 60 | with: 61 | path: ${{ steps.setup.outputs.stack-root }}/pantry 62 | key: ${{ env.key }}-plan-${{ hashFiles('stack-deps.json') }} 63 | restore-keys: ${{ env.key }}- 64 | 65 | - name: Recompute Stackage package index (~/.stack/pantry) 66 | if: steps.pantry.outputs.cache-hit != 'true' 67 | run: stack update 68 | 69 | - name: Save cached dependencies 70 | uses: actions/cache/save@v4 71 | if: steps.pantry.outputs.cache-hit != 'true' 72 | with: 73 | path: ${{ steps.setup.outputs.stack-root }}/pantry 74 | key: ${{ steps.cache.outputs.cache-primary-key }} 75 | 76 | - name: build 77 | run: stack test --no-run-tests --no-terminal 78 | 79 | - name: test golden 80 | run: stack test hpack-dhall:golden --no-terminal --test-arguments "--color=always" 81 | -------------------------------------------------------------------------------- /stack.yaml.lock: -------------------------------------------------------------------------------- 1 | # This file was autogenerated by Stack. 2 | # You should not edit this file by hand. 3 | # For more information, please see the documentation at: 4 | # https://docs.haskellstack.org/en/stable/lock_files 5 | 6 | packages: 7 | - completed: 8 | hackage: crypton-1.0.0@sha256:637e58581978c84ef1288d14fa9cac1d2905ef60e319924293bc11250aca882d,14527 9 | pantry-tree: 10 | sha256: 4b5e5511567c0fe735a224cb8b2b278e1caa79344f2940d030d169e69b1b81e1 11 | size: 23275 12 | original: 13 | hackage: crypton-1.0.0 14 | - completed: 15 | hackage: crypton-connection-0.4.0@sha256:a7e622fe5f691abb0a10ff02374978b6ca7c085e93892b00eb1d3e7d513b41b4,1581 16 | pantry-tree: 17 | sha256: a670703ac7aec59ccf58c5a44a1832e79cd1e6089c823b70a521a5e81443d6c9 18 | size: 394 19 | original: 20 | hackage: crypton-connection-0.4.0 21 | - completed: 22 | hackage: crypton-x509-1.7.6@sha256:19a6f233a73952c408599d082db8d6a3487ab9c1abe0fa350b8d362ab61776ad,2343 23 | pantry-tree: 24 | sha256: 4a64cf3e2945a11661eb33584ff71abb04efc6ceaab2b8d94267af193caf1e07 25 | size: 1080 26 | original: 27 | hackage: crypton-x509-1.7.6 28 | - completed: 29 | hackage: crypton-x509-store-1.6.9@sha256:422b9b9f87a7382c66385d047615b16fc86a68c08ea22b1e0117c143a2d44050,1750 30 | pantry-tree: 31 | sha256: 87654d130a7f987ee139c821a1be45736d18df9fa4cb1142c4e054d3802338f3 32 | size: 406 33 | original: 34 | hackage: crypton-x509-store-1.6.9 35 | - completed: 36 | hackage: crypton-x509-system-1.6.7@sha256:023ed573d82983bc473a37a89e0434a085b413be9f68d07e085361056afd4637,1532 37 | pantry-tree: 38 | sha256: c0ca49e6a9537f3fdb7b47c5cfe93f7d744a369bf9d089f3c668b9c2d97402b7 39 | size: 399 40 | original: 41 | hackage: crypton-x509-system-1.6.7 42 | - completed: 43 | hackage: crypton-x509-validation-1.6.12@sha256:85989721b64be4b90de9f66ef641c26f57575cffed1a50d707065fb60176f386,2227 44 | pantry-tree: 45 | sha256: d4a0135f11218614fcd912cffaf54de8f749caca8696380e2589cbcfd64cc681 46 | size: 639 47 | original: 48 | hackage: crypton-x509-validation-1.6.12 49 | - completed: 50 | hackage: hpack-0.36.0@sha256:48f98f1b607bb856acf890fe4e62a600d16961763102e4e8b9bc76349cce05fe,5229 51 | pantry-tree: 52 | sha256: 7aa7deafdf4b5769e1f863cb98550a60ebec6ff32a6e7bf3a7421c530d9d4e4c 53 | size: 3742 54 | original: 55 | hackage: hpack-0.36.0 56 | - completed: 57 | hackage: http-client-tls-0.3.6.3@sha256:a5909ce412ee65c141b8547f8fe22236f175186c95c708e86a46b5547394f910,2046 58 | pantry-tree: 59 | sha256: a5659b6051a40039eec1db4b5350a232e2dced7a557917082a39623cfc605323 60 | size: 435 61 | original: 62 | hackage: http-client-tls-0.3.6.3 63 | - completed: 64 | hackage: tls-2.0.5@sha256:664c2b9b2b1af67f6973f480c6b2b5ae086dfea8238092c1b5f74b23a7d3271c,6358 65 | pantry-tree: 66 | sha256: ce25916130ea632a4c4d898cb5e5540e9a8bc4626512f52deeaa0f26840ee40b 67 | size: 6451 68 | original: 69 | hackage: tls-2.0.5 70 | snapshots: 71 | - completed: 72 | sha256: a81fb3877c4f9031e1325eb3935122e608d80715dc16b586eb11ddbff8671ecd 73 | size: 640086 74 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/25.yaml 75 | original: lts-21.25 76 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from hpack.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: hpack 8 | version: 0.31.1 9 | synopsis: A modern format for Haskell packages 10 | description: See README at 11 | category: Development 12 | homepage: https://github.com/sol/hpack#readme 13 | bug-reports: https://github.com/sol/hpack/issues 14 | maintainer: Simon Hengel 15 | build-type: Simple 16 | extra-source-files: 17 | CHANGELOG.md 18 | 19 | source-repository head 20 | type: git 21 | location: https://github.com/sol/hpack 22 | 23 | library 24 | exposed-modules: 25 | Hpack 26 | Hpack.Config 27 | Hpack.Render 28 | Hpack.Yaml 29 | other-modules: 30 | Paths_hpack 31 | hs-source-dirs: 32 | src 33 | ghc-options: -Wall 34 | build-depends: 35 | Cabal >=2.2 36 | , Glob >=0.9.0 37 | , aeson >=1.2.1.0 38 | , base >=4.9 && <5 39 | , bifunctors 40 | , bytestring 41 | , containers 42 | , cryptonite 43 | , deepseq 44 | , directory 45 | , filepath 46 | , http-client 47 | , http-client-tls 48 | , http-types 49 | , infer-license >=0.2.0 && <0.3 50 | , pretty 51 | , scientific 52 | , text 53 | , transformers 54 | , unordered-containers 55 | , vector 56 | , yaml >=0.10.0 57 | default-language: Haskell2010 58 | 59 | executable hpack 60 | main-is: Main.hs 61 | other-modules: 62 | Paths_hpack 63 | hs-source-dirs: 64 | driver 65 | ghc-options: -Wall 66 | build-depends: 67 | Cabal >=2.2 68 | , Glob >=0.9.0 69 | , aeson >=1.2.1.0 70 | , base >=4.9 && <5 71 | , bifunctors 72 | , bytestring 73 | , containers 74 | , cryptonite 75 | , deepseq 76 | , directory 77 | , filepath 78 | , hpack 79 | , http-client 80 | , http-client-tls 81 | , http-types 82 | , infer-license >=0.2.0 && <0.3 83 | , pretty 84 | , scientific 85 | , text 86 | , transformers 87 | , unordered-containers 88 | , vector 89 | , yaml >=0.10.0 90 | default-language: Haskell2010 91 | 92 | test-suite spec 93 | type: exitcode-stdio-1.0 94 | main-is: Spec.hs 95 | other-modules: 96 | Paths_hpack 97 | hs-source-dirs: 98 | test 99 | src 100 | ghc-options: -Wall 101 | cpp-options: -DTEST 102 | build-tool-depends: 103 | hspec-discover:hspec-discover 104 | build-depends: 105 | Cabal >=2.2 106 | , Glob >=0.9.0 107 | , HUnit >=1.6.0.0 108 | , QuickCheck 109 | , aeson >=1.2.1.0 110 | , base >=4.9 && <5 111 | , bifunctors 112 | , bytestring 113 | , containers 114 | , cryptonite 115 | , deepseq 116 | , directory 117 | , filepath 118 | , hspec ==2.* 119 | , http-client 120 | , http-client-tls 121 | , http-types 122 | , infer-license >=0.2.0 && <0.3 123 | , interpolate 124 | , mockery >=0.3 125 | , pretty 126 | , scientific 127 | , template-haskell 128 | , temporary 129 | , text 130 | , transformers 131 | , unordered-containers 132 | , vector 133 | , yaml >=0.10.0 134 | default-language: Haskell2010 135 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.yaml.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from hpack.yaml by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: hpack 8 | version: 0.31.1 9 | synopsis: A modern format for Haskell packages 10 | description: See README at 11 | category: Development 12 | homepage: https://github.com/sol/hpack#readme 13 | bug-reports: https://github.com/sol/hpack/issues 14 | maintainer: Simon Hengel 15 | build-type: Simple 16 | extra-source-files: 17 | CHANGELOG.md 18 | 19 | source-repository head 20 | type: git 21 | location: https://github.com/sol/hpack 22 | 23 | library 24 | exposed-modules: 25 | Hpack 26 | Hpack.Config 27 | Hpack.Render 28 | Hpack.Yaml 29 | other-modules: 30 | Paths_hpack 31 | hs-source-dirs: 32 | src 33 | ghc-options: -Wall 34 | build-depends: 35 | Cabal >=2.2 36 | , Glob >=0.9.0 37 | , aeson >=1.2.1.0 38 | , base >=4.9 && <5 39 | , bifunctors 40 | , bytestring 41 | , containers 42 | , cryptonite 43 | , deepseq 44 | , directory 45 | , filepath 46 | , http-client 47 | , http-client-tls 48 | , http-types 49 | , infer-license >=0.2.0 && <0.3 50 | , pretty 51 | , scientific 52 | , text 53 | , transformers 54 | , unordered-containers 55 | , vector 56 | , yaml >=0.10.0 57 | default-language: Haskell2010 58 | 59 | executable hpack 60 | main-is: Main.hs 61 | other-modules: 62 | Paths_hpack 63 | hs-source-dirs: 64 | driver 65 | ghc-options: -Wall 66 | build-depends: 67 | Cabal >=2.2 68 | , Glob >=0.9.0 69 | , aeson >=1.2.1.0 70 | , base >=4.9 && <5 71 | , bifunctors 72 | , bytestring 73 | , containers 74 | , cryptonite 75 | , deepseq 76 | , directory 77 | , filepath 78 | , hpack 79 | , http-client 80 | , http-client-tls 81 | , http-types 82 | , infer-license >=0.2.0 && <0.3 83 | , pretty 84 | , scientific 85 | , text 86 | , transformers 87 | , unordered-containers 88 | , vector 89 | , yaml >=0.10.0 90 | default-language: Haskell2010 91 | 92 | test-suite spec 93 | type: exitcode-stdio-1.0 94 | main-is: Spec.hs 95 | other-modules: 96 | Paths_hpack 97 | hs-source-dirs: 98 | test 99 | src 100 | ghc-options: -Wall 101 | cpp-options: -DTEST 102 | build-tool-depends: 103 | hspec-discover:hspec-discover 104 | build-depends: 105 | Cabal >=2.2 106 | , Glob >=0.9.0 107 | , HUnit >=1.6.0.0 108 | , QuickCheck 109 | , aeson >=1.2.1.0 110 | , base >=4.9 && <5 111 | , bifunctors 112 | , bytestring 113 | , containers 114 | , cryptonite 115 | , deepseq 116 | , directory 117 | , filepath 118 | , hspec ==2.* 119 | , http-client 120 | , http-client-tls 121 | , http-types 122 | , infer-license >=0.2.0 && <0.3 123 | , interpolate 124 | , mockery >=0.3 125 | , pretty 126 | , scientific 127 | , template-haskell 128 | , temporary 129 | , text 130 | , transformers 131 | , unordered-containers 132 | , vector 133 | , yaml >=0.10.0 134 | default-language: Haskell2010 135 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/hpack/hpack.cabal.golden: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from hpack.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: hpack 8 | version: 0.31.1 9 | synopsis: A modern format for Haskell packages 10 | description: See README at 11 | category: Development 12 | homepage: https://github.com/sol/hpack#readme 13 | bug-reports: https://github.com/sol/hpack/issues 14 | maintainer: Simon Hengel 15 | build-type: Simple 16 | extra-source-files: 17 | CHANGELOG.md 18 | 19 | source-repository head 20 | type: git 21 | location: https://github.com/sol/hpack 22 | 23 | library 24 | exposed-modules: 25 | Hpack 26 | Hpack.Config 27 | Hpack.Render 28 | Hpack.Yaml 29 | other-modules: 30 | Paths_hpack 31 | hs-source-dirs: 32 | src 33 | ghc-options: -Wall 34 | build-depends: 35 | Cabal >=2.2 36 | , Glob >=0.9.0 37 | , aeson >=1.2.1.0 38 | , base >=4.9 && <5 39 | , bifunctors 40 | , bytestring 41 | , containers 42 | , cryptonite 43 | , deepseq 44 | , directory 45 | , filepath 46 | , http-client 47 | , http-client-tls 48 | , http-types 49 | , infer-license >=0.2.0 && <0.3 50 | , pretty 51 | , scientific 52 | , text 53 | , transformers 54 | , unordered-containers 55 | , vector 56 | , yaml >=0.10.0 57 | default-language: Haskell2010 58 | 59 | executable hpack 60 | main-is: Main.hs 61 | other-modules: 62 | Paths_hpack 63 | hs-source-dirs: 64 | driver 65 | ghc-options: -Wall 66 | build-depends: 67 | Cabal >=2.2 68 | , Glob >=0.9.0 69 | , aeson >=1.2.1.0 70 | , base >=4.9 && <5 71 | , bifunctors 72 | , bytestring 73 | , containers 74 | , cryptonite 75 | , deepseq 76 | , directory 77 | , filepath 78 | , hpack 79 | , http-client 80 | , http-client-tls 81 | , http-types 82 | , infer-license >=0.2.0 && <0.3 83 | , pretty 84 | , scientific 85 | , text 86 | , transformers 87 | , unordered-containers 88 | , vector 89 | , yaml >=0.10.0 90 | default-language: Haskell2010 91 | 92 | test-suite spec 93 | type: exitcode-stdio-1.0 94 | main-is: Spec.hs 95 | other-modules: 96 | Paths_hpack 97 | hs-source-dirs: 98 | test 99 | src 100 | ghc-options: -Wall 101 | cpp-options: -DTEST 102 | build-tool-depends: 103 | hspec-discover:hspec-discover 104 | build-depends: 105 | Cabal >=2.2 106 | , Glob >=0.9.0 107 | , HUnit >=1.6.0.0 108 | , QuickCheck 109 | , aeson >=1.2.1.0 110 | , base >=4.9 && <5 111 | , bifunctors 112 | , bytestring 113 | , containers 114 | , cryptonite 115 | , deepseq 116 | , directory 117 | , filepath 118 | , hspec ==2.* 119 | , http-client 120 | , http-client-tls 121 | , http-types 122 | , infer-license >=0.2.0 && <0.3 123 | , interpolate 124 | , mockery >=0.3 125 | , pretty 126 | , scientific 127 | , template-haskell 128 | , temporary 129 | , text 130 | , transformers 131 | , unordered-containers 132 | , vector 133 | , yaml >=0.10.0 134 | default-language: Haskell2010 135 | -------------------------------------------------------------------------------- /package.dhall: -------------------------------------------------------------------------------- 1 | let deps = 2 | [ "aeson" 3 | , "aeson-pretty" 4 | , "base >= 4.13 && < 5" 5 | , "bytestring" 6 | , "dhall >= 1.41.1" 7 | , "dhall-json >= 1.7.10" 8 | , "filepath" 9 | , "hpack ^>= 0.36" 10 | , "megaparsec >= 9.2" 11 | , "microlens" 12 | , "prettyprinter" 13 | , "text" 14 | , "transformers" 15 | , "yaml" 16 | ] 17 | 18 | in let exe-deps = [ "optparse-applicative" ] 19 | 20 | in { name = "hpack-dhall" 21 | , version = "0.5.8" 22 | , maintainer = "Phil de Joux " 23 | , copyright = 24 | "© 2018 - 2024 Phil de Joux, © 2018 - 2024 Block Scope Limited" 25 | , license = "BSD3" 26 | , license-file = "LICENSE" 27 | , category = "Development" 28 | , synopsis = "hpack's dhalling" 29 | , description = 30 | '' 31 | Use hpack phrasing in dhall to write cabal files. 32 | 33 | There are two main reasons why you'd use hpack-dhall, convenience and safety. 34 | 35 | Get the convenience of hpack. Don't bother to state what can be inferred or 36 | defaulted, easing the burden of completing a package description by hand. For 37 | example `other-modules` can be inferred by taking the set difference between 38 | modules on disk and the set of `exposed-modules`. 39 | 40 | Get the safety of dhall's programmable configuration: typed fields, safe imports 41 | and functions. 42 | '' 43 | , github = "cabalism/hpack-dhall" 44 | , tested-with = 45 | "GHC == 9.2.8, GHC == 9.4.8, GHC == 9.6.5, GHC == 9.8.2" 46 | , extra-source-files = 47 | [ "package.dhall" 48 | , "changelog.md" 49 | , "test-suite-golden/**/*.dhall" 50 | , "test-suite-golden/**/*.dhl" 51 | , "test-suite-golden/**/*.cabal" 52 | , "test-suite-golden/**/*.json" 53 | , "test-suite-golden/**/*.yaml" 54 | , "test-suite-golden/**/*.golden" 55 | ] 56 | , ghc-options = 57 | [ "-Wall" 58 | , "-Wincomplete-uni-patterns" 59 | , "-Wcompat" 60 | , "-Widentities" 61 | , "-Wredundant-constraints" 62 | , "-fhide-source-paths" 63 | ] 64 | , dependencies = deps 65 | , source-dirs = "library" 66 | , library.exposed-modules = [ "Hpack.Dhall", "Hpack.Fields" ] 67 | , executables = 68 | { dhall-hpack-cabal = 69 | { main = "CabalMain.hs" 70 | , source-dirs = [ "exe/options", "exe/dhall-hpack-cabal" ] 71 | , dependencies = exe-deps 72 | } 73 | , dhall-hpack-json = 74 | { main = "JsonMain.hs" 75 | , source-dirs = [ "exe/options", "exe/dhall-hpack-json" ] 76 | , dependencies = exe-deps 77 | } 78 | , dhall-hpack-yaml = 79 | { main = "YamlMain.hs" 80 | , source-dirs = [ "exe/options", "exe/dhall-hpack-yaml" ] 81 | , dependencies = exe-deps 82 | } 83 | , dhall-hpack-dhall = 84 | { main = "DhallMain.hs" 85 | , source-dirs = [ "exe/options", "exe/dhall-hpack-dhall" ] 86 | , dependencies = exe-deps 87 | } 88 | } 89 | , tests.golden 90 | = 91 | { main = "Golden.hs" 92 | , source-dirs = [ "test-suite-golden/src" ] 93 | , dependencies = 94 | [ "Cabal" 95 | , "Diff" 96 | , "directory" 97 | , "tasty" 98 | , "tasty-golden" 99 | , "utf8-string" 100 | ] 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `hpack-dhall` 2 | 3 | Use hpack's phrasing in dhall to write cabal files. 4 | 5 | ## Installation 6 | 7 | Install with `cabal install hpack-dhall` or [install from 8 | source](https://github.com/cabalism/hpack-dhall/blob/main/docs/BUILDING.md). 9 | 10 | ## Motivation 11 | 12 | There are two main reasons why you'd use hpack-dhall, convenience and safety. 13 | 14 | Get the convenience of hpack. Don't bother to state what can be inferred or 15 | defaulted, easing the burden of completing a package description by hand. For 16 | example `other-modules` can be inferred by taking the set difference between 17 | modules on disk and the set of `exposed-modules`. 18 | 19 | Get the safety of dhall's programmable configuration: typed fields, safe imports 20 | and functions. 21 | 22 | Another convenience is that files are easily formatted. The cabal file is 23 | formatted on write and the package dhall file can be formatted too with: 24 | 25 | > dhall format --inplace package.dhall 26 | 27 | We use hpack phrasing. The vocabulary of [hpack's 28 | fields](https://github.com/cabalism/hpack#top-level-fields) and values differs only 29 | slightly from [cabal's 30 | properties](https://www.haskell.org/cabal/users-guide/developing-packages.html#package-properties). 31 | They're close Haskell packaging dialects. 32 | 33 | ## Use 34 | 35 | This very package is described in 36 | [`package.dhall`](https://github.com/cabalism/hpack-dhall/blob/main/package.dhall) 37 | and produces 38 | [`hpack-dhall.cabal`](https://github.com/cabalism/hpack-dhall/blob/main/package.dhall) 39 | with the command: 40 | 41 | ``` 42 | > dhall-hpack-cabal 43 | generated hpack-dhall.cabal 44 | ``` 45 | 46 | The generated cabal file can then inform both stack and cabal-install what 47 | modules to package into libraries, executables and test suites. 48 | 49 | There is [more](https://github.com/cabalism/hpack-dhall/blob/main/docs/MORE.md) you can do. 50 | 51 | ## Converting from Hpack's `package.yaml` 52 | 53 | If you use `stack` to generate a `.cabal` file from a `package.yaml` file, you 54 | can also use `hpack` to do the same. The `dhall-hpack-cabal` executable will go 55 | from `.dhall` to `.cabal` but you can use the `dhall-hpack-yaml` executable to 56 | generate `package.yaml` from a `package.dhall`. That's how we'll manage the 57 | conversion. 58 | 59 | If you already have a `package.yaml` file then you can rename this as 60 | `package.dhall`, do the conversion to `.dhall` syntax manually, run `dhall 61 | format package.dhall` to catch syntax errors and then run `dhall-hpack-yaml > 62 | package.yaml` and keep iterating until the generated `package.yaml` is as close 63 | to the original as you need it to be, using something like `git diff` to check 64 | for differences. 65 | 66 | ## Converting from Cabal's `.cabal` 67 | 68 | It will be harder to write a `package.dhall` file from scratch than it is to 69 | convert from a `package.yaml` file but it is doable. All of the field names in 70 | `.dhall` are the same as for `.yaml`. Start small and keep iterating with 71 | `dhall-hpack-cabal` until the generated `.cabal` file is like the original. You 72 | may need to go back to the original to change the formatting and reorder fields 73 | to make comparisons with the generated `.cabal` file easier. 74 | 75 | ## Source Control 76 | 77 | Value the dhall file as a way to produce the cabal file. If both files are be 78 | checked into source control but the cabal file gets ahead of the dhall file then 79 | it should be possible to get them in sync again. 80 | 81 | ## Status 82 | ![cabal](https://github.com/BlockScope/hpack-dhall/workflows/cabal/badge.svg) 83 | ![stack](https://github.com/BlockScope/hpack-dhall/workflows/stack/badge.svg) 84 | [![hackage release](https://img.shields.io/hackage/v/hpack-dhall.svg?label=hackage)](http://hackage.haskell.org/package/hpack-dhall) 85 | [![Dependencies of latest version on Hackage](https://img.shields.io/hackage-deps/v/hpack-dhall.svg)](https://hackage.haskell.org/package/hpack-dhall) 86 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # NOTE: Dependencies are intentionally not listed. 2 | 3 | .PHONY: delete-golden 4 | delete-golden: \ 5 | delete-cabal-golden \ 6 | delete-json-golden \ 7 | delete-yaml-golden 8 | 9 | .PHONY: delete-cabal-golden 10 | delete-cabal-golden: 11 | cd test-suite-golden \ 12 | && find -type f \ 13 | | grep --perl-regexp ".*\.cabal\.golden$$" \ 14 | | xargs --no-run-if-empty --max-args=1 --verbose rm 15 | 16 | .PHONY: delete-json-golden 17 | delete-json-golden: 18 | cd test-suite-golden \ 19 | && find -type f \ 20 | | grep --perl-regexp ".*\.json\.golden$$" \ 21 | | xargs --no-run-if-empty --max-args=1 --verbose rm 22 | 23 | .PHONY: delete-yaml-golden 24 | delete-yaml-golden: 25 | cd test-suite-golden \ 26 | && find -type f \ 27 | | grep --perl-regexp ".*\.yaml\.golden$$" \ 28 | | xargs --no-run-if-empty --max-args=1 --verbose rm 29 | 30 | .PHONY: delete-generated 31 | .PHONY: delete-generated-cabal 32 | .PHONY: delete-generated-json 33 | .PHONY: delete-generated-yaml 34 | delete-generated: \ 35 | delete-generated-cabal \ 36 | delete-generated-json \ 37 | delete-generated-yaml 38 | 39 | delete-generated-cabal: 40 | cd test-suite-golden \ 41 | && find -type f \ 42 | | grep --perl-regexp ".*(? $@ 101 | 102 | $(KY)/when-dependencies.json: 103 | dhall-hpack-json --package-dhall=$(@:.json=.dhall) > $@ 104 | 105 | $(KY)/with-GHC2021.json: 106 | dhall-hpack-json --package-dhall=$(@:.json=.dhall) > $@ 107 | 108 | $(KY)/%/package.json: 109 | cd $(@D) && dhall-hpack-json > $(@F) 110 | 111 | $(RW)/%.json: 112 | dhall-hpack-json --package-dhall=$(@:.json=.dhall) > $@ 113 | 114 | .PHONY: generate-yaml 115 | generate-yaml: \ 116 | $(KY)/empty-inferred/package.yaml \ 117 | $(KY)/empty-package.yaml \ 118 | $(KY)/with-GHC2021.yaml \ 119 | $(KY)/when-dependencies.yaml \ 120 | $(KY)/import-relative/package.yaml \ 121 | $(KY)/import-local/package.yaml \ 122 | $(KY)/empty-inferred/package.yaml \ 123 | $(RW)/stack/stack.yaml \ 124 | $(RW)/hpack/hpack.yaml 125 | 126 | $(KY)/empty-package.yaml: 127 | dhall-hpack-yaml --package-dhall=$(@:.yaml=.dhall) > $@ 128 | 129 | $(KY)/when-dependencies.yaml: 130 | dhall-hpack-yaml --package-dhall=$(@:.yaml=.dhall) > $@ 131 | 132 | $(KY)/with-GHC2021.yaml: 133 | dhall-hpack-yaml --package-dhall=$(@:.yaml=.dhall) > $@ 134 | 135 | $(KY)/%/package.yaml: 136 | cd $(@D) && dhall-hpack-yaml > $(@F) 137 | 138 | $(RW)/%.yaml: 139 | dhall-hpack-yaml --package-dhall=$(@:.yaml=.dhall) > $@ 140 | -------------------------------------------------------------------------------- /docs/MORE.md: -------------------------------------------------------------------------------- 1 | 2 | # More Uses 3 | 4 | Aside from `dhall-hpack-cabal`, three other executables are bundled with this 5 | package. If you're migrating from hpack to hpack-dhall but don't have a source 6 | controlled cabal file then `dhall-hpack-yaml` can be used to generate a 7 | package.yaml. If for some reason you want JSON, then `dhall-hpack-json` does 8 | that. For seeing dhall with imports resolved there's `dhall-hpack-dhall`. 9 | 10 | ## Configure Linting Extensions 11 | 12 | By using imports and functions we can do more than just create a cabal file. We 13 | can configure extensions for linting: 14 | 15 | ``` 16 | > cat default-extensions.dhall 17 | { default-extensions = 18 | [ "DataKinds" 19 | , "DeriveFunctor" 20 | ... 21 | , "TupleSections" 22 | , "UndecidableInstances" 23 | ] 24 | } 25 | 26 | > cat hlint.dhall 27 | let Prelude/List/map = 28 | https://raw.githubusercontent.com/dhall-lang/Prelude/35deff0d41f2bf86c42089c6ca16665537f54d75/List/map 29 | 30 | in let defs = ./default-extensions.dhall 31 | 32 | in let f = λ(s : Text) → "-X" ++ s 33 | 34 | in { arguments = Prelude/List/map Text Text f defs.default-extensions } 35 | 36 | > dhall-to-yaml < ./hlint.dhall > ./.hlint.yaml 37 | 38 | > cat .hlint.yaml 39 | arguments: 40 | - -XDataKinds 41 | - -XDeriveFunctor 42 | ... 43 | - -XTupleSections 44 | - -XUndecidableInstances 45 | ``` 46 | 47 | We can pull those same `default-extensions` into a package description: 48 | 49 | ``` 50 | > cat package.dhall 51 | let defs = ./defaults.dhall 52 | 53 | in defs 54 | ⫽ ./default-extensions.dhall 55 | ⫽ { name = 56 | "flight-units" 57 | ... 58 | , github = 59 | "blockscope/flare-timing/units" 60 | ... 61 | , dependencies = 62 | defs.dependencies 63 | # [ "numbers" 64 | , "fixed" 65 | , "bifunctors" 66 | , "text" 67 | , "formatting" 68 | , "uom-plugin" 69 | , "siggy-chardust" 70 | ] 71 | ... 72 | } 73 | ``` 74 | 75 | ## Conditional Restrictions 76 | 77 | Using hpack's [conditionals](https://github.com/sol/hpack#conditionals) in 78 | a list in `package.dhall` can cause an error because lists in dhall must have 79 | elements of the same type: 80 | 81 | ``` 82 | # package.yaml 83 | executables: 84 | stack: 85 | main: Main.hs 86 | source-dirs: src/main 87 | generated-other-modules: 88 | - Build_stack 89 | - Paths_stack 90 | ghc-options: 91 | - -threaded 92 | - -rtsopts 93 | dependencies: 94 | - stack 95 | when: 96 | - condition: flag(static) 97 | ld-options: 98 | - -static 99 | - -pthread 100 | - condition: ! '!(flag(disable-git-info))' 101 | cpp-options: -DUSE_GIT_INFO 102 | dependencies: 103 | - githash 104 | - optparse-simple 105 | - condition: flag(hide-dependency-versions) 106 | cpp-options: -DHIDE_DEP_VERSIONS 107 | - condition: flag(supported-build) 108 | cpp-options: -DSUPPORTED_BUILD 109 | ``` 110 | 111 | This can be represented as: 112 | ``` 113 | # package.dhall 114 | , executables = 115 | { stack = 116 | { main = 117 | "Main.hs" 118 | , source-dirs = 119 | [ "src/main" ] 120 | , generated-other-modules = 121 | [ "Build_stack", "Paths_stack" ] 122 | , ghc-options = 123 | [ "-threaded", "-rtsopts" ] 124 | , dependencies = 125 | [ "stack" ] 126 | , when = 127 | [ { condition = 128 | "flag(static)" 129 | , cpp-options = 130 | [] : List Text 131 | , dependencies = 132 | [] : List Text 133 | , ld-options = 134 | [ "-static", "-pthread" ] 135 | } 136 | , { condition = 137 | "!(flag(disable-git-info))" 138 | , cpp-options = 139 | [ "-DUSE_GIT_INFO" ] 140 | , dependencies = 141 | [ "githash", "optparse-simple" ] 142 | , ld-options = 143 | [] : List Text 144 | } 145 | , { condition = 146 | "flag(hide-dependency-versions)" 147 | , cpp-options = 148 | [ "-DHIDE_DEP_VERSIONS" ] 149 | , dependencies = 150 | [] : List Text 151 | , ld-options = 152 | [] : List Text 153 | } 154 | , { condition = 155 | "flag(supported-build)" 156 | , cpp-options = 157 | [ "-DSUPPORTED_BUILD" ] 158 | , dependencies = 159 | [] : List Text 160 | , ld-options = 161 | [] : List Text 162 | } 163 | ] 164 | } 165 | } 166 | ``` 167 | -------------------------------------------------------------------------------- /library/Hpack/Fields.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | {-# LANGUAGE MultiWayIf #-} 3 | {-# OPTIONS_HADDOCK ignore-exports #-} 4 | 5 | module Hpack.Fields (cmp) where 6 | 7 | import Data.Maybe (fromMaybe) 8 | import Data.List (elemIndex) 9 | import Data.String (IsString()) 10 | import Control.Applicative (liftA2) 11 | import Data.Foldable (asum) 12 | 13 | -- | A default field ordering comparison. 14 | cmp :: (Ord a, IsString a) => a -> a -> Ordering 15 | cmp a b = 16 | fromMaybe fallback 17 | . asum 18 | $ [ liftA2 compare (elemIndex a xs) (elemIndex b xs) | xs <- fields ] 19 | where 20 | -- NOTE: There can be short form conditions with no then or else. In 21 | -- that case always put condition before the other field name. 22 | fallback = 23 | if | a == "condition" -> LT 24 | | b == "condition" -> GT 25 | | elem a topLevelFields -> LT 26 | | elem b topLevelFields -> GT 27 | | otherwise -> a `compare` b 28 | 29 | fields = 30 | [ topLevelFields 31 | , libraryFields ++ commonFields 32 | , runnableFields ++ commonFields 33 | , flagFields 34 | , conditionalFields 35 | , defaultsFields 36 | ] 37 | 38 | -- | All fields combined. 39 | topLevelFields :: IsString a => [a] 40 | topLevelFields = 41 | headerFields 42 | ++ repoFields 43 | ++ packageFields 44 | ++ commonFields 45 | ++ stanzasFields 46 | 47 | -- | The header subset of 48 | -- fields. 49 | headerFields :: IsString a => [a] 50 | headerFields = 51 | [ "spec-version" 52 | , "name" 53 | , "version" 54 | , "synopsis" 55 | , "description" 56 | , "category" 57 | , "stability" 58 | , "homepage" 59 | , "bug-reports" 60 | , "author" 61 | , "maintainer" 62 | , "copyright" 63 | , "license" 64 | , "license-file" 65 | , "license-files" 66 | , "tested-with" 67 | , "build-type" 68 | ] 69 | 70 | -- | The package subset of 71 | -- fields. 72 | packageFields :: IsString a => [a] 73 | packageFields = 74 | [ "extra-source-files" 75 | , "extra-doc-files" 76 | , "data-files" 77 | , "data-dir" 78 | ] 79 | 80 | -- | The source repository subset of 81 | -- fields. 82 | repoFields :: IsString a => [a] 83 | repoFields = 84 | [ "github" 85 | , "git" 86 | ] 87 | 88 | -- | The stanzas subset of 89 | -- fields. 90 | stanzasFields :: IsString a => [a] 91 | stanzasFields = 92 | [ "custom-setup" 93 | , "flags" 94 | , "library" 95 | , "internal-libraries" 96 | , "executables" 97 | , "executable" 98 | , "tests" 99 | , "benchmarks" 100 | , "defaults" 101 | ] 102 | 103 | -- | The fields. 104 | commonFields :: IsString a => [a] 105 | commonFields = 106 | [ "buildable" 107 | , "source-dirs" 108 | , "default-extensions" 109 | , "other-extensions" 110 | , "ghc-options" 111 | , "ghc-prof-options" 112 | , "ghcjs-options" 113 | , "cpp-options" 114 | , "cc-options" 115 | , "c-sources" 116 | , "cxx-options" 117 | , "cxx-sources" 118 | , "js-sources" 119 | , "extra-lib-dirs" 120 | , "extra-libraries" 121 | , "include-dirs" 122 | , "install-includes" 123 | , "frameworks" 124 | , "extra-framework-dirs" 125 | , "ld-options" 126 | , "dependencies" 127 | , "pkg-config-depends" 128 | , "build-tools" 129 | , "system-build-tools" 130 | , "when" -- conditional 131 | ] 132 | 133 | 134 | -- | The fields. 135 | libraryFields :: IsString a => [a] 136 | libraryFields = 137 | [ "exposed" 138 | , "exposed-modules" 139 | , "generated-exposed-modules" 140 | , "other-modules" 141 | , "generated-other-modules" 142 | , "reexported-modules" 143 | , "signatures" 144 | ] 145 | 146 | -- | The , 147 | -- and 148 | -- fields are all the 149 | -- same. 150 | runnableFields :: IsString a => [a] 151 | runnableFields = 152 | [ "main" 153 | , "other-modules" 154 | , "generated-other-modules" 155 | ] 156 | 157 | -- | The fields. 158 | flagFields :: IsString a => [a] 159 | flagFields = 160 | [ "description" 161 | , "manual" 162 | , "default" 163 | ] 164 | 165 | -- | The fields. 166 | conditionalFields :: IsString a => [a] 167 | conditionalFields = 168 | [ "condition" 169 | , "then" 170 | , "else" 171 | ] 172 | 173 | -- | The fields. 174 | defaultsFields :: IsString a => [a] 175 | defaultsFields = 176 | [ "github" 177 | , "ref" 178 | , "path" 179 | , "local" 180 | ] 181 | -------------------------------------------------------------------------------- /library/Hpack/Dhall.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TupleSections #-} 2 | 3 | {-| 4 | Module: Hpack.Dhall 5 | Copyright: 6 | © 2018 - 2021 Phil de Joux 7 | © 2018 - 2021 Block Scope Limited 8 | License: BSD3 9 | Maintainer: Phil de Joux 10 | Stability: experimental 11 | The functions in this module make it possible to configure an 12 | 13 | package description with 14 | 15 | instead of 16 | . 17 | When doing so, note that all functions resolve imports relative to the location 18 | of the given @.dhall@ input file. 19 | -} 20 | module Hpack.Dhall 21 | ( fileToJson 22 | , showJson 23 | , showYaml 24 | , showDhall 25 | , packageConfig 26 | ) where 27 | 28 | import Data.Void (Void) 29 | import Data.Maybe (fromMaybe) 30 | import Data.Function ((&)) 31 | import Lens.Micro ((^.), set) 32 | import System.FilePath (takeDirectory) 33 | import Control.Exception (throwIO) 34 | import Control.Monad.Trans.Except (ExceptT(..), runExceptT) 35 | import Control.Monad.IO.Class (liftIO) 36 | import qualified Control.Monad.Trans.State.Strict as State 37 | import Data.Bifunctor (first) 38 | import Data.Aeson (ToJSON, Value) 39 | import qualified Data.ByteString.Lazy as BSL (toStrict) 40 | import Data.Text.Encoding (decodeUtf8) 41 | import qualified Data.Text as T (Text, unpack) 42 | import qualified Data.Text.IO as T (readFile) 43 | import Dhall 44 | ( InputSettings, Text 45 | , rootDirectory, sourceName, defaultInputSettings 46 | ) 47 | import Dhall.Core (Expr) 48 | import Dhall.Parser (Src, exprFromText) 49 | import Dhall.Import (loadWith, emptyStatus) 50 | import Dhall.TypeCheck (typeOf) 51 | import Dhall.JSON (dhallToJSON, omitNull) 52 | import Dhall.Pretty (prettyExpr, layoutOpts) 53 | import qualified Prettyprinter as PP 54 | import qualified Prettyprinter.Render.Text as PP 55 | import qualified Data.Yaml.Pretty as Y 56 | import qualified Data.Aeson.Encode.Pretty as A 57 | import Hpack.Fields (cmp) 58 | 59 | -- SEE: http://onoffswitch.net/adventures-pretty-printing-json-haskell/ 60 | getJson :: ToJSON a => (Text -> Text -> Ordering) -> a -> String 61 | getJson cmp' = 62 | let cfg = A.defConfig {A.confCompare = cmp'} 63 | in T.unpack . decodeUtf8 . BSL.toStrict . A.encodePretty' cfg 64 | 65 | getYaml :: ToJSON a => (Text -> Text -> Ordering) -> a -> String 66 | getYaml cmp' = 67 | let cfg = Y.setConfCompare cmp' Y.defConfig 68 | in T.unpack . decodeUtf8 . Y.encodePretty cfg 69 | 70 | -- | The default package file name is @package.dhall@. 71 | packageConfig :: FilePath 72 | packageConfig = "package.dhall" 73 | 74 | -- | Pretty prints JSON for the package description. 75 | showJson 76 | :: Maybe (Text -> Text -> Ordering) 77 | -- ^ An ordering of JSON fields. 78 | -> FilePath 79 | -- ^ Path to a @.dhall@ file 80 | -> IO String 81 | showJson fieldOrdering file = do 82 | x <- fileToJson file 83 | return $ case x of 84 | Left err -> err 85 | Right (_, v) -> getJson (fromMaybe cmp fieldOrdering) v 86 | 87 | -- | Pretty prints YAML for the package description. 88 | showYaml 89 | :: Maybe (Text -> Text -> Ordering) 90 | -- ^ An ordering of YAML fields. 91 | -> FilePath 92 | -- ^ Path to a @.dhall@ file 93 | -> IO String 94 | showYaml fieldOrdering file = do 95 | x <- fileToJson file 96 | return $ case x of 97 | Left err -> err 98 | Right (_, v) -> getYaml (fromMaybe cmp fieldOrdering) v 99 | 100 | -- | Pretty prints the package description Dhall expression, resolving imports 101 | -- relative to the location of the @.dhall@ file. 102 | showDhall 103 | :: FilePath -- ^ Path to a @.dhall@ file 104 | -> IO String 105 | showDhall file = do 106 | text <- T.readFile file 107 | expr <- check (inputSettings file) text 108 | return . T.unpack $ renderDhall expr 109 | 110 | -- | A file decoder for hpack. This should evaluate to a single record with 111 | -- hpack's top-level . 112 | fileToJson 113 | :: FilePath -- ^ Path to a @.dhall@ file 114 | -> IO (Either String ([String], Value)) 115 | fileToJson file = 116 | liftIO (T.readFile file) 117 | >>= textToJson (inputSettings file) 118 | 119 | inputSettings :: FilePath -> InputSettings 120 | inputSettings file = 121 | Dhall.defaultInputSettings 122 | & set rootDirectory (takeDirectory file) 123 | & set sourceName file 124 | 125 | textToJson 126 | :: InputSettings 127 | -> T.Text 128 | -> IO (Either String ([String], Value)) 129 | textToJson settings text = runExceptT $ do 130 | expr <- liftIO $ check settings text 131 | _ <- liftResult $ typeOf expr 132 | liftResult $ ([],) . omitNull <$> dhallToJSON expr 133 | where 134 | liftResult :: (Show b, Monad m) => Either b a -> ExceptT String m a 135 | liftResult = ExceptT . return . first show 136 | 137 | check :: InputSettings -> Text -> IO (Expr Src Void) 138 | check settings text = do 139 | expr <- either throwIO return $ exprFromText mempty text 140 | State.evalStateT (loadWith expr) (emptyStatus $ settings ^. rootDirectory) 141 | 142 | -- SEE: https://github.com/mstksg/hakyll-dhall 143 | renderDhall :: PP.Pretty a => Expr Src a -> T.Text 144 | renderDhall = 145 | PP.renderStrict 146 | . PP.layoutSmart layoutOpts 147 | . PP.unAnnotate 148 | . prettyExpr 149 | -------------------------------------------------------------------------------- /test-suite-golden/src/Golden.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiWayIf, LambdaCase, CPP #-} 2 | 3 | module Main (main) where 4 | 5 | import System.FilePath 6 | ( (), (<.>), (-<.>) 7 | , takeBaseName, replaceExtension 8 | , takeDirectory, splitDirectories, joinPath 9 | ) 10 | import System.Directory (renameFile) 11 | import Test.Tasty (defaultMain, TestTree, testGroup) 12 | import Test.Tasty.Golden (findByExtension, goldenVsFile, goldenVsString) 13 | 14 | import Hpack (Verbose(..), Options(..), hpack, defaultOptions, setDecode) 15 | import Hpack.Config (DecodeOptions(..)) 16 | import Hpack.Dhall (fileToJson, showDhall, showJson, showYaml) 17 | import Data.ByteString.Lazy.UTF8 (fromString) 18 | 19 | data Out = Cabal | Dhall | Json | Yaml 20 | 21 | main :: IO () 22 | main = defaultMain =<< goldenTests 23 | 24 | goldExt :: Out -> FilePath 25 | goldExt = 26 | \case 27 | Cabal -> ".cabal.golden" 28 | 29 | Dhall -> 30 | let d = 31 | #if MIN_VERSION_dhall (1, 34, 0) 32 | ".dhall-1.34" 33 | #elif MIN_VERSION_dhall (1, 32, 0) 34 | ".dhall-1.32" 35 | #else 36 | ".dhall" 37 | #endif 38 | 39 | in d <> ".golden" 40 | 41 | Json -> ".json.golden" 42 | Yaml -> ".yaml.golden" 43 | 44 | goldenTests :: IO TestTree 45 | goldenTests = do 46 | ks <- findByExtension [".dhall"] "test-suite-golden/test-files/key" 47 | rs <- findByExtension [".dhall"] "test-suite-golden/test-files/real-world" 48 | g1 <- goldenTestSet "archetypes" ks 49 | g2 <- goldenTestSet "real-world examples" rs 50 | return $ testGroup "golden tests" [g1 , g2] 51 | 52 | goldenTestSet :: String -> [FilePath] -> IO TestTree 53 | goldenTestSet title dhallFiles = do 54 | return $ testGroup title 55 | [ testGroup ".dhall to .cabal" 56 | [ goldenVsFile 57 | (testName dhallFile) 58 | goldenFile 59 | cabalFile 60 | (writeDhallCabal dhallFile) 61 | | dhallFile <- dhallFiles 62 | , let cabalFile = cabalFilePath dhallFile 63 | , let goldenFile = cabalFile -<.> goldExt Cabal 64 | ] 65 | , testGroup ".dhall to dhall" 66 | [ goldenVsString 67 | (testName dhallFile) 68 | goldenFile 69 | (fmap fromString . showDhall $ dhallFile) 70 | | dhallFile <- dhallFiles 71 | , let goldenFile = dhallFile -<.> goldExt Dhall 72 | ] 73 | , testGroup ".dhall to json" 74 | [ goldenVsFile 75 | (testName dhallFile) 76 | goldenFile 77 | jsonFile 78 | (writeJson dhallFile jsonFile) 79 | | dhallFile <- dhallFiles 80 | , let jsonFile = dhallFile -<.> ".json" 81 | , let goldenFile = dhallFile -<.> goldExt Json 82 | ] 83 | , testGroup ".dhall to yaml" 84 | [ goldenVsFile 85 | (testName dhallFile) 86 | goldenFile 87 | yamlFile 88 | (writeYaml dhallFile yamlFile) 89 | | dhallFile <- dhallFiles 90 | , let yamlFile = dhallFile -<.> ".yaml" 91 | , let goldenFile = dhallFile -<.> goldExt Yaml 92 | ] 93 | , testGroup ".yaml to .cabal" 94 | [ goldenVsFile 95 | (testName dhallFile) 96 | goldenFile 97 | cabalFile 98 | (writeYamlCabal yamlFile cabalFile yamlCabalFile) 99 | | dhallFile <- dhallFiles 100 | , let yamlFile = dhallFile -<.> ".yaml" 101 | , let cabalFile = cabalFilePath dhallFile 102 | , let yamlCabalFile = yamlFile <.> ".cabal" 103 | , let goldenFile = cabalFile -<.> goldExt Cabal 104 | ] 105 | ] 106 | 107 | testName :: FilePath -> FilePath 108 | testName p = 109 | if | fName == dName -> fName 110 | | fName == "package" -> dName 111 | | dName == "key" -> fName 112 | | dName == "real-world" -> fName 113 | | otherwise -> dName fName 114 | where 115 | dName = 116 | joinPath 117 | . take 1 118 | . reverse 119 | . splitDirectories 120 | . takeDirectory 121 | $ p 122 | 123 | fName = takeBaseName p 124 | 125 | writeDhallCabal :: FilePath -> IO () 126 | writeDhallCabal dhallFile = 127 | hpack NoVerbose (setDecode fileToJson options) 128 | where 129 | d = optionsDecodeOptions defaultOptions 130 | d' = d {decodeOptionsTarget = dhallFile} 131 | options = defaultOptions {optionsDecodeOptions = d'} 132 | 133 | writeYamlCabal :: FilePath -> FilePath -> FilePath -> IO () 134 | writeYamlCabal yamlFile cabalFile yamlCabalFile = do 135 | renameFile cabalFile tmp 136 | hpack NoVerbose options 137 | renameFile cabalFile yamlCabalFile 138 | renameFile tmp cabalFile 139 | where 140 | tmp = cabalFile <.> ".TMP" 141 | 142 | d = optionsDecodeOptions defaultOptions 143 | d' = d {decodeOptionsTarget = yamlFile} 144 | options = 145 | defaultOptions 146 | { optionsDecodeOptions = d' 147 | } 148 | 149 | writeJson :: FilePath -> FilePath -> IO () 150 | writeJson dhallFile jsonFile = do 151 | s <- showJson Nothing dhallFile 152 | writeFile jsonFile s 153 | appendFile jsonFile $ unlines [""] 154 | 155 | writeYaml :: FilePath -> FilePath -> IO () 156 | writeYaml dhallFile yamlFile = do 157 | s <- showYaml Nothing dhallFile 158 | writeFile yamlFile s 159 | appendFile yamlFile $ unlines [""] 160 | 161 | cabalFilePath :: FilePath -> FilePath 162 | cabalFilePath p 163 | | takeBaseName p == "package" = 164 | case reverse . splitDirectories $ ds of 165 | d : ds' -> joinPath (reverse ds') d d <.> ".cabal" 166 | _ -> replaceExtension p ".cabal" 167 | 168 | | otherwise = 169 | replaceExtension p ".cabal" 170 | 171 | where 172 | ds = takeDirectory p 173 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/package.yaml: -------------------------------------------------------------------------------- 1 | name: stack 2 | version: '1.10.0' 3 | synopsis: The Haskell Tool Stack 4 | description: ! 'Please see the README.md for usage information, and 5 | the wiki on Github for more details. Also, note that 6 | the API for the library is not currently stable, and may 7 | change significantly, even between minor releases. It is 8 | currently only intended for use by the executable.' 9 | category: Development 10 | author: Commercial Haskell SIG 11 | maintainer: manny@fpcomplete.com 12 | license: BSD3 13 | github: commercialhaskell/stack 14 | homepage: http://haskellstack.org 15 | custom-setup: 16 | dependencies: 17 | - base >=4.10 && < 5 18 | - Cabal >= 2.4 19 | - filepath 20 | extra-source-files: 21 | # note: leaving out 'package.yaml' because it causes confusion with hackage metadata revisions 22 | - CONTRIBUTING.md 23 | - ChangeLog.md 24 | - README.md 25 | - doc/*.md 26 | - src/setup-shim/StackSetupShim.hs 27 | - stack.yaml 28 | - test/package-dump/ghc-7.10.txt 29 | - test/package-dump/ghc-7.8.4-osx.txt 30 | - test/package-dump/ghc-7.8.txt 31 | ghc-options: 32 | - -Wall 33 | - -fwarn-tabs 34 | - -fwarn-incomplete-uni-patterns 35 | - -fwarn-incomplete-record-updates 36 | - -optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue #4739 · haskell/cabal](https://github.com/haskell/cabal/issues/4739) 37 | dependencies: 38 | - Cabal >= 2.4 39 | - aeson 40 | - annotated-wl-pprint 41 | - ansi-terminal >= 0.8.1 42 | - array 43 | - async 44 | - attoparsec 45 | - base >=4.10 && < 5 46 | - base64-bytestring 47 | - bytestring 48 | - colour 49 | - conduit 50 | - conduit-extra 51 | - containers 52 | - cryptonite 53 | - cryptonite-conduit 54 | - deepseq 55 | - directory 56 | - echo 57 | - exceptions 58 | - extra 59 | - file-embed 60 | - filelock 61 | - filepath 62 | - fsnotify 63 | - generic-deriving 64 | - hackage-security 65 | - hashable 66 | - hpack 67 | - hpc 68 | - http-client 69 | - http-client-tls 70 | - http-conduit 71 | - http-types 72 | - memory 73 | - microlens 74 | - mintty 75 | # TODO remove dep when persistent drops monad-logger 76 | - monad-logger 77 | - mono-traversable 78 | - mtl 79 | - mustache 80 | - neat-interpolation 81 | - network-uri 82 | - open-browser 83 | - optparse-applicative 84 | - pantry 85 | - path 86 | - path-io 87 | - persistent 88 | - persistent-sqlite 89 | - persistent-template 90 | - pretty 91 | - primitive 92 | - process 93 | - project-template 94 | - regex-applicative-text 95 | - resourcet 96 | - retry >= 0.7 97 | - rio 98 | - semigroups 99 | - split 100 | - stm 101 | - store-core # FIXME remove 102 | - streaming-commons 103 | - tar 104 | - template-haskell 105 | - temporary 106 | - text 107 | - text-metrics 108 | - th-reify-many 109 | - time 110 | - tls 111 | - transformers 112 | - typed-process 113 | - unicode-transforms 114 | - unix-compat 115 | - unliftio >= 0.2.8.0 116 | - unordered-containers 117 | - vector 118 | - yaml 119 | - zip-archive 120 | - zlib 121 | when: 122 | - condition: os(windows) 123 | then: 124 | cpp-options: -DWINDOWS 125 | dependencies: 126 | - Win32 127 | else: 128 | build-tools: 129 | - hsc2hs 130 | dependencies: 131 | - unix 132 | library: 133 | source-dirs: src/ 134 | ghc-options: 135 | - -fwarn-identities 136 | generated-exposed-modules: 137 | - Paths_stack 138 | exposed-modules: 139 | - Control.Concurrent.Execute 140 | - Data.Attoparsec.Args 141 | - Data.Attoparsec.Combinators 142 | - Data.Attoparsec.Interpreter 143 | - Data.Monoid.Map 144 | - Network.HTTP.Download 145 | - Network.HTTP.Download.Verified 146 | - Network.HTTP.StackClient 147 | - Options.Applicative.Args 148 | - Options.Applicative.Builder.Extra 149 | - Options.Applicative.Complicated 150 | - Path.CheckInstall 151 | - Path.Extra 152 | - Path.Find 153 | - Stack.Build 154 | - Stack.Build.Cache 155 | - Stack.Build.ConstructPlan 156 | - Stack.Build.Execute 157 | - Stack.Build.Haddock 158 | - Stack.Build.Installed 159 | - Stack.Build.Source 160 | - Stack.Build.Target 161 | - Stack.BuildPlan 162 | - Stack.Clean 163 | - Stack.Config 164 | - Stack.Config.Build 165 | - Stack.Config.Urls 166 | - Stack.Config.Docker 167 | - Stack.Config.Nix 168 | - Stack.ConfigCmd 169 | - Stack.Constants 170 | - Stack.Constants.Config 171 | - Stack.Coverage 172 | - Stack.DefaultColorWhen 173 | - Stack.DefaultStyles 174 | - Stack.Docker 175 | - Stack.Docker.GlobalDB 176 | - Stack.Dot 177 | - Stack.FileWatch 178 | - Stack.Freeze 179 | - Stack.GhcPkg 180 | - Stack.Ghci 181 | - Stack.Ghci.Script 182 | - Stack.Hoogle 183 | - Stack.IDE 184 | - Stack.Image 185 | - Stack.Init 186 | - Stack.Ls 187 | - Stack.New 188 | - Stack.Nix 189 | - Stack.Options.BenchParser 190 | - Stack.Options.BuildMonoidParser 191 | - Stack.Options.BuildParser 192 | - Stack.Options.CleanParser 193 | - Stack.Options.ConfigParser 194 | - Stack.Options.Completion 195 | - Stack.Options.DockerParser 196 | - Stack.Options.DotParser 197 | - Stack.Options.ExecParser 198 | - Stack.Options.FreezeParser 199 | - Stack.Options.GhcBuildParser 200 | - Stack.Options.GhciParser 201 | - Stack.Options.GhcVariantParser 202 | - Stack.Options.GlobalParser 203 | - Stack.Options.HaddockParser 204 | - Stack.Options.HpcReportParser 205 | - Stack.Options.LogLevelParser 206 | - Stack.Options.NewParser 207 | - Stack.Options.NixParser 208 | - Stack.Options.PackageParser 209 | - Stack.Options.ResolverParser 210 | - Stack.Options.ScriptParser 211 | - Stack.Options.SDistParser 212 | - Stack.Options.SolverParser 213 | - Stack.Options.TestParser 214 | - Stack.Options.Utils 215 | - Stack.Package 216 | - Stack.PackageDump 217 | - Stack.Path 218 | - Stack.Prelude 219 | - Stack.PrettyPrint 220 | - Stack.Runners 221 | - Stack.Script 222 | - Stack.SDist 223 | - Stack.Setup 224 | - Stack.Setup.Installed 225 | - Stack.SetupCmd 226 | - Stack.Sig 227 | - Stack.Sig.GPG 228 | - Stack.Sig.Sign 229 | - Stack.Snapshot 230 | - Stack.Solver 231 | - Stack.StoreTH 232 | - Stack.Types.Build 233 | - Stack.Types.BuildPlan 234 | - Stack.Types.CompilerBuild 235 | - Stack.Types.Urls 236 | - Stack.Types.Compiler 237 | - Stack.Types.Config 238 | - Stack.Types.Config.Build 239 | - Stack.Types.Docker 240 | - Stack.Types.GhcPkgId 241 | - Stack.Types.Image 242 | - Stack.Types.NamedComponent 243 | - Stack.Types.Nix 244 | - Stack.Types.Package 245 | - Stack.Types.PackageDump 246 | - Stack.Types.PackageName 247 | - Stack.Types.PrettyPrint 248 | - Stack.Types.Resolver 249 | - Stack.Types.Runner 250 | - Stack.Types.Sig 251 | - Stack.Types.StylesUpdate 252 | - Stack.Types.TemplateName 253 | - Stack.Types.Version 254 | - Stack.Types.VersionIntervals 255 | - Stack.Unpack 256 | - Stack.Upgrade 257 | - Stack.Upload 258 | - Text.PrettyPrint.Leijen.Extended 259 | - System.Permissions 260 | - System.Process.PagerEditor 261 | - System.Terminal 262 | when: 263 | - condition: 'os(windows)' 264 | then: 265 | source-dirs: src/windows/ 266 | else: 267 | source-dirs: src/unix/ 268 | c-sources: src/unix/cbits/uname.c 269 | executables: 270 | stack: 271 | main: Main.hs 272 | source-dirs: src/main 273 | generated-other-modules: 274 | - Build_stack, 275 | - Paths_stack 276 | ghc-options: 277 | - -threaded 278 | - -rtsopts 279 | dependencies: 280 | - stack 281 | when: 282 | - condition: flag(static) 283 | ld-options: 284 | - -static 285 | - -pthread 286 | - condition: ! '!(flag(disable-git-info))' 287 | cpp-options: -DUSE_GIT_INFO 288 | dependencies: 289 | - githash 290 | - optparse-simple 291 | - condition: flag(hide-dependency-versions) 292 | cpp-options: -DHIDE_DEP_VERSIONS 293 | - condition: flag(supported-build) 294 | cpp-options: -DSUPPORTED_BUILD 295 | tests: 296 | stack-test: 297 | main: Spec.hs 298 | source-dirs: src/test 299 | ghc-options: 300 | - -threaded 301 | dependencies: 302 | - QuickCheck 303 | - hspec 304 | - stack 305 | - smallcheck 306 | stack-integration-test: 307 | main: IntegrationSpec.hs 308 | source-dirs: 309 | - test/integration 310 | - test/integration/lib 311 | ghc-options: 312 | - -threaded 313 | - -rtsopts 314 | - -with-rtsopts=-N 315 | dependencies: 316 | - hspec 317 | when: 318 | - condition: ! '!(flag(integration-tests))' 319 | buildable: false 320 | flags: 321 | static: 322 | description: Pass -static/-pthread to ghc when linking the stack binary. 323 | manual: true 324 | default: false 325 | disable-git-info: 326 | description: Disable compile-time inclusion of current git info in stack 327 | manual: true 328 | default: false 329 | hide-dependency-versions: 330 | description: Hides dependency versions from "stack --version", used only by building 331 | with stack.yaml 332 | manual: true 333 | default: false 334 | integration-tests: 335 | description: Run the integration test suite 336 | manual: true 337 | default: false 338 | supported-build: 339 | description: If false, causes "stack --version" to issue a warning about the build being unsupported. True only if building with stack.yaml 340 | manual: true 341 | default: false 342 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/stack.yaml: -------------------------------------------------------------------------------- 1 | name: stack 2 | version: 1.10.0 3 | synopsis: The Haskell Tool Stack 4 | description: |- 5 | Please see the README.md for usage information, and 6 | the wiki on Github for more details. Also, note that 7 | the API for the library is not currently stable, and may 8 | change significantly, even between minor releases. It is 9 | currently only intended for use by the executable. 10 | category: Development 11 | homepage: http://haskellstack.org 12 | author: Commercial Haskell SIG 13 | maintainer: manny@fpcomplete.com 14 | license: BSD3 15 | github: commercialhaskell/stack 16 | extra-source-files: 17 | - CONTRIBUTING.md 18 | - ChangeLog.md 19 | - README.md 20 | - doc/*.md 21 | - src/setup-shim/StackSetupShim.hs 22 | - stack.yaml 23 | - test/package-dump/ghc-7.10.txt 24 | - test/package-dump/ghc-7.8.4-osx.txt 25 | - test/package-dump/ghc-7.8.txt 26 | ghc-options: 27 | - -Wall 28 | - -fwarn-tabs 29 | - -fwarn-incomplete-uni-patterns 30 | - -fwarn-incomplete-record-updates 31 | - '-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue 32 | #4739 · haskell/cabal](https://github.com/haskell/cabal/issues/4739)' 33 | dependencies: 34 | - Cabal >= 2.4 35 | - aeson 36 | - annotated-wl-pprint 37 | - ansi-terminal >= 0.8.1 38 | - array 39 | - async 40 | - attoparsec 41 | - base >=4.10 && < 5 42 | - base64-bytestring 43 | - bytestring 44 | - colour 45 | - conduit 46 | - conduit-extra 47 | - containers 48 | - cryptonite 49 | - cryptonite-conduit 50 | - deepseq 51 | - directory 52 | - echo 53 | - exceptions 54 | - extra 55 | - file-embed 56 | - filelock 57 | - filepath 58 | - fsnotify 59 | - generic-deriving 60 | - hackage-security 61 | - hashable 62 | - hpack 63 | - hpc 64 | - http-client 65 | - http-client-tls 66 | - http-conduit 67 | - http-types 68 | - memory 69 | - microlens 70 | - mintty 71 | - monad-logger 72 | - mono-traversable 73 | - mtl 74 | - mustache 75 | - neat-interpolation 76 | - network-uri 77 | - open-browser 78 | - optparse-applicative 79 | - pantry 80 | - path 81 | - path-io 82 | - persistent 83 | - persistent-sqlite 84 | - persistent-template 85 | - pretty 86 | - primitive 87 | - process 88 | - project-template 89 | - regex-applicative-text 90 | - resourcet 91 | - retry >= 0.7 92 | - rio 93 | - semigroups 94 | - split 95 | - stm 96 | - store-core 97 | - streaming-commons 98 | - tar 99 | - template-haskell 100 | - temporary 101 | - text 102 | - text-metrics 103 | - th-reify-many 104 | - time 105 | - tls 106 | - transformers 107 | - typed-process 108 | - unicode-transforms 109 | - unix-compat 110 | - unliftio >= 0.2.8.0 111 | - unordered-containers 112 | - vector 113 | - yaml 114 | - zip-archive 115 | - zlib 116 | when: 117 | condition: os(windows) 118 | then: 119 | cpp-options: 120 | - -DWINDOWS 121 | dependencies: 122 | - Win32 123 | else: 124 | dependencies: 125 | - unix 126 | build-tools: 127 | - hsc2hs 128 | custom-setup: 129 | dependencies: 130 | - base >=4.10 && < 5 131 | - Cabal >= 2.4 132 | - filepath 133 | flags: 134 | disable-git-info: 135 | description: Disable compile-time inclusion of current git info in stack 136 | manual: true 137 | default: false 138 | hide-dependency-versions: 139 | description: Hides dependency versions from "stack --version", used only by building 140 | with stack.yaml 141 | manual: true 142 | default: false 143 | integration-tests: 144 | description: Run the integration test suite 145 | manual: true 146 | default: false 147 | static: 148 | description: Pass -static/-pthread to ghc when linking the stack binary. 149 | manual: true 150 | default: false 151 | supported-build: 152 | description: If false, causes "stack --version" to issue a warning about the build 153 | being unsupported. True only if building with stack.yaml 154 | manual: true 155 | default: false 156 | library: 157 | exposed-modules: 158 | - Control.Concurrent.Execute 159 | - Data.Attoparsec.Args 160 | - Data.Attoparsec.Combinators 161 | - Data.Attoparsec.Interpreter 162 | - Data.Monoid.Map 163 | - Network.HTTP.Download 164 | - Network.HTTP.Download.Verified 165 | - Network.HTTP.StackClient 166 | - Options.Applicative.Args 167 | - Options.Applicative.Builder.Extra 168 | - Options.Applicative.Complicated 169 | - Path.CheckInstall 170 | - Path.Extra 171 | - Path.Find 172 | - Stack.Build 173 | - Stack.Build.Cache 174 | - Stack.Build.ConstructPlan 175 | - Stack.Build.Execute 176 | - Stack.Build.Haddock 177 | - Stack.Build.Installed 178 | - Stack.Build.Source 179 | - Stack.Build.Target 180 | - Stack.BuildPlan 181 | - Stack.Clean 182 | - Stack.Config 183 | - Stack.Config.Build 184 | - Stack.Config.Urls 185 | - Stack.Config.Docker 186 | - Stack.Config.Nix 187 | - Stack.ConfigCmd 188 | - Stack.Constants 189 | - Stack.Constants.Config 190 | - Stack.Coverage 191 | - Stack.DefaultColorWhen 192 | - Stack.DefaultStyles 193 | - Stack.Docker 194 | - Stack.Docker.GlobalDB 195 | - Stack.Dot 196 | - Stack.FileWatch 197 | - Stack.Freeze 198 | - Stack.GhcPkg 199 | - Stack.Ghci 200 | - Stack.Ghci.Script 201 | - Stack.Hoogle 202 | - Stack.IDE 203 | - Stack.Image 204 | - Stack.Init 205 | - Stack.Ls 206 | - Stack.New 207 | - Stack.Nix 208 | - Stack.Options.BenchParser 209 | - Stack.Options.BuildMonoidParser 210 | - Stack.Options.BuildParser 211 | - Stack.Options.CleanParser 212 | - Stack.Options.ConfigParser 213 | - Stack.Options.Completion 214 | - Stack.Options.DockerParser 215 | - Stack.Options.DotParser 216 | - Stack.Options.ExecParser 217 | - Stack.Options.FreezeParser 218 | - Stack.Options.GhcBuildParser 219 | - Stack.Options.GhciParser 220 | - Stack.Options.GhcVariantParser 221 | - Stack.Options.GlobalParser 222 | - Stack.Options.HaddockParser 223 | - Stack.Options.HpcReportParser 224 | - Stack.Options.LogLevelParser 225 | - Stack.Options.NewParser 226 | - Stack.Options.NixParser 227 | - Stack.Options.PackageParser 228 | - Stack.Options.ResolverParser 229 | - Stack.Options.ScriptParser 230 | - Stack.Options.SDistParser 231 | - Stack.Options.SolverParser 232 | - Stack.Options.TestParser 233 | - Stack.Options.Utils 234 | - Stack.Package 235 | - Stack.PackageDump 236 | - Stack.Path 237 | - Stack.Prelude 238 | - Stack.PrettyPrint 239 | - Stack.Runners 240 | - Stack.Script 241 | - Stack.SDist 242 | - Stack.Setup 243 | - Stack.Setup.Installed 244 | - Stack.SetupCmd 245 | - Stack.Sig 246 | - Stack.Sig.GPG 247 | - Stack.Sig.Sign 248 | - Stack.Snapshot 249 | - Stack.Solver 250 | - Stack.StoreTH 251 | - Stack.Types.Build 252 | - Stack.Types.BuildPlan 253 | - Stack.Types.CompilerBuild 254 | - Stack.Types.Urls 255 | - Stack.Types.Compiler 256 | - Stack.Types.Config 257 | - Stack.Types.Config.Build 258 | - Stack.Types.Docker 259 | - Stack.Types.GhcPkgId 260 | - Stack.Types.Image 261 | - Stack.Types.NamedComponent 262 | - Stack.Types.Nix 263 | - Stack.Types.Package 264 | - Stack.Types.PackageDump 265 | - Stack.Types.PackageName 266 | - Stack.Types.PrettyPrint 267 | - Stack.Types.Resolver 268 | - Stack.Types.Runner 269 | - Stack.Types.Sig 270 | - Stack.Types.StylesUpdate 271 | - Stack.Types.TemplateName 272 | - Stack.Types.Version 273 | - Stack.Types.VersionIntervals 274 | - Stack.Unpack 275 | - Stack.Upgrade 276 | - Stack.Upload 277 | - Text.PrettyPrint.Leijen.Extended 278 | - System.Permissions 279 | - System.Process.PagerEditor 280 | - System.Terminal 281 | generated-exposed-modules: 282 | - Paths_stack 283 | source-dirs: src/ 284 | ghc-options: 285 | - -fwarn-identities 286 | when: 287 | condition: os(windows) 288 | then: 289 | source-dirs: 290 | - src/windows/ 291 | else: 292 | source-dirs: 293 | - src/unix/ 294 | c-sources: 295 | - src/unix/cbits/uname.c 296 | executables: 297 | stack: 298 | main: Main.hs 299 | generated-other-modules: 300 | - Build_stack 301 | - Paths_stack 302 | source-dirs: 303 | - src/main 304 | ghc-options: 305 | - -threaded 306 | - -rtsopts 307 | dependencies: 308 | - stack 309 | when: 310 | - condition: flag(static) 311 | cpp-options: [] 312 | ld-options: 313 | - -static 314 | - -pthread 315 | dependencies: [] 316 | - condition: '!(flag(disable-git-info))' 317 | cpp-options: 318 | - -DUSE_GIT_INFO 319 | ld-options: [] 320 | dependencies: 321 | - githash 322 | - optparse-simple 323 | - condition: flag(hide-dependency-versions) 324 | cpp-options: 325 | - -DHIDE_DEP_VERSIONS 326 | ld-options: [] 327 | dependencies: [] 328 | - condition: flag(supported-build) 329 | cpp-options: 330 | - -DSUPPORTED_BUILD 331 | ld-options: [] 332 | dependencies: [] 333 | tests: 334 | stack-integration-test: 335 | main: IntegrationSpec.hs 336 | source-dirs: 337 | - test/integration 338 | - test/integration/lib 339 | ghc-options: 340 | - -threaded 341 | - -rtsopts 342 | - -with-rtsopts=-N 343 | dependencies: 344 | - hspec 345 | when: 346 | condition: '!flag(integration-tests)' 347 | buildable: false 348 | stack-test: 349 | main: Spec.hs 350 | source-dirs: 351 | - src/test 352 | ghc-options: 353 | - -threaded 354 | dependencies: 355 | - QuickCheck 356 | - hspec 357 | - stack 358 | - smallcheck 359 | 360 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/stack.yaml.golden: -------------------------------------------------------------------------------- 1 | name: stack 2 | version: 1.10.0 3 | synopsis: The Haskell Tool Stack 4 | description: |- 5 | Please see the README.md for usage information, and 6 | the wiki on Github for more details. Also, note that 7 | the API for the library is not currently stable, and may 8 | change significantly, even between minor releases. It is 9 | currently only intended for use by the executable. 10 | category: Development 11 | homepage: http://haskellstack.org 12 | author: Commercial Haskell SIG 13 | maintainer: manny@fpcomplete.com 14 | license: BSD3 15 | github: commercialhaskell/stack 16 | extra-source-files: 17 | - CONTRIBUTING.md 18 | - ChangeLog.md 19 | - README.md 20 | - doc/*.md 21 | - src/setup-shim/StackSetupShim.hs 22 | - stack.yaml 23 | - test/package-dump/ghc-7.10.txt 24 | - test/package-dump/ghc-7.8.4-osx.txt 25 | - test/package-dump/ghc-7.8.txt 26 | ghc-options: 27 | - -Wall 28 | - -fwarn-tabs 29 | - -fwarn-incomplete-uni-patterns 30 | - -fwarn-incomplete-record-updates 31 | - '-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue 32 | #4739 · haskell/cabal](https://github.com/haskell/cabal/issues/4739)' 33 | dependencies: 34 | - Cabal >= 2.4 35 | - aeson 36 | - annotated-wl-pprint 37 | - ansi-terminal >= 0.8.1 38 | - array 39 | - async 40 | - attoparsec 41 | - base >=4.10 && < 5 42 | - base64-bytestring 43 | - bytestring 44 | - colour 45 | - conduit 46 | - conduit-extra 47 | - containers 48 | - cryptonite 49 | - cryptonite-conduit 50 | - deepseq 51 | - directory 52 | - echo 53 | - exceptions 54 | - extra 55 | - file-embed 56 | - filelock 57 | - filepath 58 | - fsnotify 59 | - generic-deriving 60 | - hackage-security 61 | - hashable 62 | - hpack 63 | - hpc 64 | - http-client 65 | - http-client-tls 66 | - http-conduit 67 | - http-types 68 | - memory 69 | - microlens 70 | - mintty 71 | - monad-logger 72 | - mono-traversable 73 | - mtl 74 | - mustache 75 | - neat-interpolation 76 | - network-uri 77 | - open-browser 78 | - optparse-applicative 79 | - pantry 80 | - path 81 | - path-io 82 | - persistent 83 | - persistent-sqlite 84 | - persistent-template 85 | - pretty 86 | - primitive 87 | - process 88 | - project-template 89 | - regex-applicative-text 90 | - resourcet 91 | - retry >= 0.7 92 | - rio 93 | - semigroups 94 | - split 95 | - stm 96 | - store-core 97 | - streaming-commons 98 | - tar 99 | - template-haskell 100 | - temporary 101 | - text 102 | - text-metrics 103 | - th-reify-many 104 | - time 105 | - tls 106 | - transformers 107 | - typed-process 108 | - unicode-transforms 109 | - unix-compat 110 | - unliftio >= 0.2.8.0 111 | - unordered-containers 112 | - vector 113 | - yaml 114 | - zip-archive 115 | - zlib 116 | when: 117 | condition: os(windows) 118 | then: 119 | cpp-options: 120 | - -DWINDOWS 121 | dependencies: 122 | - Win32 123 | else: 124 | dependencies: 125 | - unix 126 | build-tools: 127 | - hsc2hs 128 | custom-setup: 129 | dependencies: 130 | - base >=4.10 && < 5 131 | - Cabal >= 2.4 132 | - filepath 133 | flags: 134 | disable-git-info: 135 | description: Disable compile-time inclusion of current git info in stack 136 | manual: true 137 | default: false 138 | hide-dependency-versions: 139 | description: Hides dependency versions from "stack --version", used only by building 140 | with stack.yaml 141 | manual: true 142 | default: false 143 | integration-tests: 144 | description: Run the integration test suite 145 | manual: true 146 | default: false 147 | static: 148 | description: Pass -static/-pthread to ghc when linking the stack binary. 149 | manual: true 150 | default: false 151 | supported-build: 152 | description: If false, causes "stack --version" to issue a warning about the build 153 | being unsupported. True only if building with stack.yaml 154 | manual: true 155 | default: false 156 | library: 157 | exposed-modules: 158 | - Control.Concurrent.Execute 159 | - Data.Attoparsec.Args 160 | - Data.Attoparsec.Combinators 161 | - Data.Attoparsec.Interpreter 162 | - Data.Monoid.Map 163 | - Network.HTTP.Download 164 | - Network.HTTP.Download.Verified 165 | - Network.HTTP.StackClient 166 | - Options.Applicative.Args 167 | - Options.Applicative.Builder.Extra 168 | - Options.Applicative.Complicated 169 | - Path.CheckInstall 170 | - Path.Extra 171 | - Path.Find 172 | - Stack.Build 173 | - Stack.Build.Cache 174 | - Stack.Build.ConstructPlan 175 | - Stack.Build.Execute 176 | - Stack.Build.Haddock 177 | - Stack.Build.Installed 178 | - Stack.Build.Source 179 | - Stack.Build.Target 180 | - Stack.BuildPlan 181 | - Stack.Clean 182 | - Stack.Config 183 | - Stack.Config.Build 184 | - Stack.Config.Urls 185 | - Stack.Config.Docker 186 | - Stack.Config.Nix 187 | - Stack.ConfigCmd 188 | - Stack.Constants 189 | - Stack.Constants.Config 190 | - Stack.Coverage 191 | - Stack.DefaultColorWhen 192 | - Stack.DefaultStyles 193 | - Stack.Docker 194 | - Stack.Docker.GlobalDB 195 | - Stack.Dot 196 | - Stack.FileWatch 197 | - Stack.Freeze 198 | - Stack.GhcPkg 199 | - Stack.Ghci 200 | - Stack.Ghci.Script 201 | - Stack.Hoogle 202 | - Stack.IDE 203 | - Stack.Image 204 | - Stack.Init 205 | - Stack.Ls 206 | - Stack.New 207 | - Stack.Nix 208 | - Stack.Options.BenchParser 209 | - Stack.Options.BuildMonoidParser 210 | - Stack.Options.BuildParser 211 | - Stack.Options.CleanParser 212 | - Stack.Options.ConfigParser 213 | - Stack.Options.Completion 214 | - Stack.Options.DockerParser 215 | - Stack.Options.DotParser 216 | - Stack.Options.ExecParser 217 | - Stack.Options.FreezeParser 218 | - Stack.Options.GhcBuildParser 219 | - Stack.Options.GhciParser 220 | - Stack.Options.GhcVariantParser 221 | - Stack.Options.GlobalParser 222 | - Stack.Options.HaddockParser 223 | - Stack.Options.HpcReportParser 224 | - Stack.Options.LogLevelParser 225 | - Stack.Options.NewParser 226 | - Stack.Options.NixParser 227 | - Stack.Options.PackageParser 228 | - Stack.Options.ResolverParser 229 | - Stack.Options.ScriptParser 230 | - Stack.Options.SDistParser 231 | - Stack.Options.SolverParser 232 | - Stack.Options.TestParser 233 | - Stack.Options.Utils 234 | - Stack.Package 235 | - Stack.PackageDump 236 | - Stack.Path 237 | - Stack.Prelude 238 | - Stack.PrettyPrint 239 | - Stack.Runners 240 | - Stack.Script 241 | - Stack.SDist 242 | - Stack.Setup 243 | - Stack.Setup.Installed 244 | - Stack.SetupCmd 245 | - Stack.Sig 246 | - Stack.Sig.GPG 247 | - Stack.Sig.Sign 248 | - Stack.Snapshot 249 | - Stack.Solver 250 | - Stack.StoreTH 251 | - Stack.Types.Build 252 | - Stack.Types.BuildPlan 253 | - Stack.Types.CompilerBuild 254 | - Stack.Types.Urls 255 | - Stack.Types.Compiler 256 | - Stack.Types.Config 257 | - Stack.Types.Config.Build 258 | - Stack.Types.Docker 259 | - Stack.Types.GhcPkgId 260 | - Stack.Types.Image 261 | - Stack.Types.NamedComponent 262 | - Stack.Types.Nix 263 | - Stack.Types.Package 264 | - Stack.Types.PackageDump 265 | - Stack.Types.PackageName 266 | - Stack.Types.PrettyPrint 267 | - Stack.Types.Resolver 268 | - Stack.Types.Runner 269 | - Stack.Types.Sig 270 | - Stack.Types.StylesUpdate 271 | - Stack.Types.TemplateName 272 | - Stack.Types.Version 273 | - Stack.Types.VersionIntervals 274 | - Stack.Unpack 275 | - Stack.Upgrade 276 | - Stack.Upload 277 | - Text.PrettyPrint.Leijen.Extended 278 | - System.Permissions 279 | - System.Process.PagerEditor 280 | - System.Terminal 281 | generated-exposed-modules: 282 | - Paths_stack 283 | source-dirs: src/ 284 | ghc-options: 285 | - -fwarn-identities 286 | when: 287 | condition: os(windows) 288 | then: 289 | source-dirs: 290 | - src/windows/ 291 | else: 292 | source-dirs: 293 | - src/unix/ 294 | c-sources: 295 | - src/unix/cbits/uname.c 296 | executables: 297 | stack: 298 | main: Main.hs 299 | generated-other-modules: 300 | - Build_stack 301 | - Paths_stack 302 | source-dirs: 303 | - src/main 304 | ghc-options: 305 | - -threaded 306 | - -rtsopts 307 | dependencies: 308 | - stack 309 | when: 310 | - condition: flag(static) 311 | cpp-options: [] 312 | ld-options: 313 | - -static 314 | - -pthread 315 | dependencies: [] 316 | - condition: '!(flag(disable-git-info))' 317 | cpp-options: 318 | - -DUSE_GIT_INFO 319 | ld-options: [] 320 | dependencies: 321 | - githash 322 | - optparse-simple 323 | - condition: flag(hide-dependency-versions) 324 | cpp-options: 325 | - -DHIDE_DEP_VERSIONS 326 | ld-options: [] 327 | dependencies: [] 328 | - condition: flag(supported-build) 329 | cpp-options: 330 | - -DSUPPORTED_BUILD 331 | ld-options: [] 332 | dependencies: [] 333 | tests: 334 | stack-integration-test: 335 | main: IntegrationSpec.hs 336 | source-dirs: 337 | - test/integration 338 | - test/integration/lib 339 | ghc-options: 340 | - -threaded 341 | - -rtsopts 342 | - -with-rtsopts=-N 343 | dependencies: 344 | - hspec 345 | when: 346 | condition: '!flag(integration-tests)' 347 | buildable: false 348 | stack-test: 349 | main: Spec.hs 350 | source-dirs: 351 | - src/test 352 | ghc-options: 353 | - -threaded 354 | dependencies: 355 | - QuickCheck 356 | - hspec 357 | - stack 358 | - smallcheck 359 | 360 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/stack.dhall-1.32.golden: -------------------------------------------------------------------------------- 1 | { name = "stack" 2 | , version = "1.10.0" 3 | , synopsis = "The Haskell Tool Stack" 4 | , description = 5 | '' 6 | Please see the README.md for usage information, and 7 | the wiki on Github for more details. Also, note that 8 | the API for the library is not currently stable, and may 9 | change significantly, even between minor releases. It is 10 | currently only intended for use by the executable.'' 11 | , category = "Development" 12 | , author = "Commercial Haskell SIG" 13 | , maintainer = "manny@fpcomplete.com" 14 | , license = "BSD3" 15 | , github = "commercialhaskell/stack" 16 | , homepage = "http://haskellstack.org" 17 | , custom-setup.dependencies = 18 | [ "base >=4.10 && < 5", "Cabal >= 2.4", "filepath" ] 19 | , extra-source-files = 20 | [ "CONTRIBUTING.md" 21 | , "ChangeLog.md" 22 | , "README.md" 23 | , "doc/*.md" 24 | , "src/setup-shim/StackSetupShim.hs" 25 | , "stack.yaml" 26 | , "test/package-dump/ghc-7.10.txt" 27 | , "test/package-dump/ghc-7.8.4-osx.txt" 28 | , "test/package-dump/ghc-7.8.txt" 29 | ] 30 | , ghc-options = 31 | [ "-Wall" 32 | , "-fwarn-tabs" 33 | , "-fwarn-incomplete-uni-patterns" 34 | , "-fwarn-incomplete-record-updates" 35 | , "-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue #4739 · haskell/cabal](https://github.com/haskell/cabal/issues/4739)" 36 | ] 37 | , dependencies = 38 | [ "Cabal >= 2.4" 39 | , "aeson" 40 | , "annotated-wl-pprint" 41 | , "ansi-terminal >= 0.8.1" 42 | , "array" 43 | , "async" 44 | , "attoparsec" 45 | , "base >=4.10 && < 5" 46 | , "base64-bytestring" 47 | , "bytestring" 48 | , "colour" 49 | , "conduit" 50 | , "conduit-extra" 51 | , "containers" 52 | , "cryptonite" 53 | , "cryptonite-conduit" 54 | , "deepseq" 55 | , "directory" 56 | , "echo" 57 | , "exceptions" 58 | , "extra" 59 | , "file-embed" 60 | , "filelock" 61 | , "filepath" 62 | , "fsnotify" 63 | , "generic-deriving" 64 | , "hackage-security" 65 | , "hashable" 66 | , "hpack" 67 | , "hpc" 68 | , "http-client" 69 | , "http-client-tls" 70 | , "http-conduit" 71 | , "http-types" 72 | , "memory" 73 | , "microlens" 74 | , "mintty" 75 | , "monad-logger" 76 | , "mono-traversable" 77 | , "mtl" 78 | , "mustache" 79 | , "neat-interpolation" 80 | , "network-uri" 81 | , "open-browser" 82 | , "optparse-applicative" 83 | , "pantry" 84 | , "path" 85 | , "path-io" 86 | , "persistent" 87 | , "persistent-sqlite" 88 | , "persistent-template" 89 | , "pretty" 90 | , "primitive" 91 | , "process" 92 | , "project-template" 93 | , "regex-applicative-text" 94 | , "resourcet" 95 | , "retry >= 0.7" 96 | , "rio" 97 | , "semigroups" 98 | , "split" 99 | , "stm" 100 | , "store-core" 101 | , "streaming-commons" 102 | , "tar" 103 | , "template-haskell" 104 | , "temporary" 105 | , "text" 106 | , "text-metrics" 107 | , "th-reify-many" 108 | , "time" 109 | , "tls" 110 | , "transformers" 111 | , "typed-process" 112 | , "unicode-transforms" 113 | , "unix-compat" 114 | , "unliftio >= 0.2.8.0" 115 | , "unordered-containers" 116 | , "vector" 117 | , "yaml" 118 | , "zip-archive" 119 | , "zlib" 120 | ] 121 | , when = 122 | { condition = "os(windows)" 123 | , then = { cpp-options = [ "-DWINDOWS" ], dependencies = [ "Win32" ] } 124 | , else = { build-tools = [ "hsc2hs" ], dependencies = [ "unix" ] } 125 | } 126 | , library = 127 | { source-dirs = "src/" 128 | , ghc-options = [ "-fwarn-identities" ] 129 | , generated-exposed-modules = [ "Paths_stack" ] 130 | , exposed-modules = 131 | [ "Control.Concurrent.Execute" 132 | , "Data.Attoparsec.Args" 133 | , "Data.Attoparsec.Combinators" 134 | , "Data.Attoparsec.Interpreter" 135 | , "Data.Monoid.Map" 136 | , "Network.HTTP.Download" 137 | , "Network.HTTP.Download.Verified" 138 | , "Network.HTTP.StackClient" 139 | , "Options.Applicative.Args" 140 | , "Options.Applicative.Builder.Extra" 141 | , "Options.Applicative.Complicated" 142 | , "Path.CheckInstall" 143 | , "Path.Extra" 144 | , "Path.Find" 145 | , "Stack.Build" 146 | , "Stack.Build.Cache" 147 | , "Stack.Build.ConstructPlan" 148 | , "Stack.Build.Execute" 149 | , "Stack.Build.Haddock" 150 | , "Stack.Build.Installed" 151 | , "Stack.Build.Source" 152 | , "Stack.Build.Target" 153 | , "Stack.BuildPlan" 154 | , "Stack.Clean" 155 | , "Stack.Config" 156 | , "Stack.Config.Build" 157 | , "Stack.Config.Urls" 158 | , "Stack.Config.Docker" 159 | , "Stack.Config.Nix" 160 | , "Stack.ConfigCmd" 161 | , "Stack.Constants" 162 | , "Stack.Constants.Config" 163 | , "Stack.Coverage" 164 | , "Stack.DefaultColorWhen" 165 | , "Stack.DefaultStyles" 166 | , "Stack.Docker" 167 | , "Stack.Docker.GlobalDB" 168 | , "Stack.Dot" 169 | , "Stack.FileWatch" 170 | , "Stack.Freeze" 171 | , "Stack.GhcPkg" 172 | , "Stack.Ghci" 173 | , "Stack.Ghci.Script" 174 | , "Stack.Hoogle" 175 | , "Stack.IDE" 176 | , "Stack.Image" 177 | , "Stack.Init" 178 | , "Stack.Ls" 179 | , "Stack.New" 180 | , "Stack.Nix" 181 | , "Stack.Options.BenchParser" 182 | , "Stack.Options.BuildMonoidParser" 183 | , "Stack.Options.BuildParser" 184 | , "Stack.Options.CleanParser" 185 | , "Stack.Options.ConfigParser" 186 | , "Stack.Options.Completion" 187 | , "Stack.Options.DockerParser" 188 | , "Stack.Options.DotParser" 189 | , "Stack.Options.ExecParser" 190 | , "Stack.Options.FreezeParser" 191 | , "Stack.Options.GhcBuildParser" 192 | , "Stack.Options.GhciParser" 193 | , "Stack.Options.GhcVariantParser" 194 | , "Stack.Options.GlobalParser" 195 | , "Stack.Options.HaddockParser" 196 | , "Stack.Options.HpcReportParser" 197 | , "Stack.Options.LogLevelParser" 198 | , "Stack.Options.NewParser" 199 | , "Stack.Options.NixParser" 200 | , "Stack.Options.PackageParser" 201 | , "Stack.Options.ResolverParser" 202 | , "Stack.Options.ScriptParser" 203 | , "Stack.Options.SDistParser" 204 | , "Stack.Options.SolverParser" 205 | , "Stack.Options.TestParser" 206 | , "Stack.Options.Utils" 207 | , "Stack.Package" 208 | , "Stack.PackageDump" 209 | , "Stack.Path" 210 | , "Stack.Prelude" 211 | , "Stack.PrettyPrint" 212 | , "Stack.Runners" 213 | , "Stack.Script" 214 | , "Stack.SDist" 215 | , "Stack.Setup" 216 | , "Stack.Setup.Installed" 217 | , "Stack.SetupCmd" 218 | , "Stack.Sig" 219 | , "Stack.Sig.GPG" 220 | , "Stack.Sig.Sign" 221 | , "Stack.Snapshot" 222 | , "Stack.Solver" 223 | , "Stack.StoreTH" 224 | , "Stack.Types.Build" 225 | , "Stack.Types.BuildPlan" 226 | , "Stack.Types.CompilerBuild" 227 | , "Stack.Types.Urls" 228 | , "Stack.Types.Compiler" 229 | , "Stack.Types.Config" 230 | , "Stack.Types.Config.Build" 231 | , "Stack.Types.Docker" 232 | , "Stack.Types.GhcPkgId" 233 | , "Stack.Types.Image" 234 | , "Stack.Types.NamedComponent" 235 | , "Stack.Types.Nix" 236 | , "Stack.Types.Package" 237 | , "Stack.Types.PackageDump" 238 | , "Stack.Types.PackageName" 239 | , "Stack.Types.PrettyPrint" 240 | , "Stack.Types.Resolver" 241 | , "Stack.Types.Runner" 242 | , "Stack.Types.Sig" 243 | , "Stack.Types.StylesUpdate" 244 | , "Stack.Types.TemplateName" 245 | , "Stack.Types.Version" 246 | , "Stack.Types.VersionIntervals" 247 | , "Stack.Unpack" 248 | , "Stack.Upgrade" 249 | , "Stack.Upload" 250 | , "Text.PrettyPrint.Leijen.Extended" 251 | , "System.Permissions" 252 | , "System.Process.PagerEditor" 253 | , "System.Terminal" 254 | ] 255 | , when = 256 | { condition = "os(windows)" 257 | , then.source-dirs = [ "src/windows/" ] 258 | , else = 259 | { source-dirs = [ "src/unix/" ] 260 | , c-sources = [ "src/unix/cbits/uname.c" ] 261 | } 262 | } 263 | } 264 | , executables.stack = 265 | { main = "Main.hs" 266 | , source-dirs = [ "src/main" ] 267 | , generated-other-modules = [ "Build_stack", "Paths_stack" ] 268 | , ghc-options = [ "-threaded", "-rtsopts" ] 269 | , dependencies = [ "stack" ] 270 | , when = 271 | [ { condition = "flag(static)" 272 | , cpp-options = [] : List Text 273 | , dependencies = [] : List Text 274 | , ld-options = [ "-static", "-pthread" ] 275 | } 276 | , { condition = "!(flag(disable-git-info))" 277 | , cpp-options = [ "-DUSE_GIT_INFO" ] 278 | , dependencies = [ "githash", "optparse-simple" ] 279 | , ld-options = [] : List Text 280 | } 281 | , { condition = "flag(hide-dependency-versions)" 282 | , cpp-options = [ "-DHIDE_DEP_VERSIONS" ] 283 | , dependencies = [] : List Text 284 | , ld-options = [] : List Text 285 | } 286 | , { condition = "flag(supported-build)" 287 | , cpp-options = [ "-DSUPPORTED_BUILD" ] 288 | , dependencies = [] : List Text 289 | , ld-options = [] : List Text 290 | } 291 | ] 292 | } 293 | , tests = 294 | { stack-test = 295 | { main = "Spec.hs" 296 | , source-dirs = [ "src/test" ] 297 | , ghc-options = [ "-threaded" ] 298 | , dependencies = [ "QuickCheck", "hspec", "stack", "smallcheck" ] 299 | } 300 | , stack-integration-test = 301 | { main = "IntegrationSpec.hs" 302 | , source-dirs = [ "test/integration", "test/integration/lib" ] 303 | , ghc-options = [ "-threaded", "-rtsopts", "-with-rtsopts=-N" ] 304 | , dependencies = [ "hspec" ] 305 | , when = { condition = "!flag(integration-tests)", buildable = False } 306 | } 307 | } 308 | , flags = 309 | { static = 310 | { description = 311 | "Pass -static/-pthread to ghc when linking the stack binary." 312 | , manual = True 313 | , default = False 314 | } 315 | , disable-git-info = 316 | { description = 317 | "Disable compile-time inclusion of current git info in stack" 318 | , manual = True 319 | , default = False 320 | } 321 | , hide-dependency-versions = 322 | { description = 323 | "Hides dependency versions from \"stack --version\", used only by building with stack.yaml" 324 | , manual = True 325 | , default = False 326 | } 327 | , integration-tests = 328 | { description = "Run the integration test suite" 329 | , manual = True 330 | , default = False 331 | } 332 | , supported-build = 333 | { description = 334 | "If false, causes \"stack --version\" to issue a warning about the build being unsupported. True only if building with stack.yaml" 335 | , manual = True 336 | , default = False 337 | } 338 | } 339 | } -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/stack.dhall-1.34.golden: -------------------------------------------------------------------------------- 1 | { name = "stack" 2 | , version = "1.10.0" 3 | , synopsis = "The Haskell Tool Stack" 4 | , description = 5 | '' 6 | Please see the README.md for usage information, and 7 | the wiki on Github for more details. Also, note that 8 | the API for the library is not currently stable, and may 9 | change significantly, even between minor releases. It is 10 | currently only intended for use by the executable.'' 11 | , category = "Development" 12 | , author = "Commercial Haskell SIG" 13 | , maintainer = "manny@fpcomplete.com" 14 | , license = "BSD3" 15 | , github = "commercialhaskell/stack" 16 | , homepage = "http://haskellstack.org" 17 | , custom-setup.dependencies 18 | = 19 | [ "base >=4.10 && < 5", "Cabal >= 2.4", "filepath" ] 20 | , extra-source-files = 21 | [ "CONTRIBUTING.md" 22 | , "ChangeLog.md" 23 | , "README.md" 24 | , "doc/*.md" 25 | , "src/setup-shim/StackSetupShim.hs" 26 | , "stack.yaml" 27 | , "test/package-dump/ghc-7.10.txt" 28 | , "test/package-dump/ghc-7.8.4-osx.txt" 29 | , "test/package-dump/ghc-7.8.txt" 30 | ] 31 | , ghc-options = 32 | [ "-Wall" 33 | , "-fwarn-tabs" 34 | , "-fwarn-incomplete-uni-patterns" 35 | , "-fwarn-incomplete-record-updates" 36 | , "-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue #4739 · haskell/cabal](https://github.com/haskell/cabal/issues/4739)" 37 | ] 38 | , dependencies = 39 | [ "Cabal >= 2.4" 40 | , "aeson" 41 | , "annotated-wl-pprint" 42 | , "ansi-terminal >= 0.8.1" 43 | , "array" 44 | , "async" 45 | , "attoparsec" 46 | , "base >=4.10 && < 5" 47 | , "base64-bytestring" 48 | , "bytestring" 49 | , "colour" 50 | , "conduit" 51 | , "conduit-extra" 52 | , "containers" 53 | , "cryptonite" 54 | , "cryptonite-conduit" 55 | , "deepseq" 56 | , "directory" 57 | , "echo" 58 | , "exceptions" 59 | , "extra" 60 | , "file-embed" 61 | , "filelock" 62 | , "filepath" 63 | , "fsnotify" 64 | , "generic-deriving" 65 | , "hackage-security" 66 | , "hashable" 67 | , "hpack" 68 | , "hpc" 69 | , "http-client" 70 | , "http-client-tls" 71 | , "http-conduit" 72 | , "http-types" 73 | , "memory" 74 | , "microlens" 75 | , "mintty" 76 | , "monad-logger" 77 | , "mono-traversable" 78 | , "mtl" 79 | , "mustache" 80 | , "neat-interpolation" 81 | , "network-uri" 82 | , "open-browser" 83 | , "optparse-applicative" 84 | , "pantry" 85 | , "path" 86 | , "path-io" 87 | , "persistent" 88 | , "persistent-sqlite" 89 | , "persistent-template" 90 | , "pretty" 91 | , "primitive" 92 | , "process" 93 | , "project-template" 94 | , "regex-applicative-text" 95 | , "resourcet" 96 | , "retry >= 0.7" 97 | , "rio" 98 | , "semigroups" 99 | , "split" 100 | , "stm" 101 | , "store-core" 102 | , "streaming-commons" 103 | , "tar" 104 | , "template-haskell" 105 | , "temporary" 106 | , "text" 107 | , "text-metrics" 108 | , "th-reify-many" 109 | , "time" 110 | , "tls" 111 | , "transformers" 112 | , "typed-process" 113 | , "unicode-transforms" 114 | , "unix-compat" 115 | , "unliftio >= 0.2.8.0" 116 | , "unordered-containers" 117 | , "vector" 118 | , "yaml" 119 | , "zip-archive" 120 | , "zlib" 121 | ] 122 | , when = 123 | { condition = "os(windows)" 124 | , `then` = { cpp-options = [ "-DWINDOWS" ], dependencies = [ "Win32" ] } 125 | , `else` = { build-tools = [ "hsc2hs" ], dependencies = [ "unix" ] } 126 | } 127 | , library = 128 | { source-dirs = "src/" 129 | , ghc-options = [ "-fwarn-identities" ] 130 | , generated-exposed-modules = [ "Paths_stack" ] 131 | , exposed-modules = 132 | [ "Control.Concurrent.Execute" 133 | , "Data.Attoparsec.Args" 134 | , "Data.Attoparsec.Combinators" 135 | , "Data.Attoparsec.Interpreter" 136 | , "Data.Monoid.Map" 137 | , "Network.HTTP.Download" 138 | , "Network.HTTP.Download.Verified" 139 | , "Network.HTTP.StackClient" 140 | , "Options.Applicative.Args" 141 | , "Options.Applicative.Builder.Extra" 142 | , "Options.Applicative.Complicated" 143 | , "Path.CheckInstall" 144 | , "Path.Extra" 145 | , "Path.Find" 146 | , "Stack.Build" 147 | , "Stack.Build.Cache" 148 | , "Stack.Build.ConstructPlan" 149 | , "Stack.Build.Execute" 150 | , "Stack.Build.Haddock" 151 | , "Stack.Build.Installed" 152 | , "Stack.Build.Source" 153 | , "Stack.Build.Target" 154 | , "Stack.BuildPlan" 155 | , "Stack.Clean" 156 | , "Stack.Config" 157 | , "Stack.Config.Build" 158 | , "Stack.Config.Urls" 159 | , "Stack.Config.Docker" 160 | , "Stack.Config.Nix" 161 | , "Stack.ConfigCmd" 162 | , "Stack.Constants" 163 | , "Stack.Constants.Config" 164 | , "Stack.Coverage" 165 | , "Stack.DefaultColorWhen" 166 | , "Stack.DefaultStyles" 167 | , "Stack.Docker" 168 | , "Stack.Docker.GlobalDB" 169 | , "Stack.Dot" 170 | , "Stack.FileWatch" 171 | , "Stack.Freeze" 172 | , "Stack.GhcPkg" 173 | , "Stack.Ghci" 174 | , "Stack.Ghci.Script" 175 | , "Stack.Hoogle" 176 | , "Stack.IDE" 177 | , "Stack.Image" 178 | , "Stack.Init" 179 | , "Stack.Ls" 180 | , "Stack.New" 181 | , "Stack.Nix" 182 | , "Stack.Options.BenchParser" 183 | , "Stack.Options.BuildMonoidParser" 184 | , "Stack.Options.BuildParser" 185 | , "Stack.Options.CleanParser" 186 | , "Stack.Options.ConfigParser" 187 | , "Stack.Options.Completion" 188 | , "Stack.Options.DockerParser" 189 | , "Stack.Options.DotParser" 190 | , "Stack.Options.ExecParser" 191 | , "Stack.Options.FreezeParser" 192 | , "Stack.Options.GhcBuildParser" 193 | , "Stack.Options.GhciParser" 194 | , "Stack.Options.GhcVariantParser" 195 | , "Stack.Options.GlobalParser" 196 | , "Stack.Options.HaddockParser" 197 | , "Stack.Options.HpcReportParser" 198 | , "Stack.Options.LogLevelParser" 199 | , "Stack.Options.NewParser" 200 | , "Stack.Options.NixParser" 201 | , "Stack.Options.PackageParser" 202 | , "Stack.Options.ResolverParser" 203 | , "Stack.Options.ScriptParser" 204 | , "Stack.Options.SDistParser" 205 | , "Stack.Options.SolverParser" 206 | , "Stack.Options.TestParser" 207 | , "Stack.Options.Utils" 208 | , "Stack.Package" 209 | , "Stack.PackageDump" 210 | , "Stack.Path" 211 | , "Stack.Prelude" 212 | , "Stack.PrettyPrint" 213 | , "Stack.Runners" 214 | , "Stack.Script" 215 | , "Stack.SDist" 216 | , "Stack.Setup" 217 | , "Stack.Setup.Installed" 218 | , "Stack.SetupCmd" 219 | , "Stack.Sig" 220 | , "Stack.Sig.GPG" 221 | , "Stack.Sig.Sign" 222 | , "Stack.Snapshot" 223 | , "Stack.Solver" 224 | , "Stack.StoreTH" 225 | , "Stack.Types.Build" 226 | , "Stack.Types.BuildPlan" 227 | , "Stack.Types.CompilerBuild" 228 | , "Stack.Types.Urls" 229 | , "Stack.Types.Compiler" 230 | , "Stack.Types.Config" 231 | , "Stack.Types.Config.Build" 232 | , "Stack.Types.Docker" 233 | , "Stack.Types.GhcPkgId" 234 | , "Stack.Types.Image" 235 | , "Stack.Types.NamedComponent" 236 | , "Stack.Types.Nix" 237 | , "Stack.Types.Package" 238 | , "Stack.Types.PackageDump" 239 | , "Stack.Types.PackageName" 240 | , "Stack.Types.PrettyPrint" 241 | , "Stack.Types.Resolver" 242 | , "Stack.Types.Runner" 243 | , "Stack.Types.Sig" 244 | , "Stack.Types.StylesUpdate" 245 | , "Stack.Types.TemplateName" 246 | , "Stack.Types.Version" 247 | , "Stack.Types.VersionIntervals" 248 | , "Stack.Unpack" 249 | , "Stack.Upgrade" 250 | , "Stack.Upload" 251 | , "Text.PrettyPrint.Leijen.Extended" 252 | , "System.Permissions" 253 | , "System.Process.PagerEditor" 254 | , "System.Terminal" 255 | ] 256 | , when = 257 | { condition = "os(windows)" 258 | , `then`.source-dirs = [ "src/windows/" ] 259 | , `else` = 260 | { source-dirs = [ "src/unix/" ] 261 | , c-sources = [ "src/unix/cbits/uname.c" ] 262 | } 263 | } 264 | } 265 | , executables.stack 266 | = 267 | { main = "Main.hs" 268 | , source-dirs = [ "src/main" ] 269 | , generated-other-modules = [ "Build_stack", "Paths_stack" ] 270 | , ghc-options = [ "-threaded", "-rtsopts" ] 271 | , dependencies = [ "stack" ] 272 | , when = 273 | [ { condition = "flag(static)" 274 | , cpp-options = [] : List Text 275 | , dependencies = [] : List Text 276 | , ld-options = [ "-static", "-pthread" ] 277 | } 278 | , { condition = "!(flag(disable-git-info))" 279 | , cpp-options = [ "-DUSE_GIT_INFO" ] 280 | , dependencies = [ "githash", "optparse-simple" ] 281 | , ld-options = [] : List Text 282 | } 283 | , { condition = "flag(hide-dependency-versions)" 284 | , cpp-options = [ "-DHIDE_DEP_VERSIONS" ] 285 | , dependencies = [] : List Text 286 | , ld-options = [] : List Text 287 | } 288 | , { condition = "flag(supported-build)" 289 | , cpp-options = [ "-DSUPPORTED_BUILD" ] 290 | , dependencies = [] : List Text 291 | , ld-options = [] : List Text 292 | } 293 | ] 294 | } 295 | , tests = 296 | { stack-test = 297 | { main = "Spec.hs" 298 | , source-dirs = [ "src/test" ] 299 | , ghc-options = [ "-threaded" ] 300 | , dependencies = [ "QuickCheck", "hspec", "stack", "smallcheck" ] 301 | } 302 | , stack-integration-test = 303 | { main = "IntegrationSpec.hs" 304 | , source-dirs = [ "test/integration", "test/integration/lib" ] 305 | , ghc-options = [ "-threaded", "-rtsopts", "-with-rtsopts=-N" ] 306 | , dependencies = [ "hspec" ] 307 | , when = { condition = "!flag(integration-tests)", buildable = False } 308 | } 309 | } 310 | , flags = 311 | { static = 312 | { description = 313 | "Pass -static/-pthread to ghc when linking the stack binary." 314 | , manual = True 315 | , default = False 316 | } 317 | , disable-git-info = 318 | { description = 319 | "Disable compile-time inclusion of current git info in stack" 320 | , manual = True 321 | , default = False 322 | } 323 | , hide-dependency-versions = 324 | { description = 325 | "Hides dependency versions from \"stack --version\", used only by building with stack.yaml" 326 | , manual = True 327 | , default = False 328 | } 329 | , integration-tests = 330 | { description = "Run the integration test suite" 331 | , manual = True 332 | , default = False 333 | } 334 | , supported-build = 335 | { description = 336 | "If false, causes \"stack --version\" to issue a warning about the build being unsupported. True only if building with stack.yaml" 337 | , manual = True 338 | , default = False 339 | } 340 | } 341 | } -------------------------------------------------------------------------------- /hpack-dhall.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.dhall by hpack version 0.36.0. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | 7 | name: hpack-dhall 8 | version: 0.5.8 9 | synopsis: hpack's dhalling 10 | description: Use hpack phrasing in dhall to write cabal files. 11 | . 12 | There are two main reasons why you'd use hpack-dhall, convenience and safety. 13 | . 14 | Get the convenience of hpack. Don't bother to state what can be inferred or 15 | defaulted, easing the burden of completing a package description by hand. For 16 | example `other-modules` can be inferred by taking the set difference between 17 | modules on disk and the set of `exposed-modules`. 18 | . 19 | Get the safety of dhall's programmable configuration: typed fields, safe imports 20 | and functions. 21 | category: Development 22 | homepage: https://github.com/cabalism/hpack-dhall#readme 23 | bug-reports: https://github.com/cabalism/hpack-dhall/issues 24 | maintainer: Phil de Joux 25 | copyright: © 2018 - 2024 Phil de Joux, © 2018 - 2024 Block Scope Limited 26 | license: BSD3 27 | license-file: LICENSE 28 | build-type: Simple 29 | tested-with: 30 | GHC == 9.2.8, GHC == 9.4.8, GHC == 9.6.5, GHC == 9.8.2 31 | extra-source-files: 32 | package.dhall 33 | changelog.md 34 | test-suite-golden/test-files/key/empty-inferred/package.dhall 35 | test-suite-golden/test-files/key/empty-package.dhall 36 | test-suite-golden/test-files/key/import-local/package.dhall 37 | test-suite-golden/test-files/key/import-relative/package.dhall 38 | test-suite-golden/test-files/key/when-dependencies.dhall 39 | test-suite-golden/test-files/key/with-GHC2021.dhall 40 | test-suite-golden/test-files/real-world/hpack/hpack.dhall 41 | test-suite-golden/test-files/real-world/stack/stack.dhall 42 | test-suite-golden/test-files/key/import-local/name.dhl 43 | test-suite-golden/test-files/key/import-relative.dhl 44 | test-suite-golden/test-files/key/empty-inferred/empty-inferred.cabal 45 | test-suite-golden/test-files/key/empty-inferred/package.yaml.cabal 46 | test-suite-golden/test-files/key/empty-package.cabal 47 | test-suite-golden/test-files/key/empty-package.yaml.cabal 48 | test-suite-golden/test-files/key/import-local/import-local.cabal 49 | test-suite-golden/test-files/key/import-local/package.yaml.cabal 50 | test-suite-golden/test-files/key/import-relative/import-relative.cabal 51 | test-suite-golden/test-files/key/import-relative/package.yaml.cabal 52 | test-suite-golden/test-files/key/when-dependencies.cabal 53 | test-suite-golden/test-files/key/when-dependencies.yaml.cabal 54 | test-suite-golden/test-files/key/with-GHC2021.cabal 55 | test-suite-golden/test-files/key/with-GHC2021.yaml.cabal 56 | test-suite-golden/test-files/real-world/hpack/hpack.cabal 57 | test-suite-golden/test-files/real-world/hpack/hpack.yaml.cabal 58 | test-suite-golden/test-files/real-world/stack/stack.cabal 59 | test-suite-golden/test-files/real-world/stack/stack.yaml.cabal 60 | test-suite-golden/test-files/key/empty-inferred/package.json 61 | test-suite-golden/test-files/key/empty-package.json 62 | test-suite-golden/test-files/key/import-local/package.json 63 | test-suite-golden/test-files/key/import-relative/package.json 64 | test-suite-golden/test-files/key/when-dependencies.json 65 | test-suite-golden/test-files/key/with-GHC2021.json 66 | test-suite-golden/test-files/real-world/hpack/hpack.json 67 | test-suite-golden/test-files/real-world/stack/stack.json 68 | test-suite-golden/test-files/key/empty-inferred/package.yaml 69 | test-suite-golden/test-files/key/empty-package.yaml 70 | test-suite-golden/test-files/key/import-local/package.yaml 71 | test-suite-golden/test-files/key/import-relative/package.yaml 72 | test-suite-golden/test-files/key/when-dependencies.yaml 73 | test-suite-golden/test-files/key/with-GHC2021.yaml 74 | test-suite-golden/test-files/real-world/hpack/hpack.yaml 75 | test-suite-golden/test-files/real-world/hpack/package.yaml 76 | test-suite-golden/test-files/real-world/stack/package.yaml 77 | test-suite-golden/test-files/real-world/stack/stack.yaml 78 | test-suite-golden/test-files/key/empty-inferred/empty-inferred.cabal.golden 79 | test-suite-golden/test-files/key/empty-inferred/package.dhall-1.32.golden 80 | test-suite-golden/test-files/key/empty-inferred/package.dhall-1.34.golden 81 | test-suite-golden/test-files/key/empty-inferred/package.json.golden 82 | test-suite-golden/test-files/key/empty-inferred/package.yaml.golden 83 | test-suite-golden/test-files/key/empty-package.cabal.golden 84 | test-suite-golden/test-files/key/empty-package.dhall-1.32.golden 85 | test-suite-golden/test-files/key/empty-package.dhall-1.34.golden 86 | test-suite-golden/test-files/key/empty-package.json.golden 87 | test-suite-golden/test-files/key/empty-package.yaml.golden 88 | test-suite-golden/test-files/key/import-local/import-local.cabal.golden 89 | test-suite-golden/test-files/key/import-local/package.dhall-1.32.golden 90 | test-suite-golden/test-files/key/import-local/package.dhall-1.34.golden 91 | test-suite-golden/test-files/key/import-local/package.json.golden 92 | test-suite-golden/test-files/key/import-local/package.yaml.golden 93 | test-suite-golden/test-files/key/import-relative/import-relative.cabal.golden 94 | test-suite-golden/test-files/key/import-relative/package.dhall-1.32.golden 95 | test-suite-golden/test-files/key/import-relative/package.dhall-1.34.golden 96 | test-suite-golden/test-files/key/import-relative/package.json.golden 97 | test-suite-golden/test-files/key/import-relative/package.yaml.golden 98 | test-suite-golden/test-files/key/when-dependencies.cabal.golden 99 | test-suite-golden/test-files/key/when-dependencies.dhall-1.32.golden 100 | test-suite-golden/test-files/key/when-dependencies.dhall-1.34.golden 101 | test-suite-golden/test-files/key/when-dependencies.json.golden 102 | test-suite-golden/test-files/key/when-dependencies.yaml.golden 103 | test-suite-golden/test-files/key/with-GHC2021.cabal.golden 104 | test-suite-golden/test-files/key/with-GHC2021.dhall-1.34.golden 105 | test-suite-golden/test-files/key/with-GHC2021.json.golden 106 | test-suite-golden/test-files/key/with-GHC2021.yaml.golden 107 | test-suite-golden/test-files/real-world/hpack/hpack.cabal.golden 108 | test-suite-golden/test-files/real-world/hpack/hpack.dhall-1.32.golden 109 | test-suite-golden/test-files/real-world/hpack/hpack.dhall-1.34.golden 110 | test-suite-golden/test-files/real-world/hpack/hpack.json.golden 111 | test-suite-golden/test-files/real-world/hpack/hpack.yaml.golden 112 | test-suite-golden/test-files/real-world/stack/stack.cabal.golden 113 | test-suite-golden/test-files/real-world/stack/stack.dhall-1.32.golden 114 | test-suite-golden/test-files/real-world/stack/stack.dhall-1.34.golden 115 | test-suite-golden/test-files/real-world/stack/stack.json.golden 116 | test-suite-golden/test-files/real-world/stack/stack.yaml.golden 117 | 118 | source-repository head 119 | type: git 120 | location: https://github.com/cabalism/hpack-dhall 121 | 122 | library 123 | exposed-modules: 124 | Hpack.Dhall 125 | Hpack.Fields 126 | other-modules: 127 | Paths_hpack_dhall 128 | hs-source-dirs: 129 | library 130 | ghc-options: -Wall -Wincomplete-uni-patterns -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths 131 | build-depends: 132 | aeson 133 | , aeson-pretty 134 | , base >=4.13 && <5 135 | , bytestring 136 | , dhall >=1.41.1 137 | , dhall-json >=1.7.10 138 | , filepath 139 | , hpack ==0.36.* 140 | , megaparsec >=9.2 141 | , microlens 142 | , prettyprinter 143 | , text 144 | , transformers 145 | , yaml 146 | default-language: Haskell2010 147 | 148 | executable dhall-hpack-cabal 149 | main-is: CabalMain.hs 150 | other-modules: 151 | Hpack.Dhall 152 | Hpack.Fields 153 | Options 154 | Paths_hpack_dhall 155 | hs-source-dirs: 156 | library 157 | exe/options 158 | exe/dhall-hpack-cabal 159 | ghc-options: -Wall -Wincomplete-uni-patterns -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths 160 | build-depends: 161 | aeson 162 | , aeson-pretty 163 | , base >=4.13 && <5 164 | , bytestring 165 | , dhall >=1.41.1 166 | , dhall-json >=1.7.10 167 | , filepath 168 | , hpack ==0.36.* 169 | , megaparsec >=9.2 170 | , microlens 171 | , optparse-applicative 172 | , prettyprinter 173 | , text 174 | , transformers 175 | , yaml 176 | default-language: Haskell2010 177 | 178 | executable dhall-hpack-dhall 179 | main-is: DhallMain.hs 180 | other-modules: 181 | Hpack.Dhall 182 | Hpack.Fields 183 | Options 184 | Paths_hpack_dhall 185 | hs-source-dirs: 186 | library 187 | exe/options 188 | exe/dhall-hpack-dhall 189 | ghc-options: -Wall -Wincomplete-uni-patterns -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths 190 | build-depends: 191 | aeson 192 | , aeson-pretty 193 | , base >=4.13 && <5 194 | , bytestring 195 | , dhall >=1.41.1 196 | , dhall-json >=1.7.10 197 | , filepath 198 | , hpack ==0.36.* 199 | , megaparsec >=9.2 200 | , microlens 201 | , optparse-applicative 202 | , prettyprinter 203 | , text 204 | , transformers 205 | , yaml 206 | default-language: Haskell2010 207 | 208 | executable dhall-hpack-json 209 | main-is: JsonMain.hs 210 | other-modules: 211 | Hpack.Dhall 212 | Hpack.Fields 213 | Options 214 | Paths_hpack_dhall 215 | hs-source-dirs: 216 | library 217 | exe/options 218 | exe/dhall-hpack-json 219 | ghc-options: -Wall -Wincomplete-uni-patterns -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths 220 | build-depends: 221 | aeson 222 | , aeson-pretty 223 | , base >=4.13 && <5 224 | , bytestring 225 | , dhall >=1.41.1 226 | , dhall-json >=1.7.10 227 | , filepath 228 | , hpack ==0.36.* 229 | , megaparsec >=9.2 230 | , microlens 231 | , optparse-applicative 232 | , prettyprinter 233 | , text 234 | , transformers 235 | , yaml 236 | default-language: Haskell2010 237 | 238 | executable dhall-hpack-yaml 239 | main-is: YamlMain.hs 240 | other-modules: 241 | Hpack.Dhall 242 | Hpack.Fields 243 | Options 244 | Paths_hpack_dhall 245 | hs-source-dirs: 246 | library 247 | exe/options 248 | exe/dhall-hpack-yaml 249 | ghc-options: -Wall -Wincomplete-uni-patterns -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths 250 | build-depends: 251 | aeson 252 | , aeson-pretty 253 | , base >=4.13 && <5 254 | , bytestring 255 | , dhall >=1.41.1 256 | , dhall-json >=1.7.10 257 | , filepath 258 | , hpack ==0.36.* 259 | , megaparsec >=9.2 260 | , microlens 261 | , optparse-applicative 262 | , prettyprinter 263 | , text 264 | , transformers 265 | , yaml 266 | default-language: Haskell2010 267 | 268 | test-suite golden 269 | type: exitcode-stdio-1.0 270 | main-is: Golden.hs 271 | other-modules: 272 | Hpack.Dhall 273 | Hpack.Fields 274 | Paths_hpack_dhall 275 | hs-source-dirs: 276 | library 277 | test-suite-golden/src 278 | ghc-options: -Wall -Wincomplete-uni-patterns -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths 279 | build-depends: 280 | Cabal 281 | , Diff 282 | , aeson 283 | , aeson-pretty 284 | , base >=4.13 && <5 285 | , bytestring 286 | , dhall >=1.41.1 287 | , dhall-json >=1.7.10 288 | , directory 289 | , filepath 290 | , hpack ==0.36.* 291 | , megaparsec >=9.2 292 | , microlens 293 | , prettyprinter 294 | , tasty 295 | , tasty-golden 296 | , text 297 | , transformers 298 | , utf8-string 299 | , yaml 300 | default-language: Haskell2010 301 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/stack.dhall: -------------------------------------------------------------------------------- 1 | { name = 2 | "stack" 3 | , version = 4 | "1.10.0" 5 | , synopsis = 6 | "The Haskell Tool Stack" 7 | , description = 8 | '' 9 | Please see the README.md for usage information, and 10 | the wiki on Github for more details. Also, note that 11 | the API for the library is not currently stable, and may 12 | change significantly, even between minor releases. It is 13 | currently only intended for use by the executable.'' 14 | , category = 15 | "Development" 16 | , author = 17 | "Commercial Haskell SIG" 18 | , maintainer = 19 | "manny@fpcomplete.com" 20 | , license = 21 | "BSD3" 22 | , github = 23 | "commercialhaskell/stack" 24 | , homepage = 25 | "http://haskellstack.org" 26 | , custom-setup = 27 | { dependencies = [ "base >=4.10 && < 5", "Cabal >= 2.4", "filepath" ] } 28 | , extra-source-files = 29 | [ "CONTRIBUTING.md" 30 | , "ChangeLog.md" 31 | , "README.md" 32 | , "doc/*.md" 33 | , "src/setup-shim/StackSetupShim.hs" 34 | , "stack.yaml" 35 | , "test/package-dump/ghc-7.10.txt" 36 | , "test/package-dump/ghc-7.8.4-osx.txt" 37 | , "test/package-dump/ghc-7.8.txt" 38 | ] 39 | , ghc-options = 40 | [ "-Wall" 41 | , "-fwarn-tabs" 42 | , "-fwarn-incomplete-uni-patterns" 43 | , "-fwarn-incomplete-record-updates" 44 | , "-optP-Wno-nonportable-include-path # workaround [Filename case on macOS \u00B7 Issue #4739 \u00B7 haskell/cabal](https://github.com/haskell/cabal/issues/4739)" 45 | ] 46 | , dependencies = 47 | [ "Cabal >= 2.4" 48 | , "aeson" 49 | , "annotated-wl-pprint" 50 | , "ansi-terminal >= 0.8.1" 51 | , "array" 52 | , "async" 53 | , "attoparsec" 54 | , "base >=4.10 && < 5" 55 | , "base64-bytestring" 56 | , "bytestring" 57 | , "colour" 58 | , "conduit" 59 | , "conduit-extra" 60 | , "containers" 61 | , "cryptonite" 62 | , "cryptonite-conduit" 63 | , "deepseq" 64 | , "directory" 65 | , "echo" 66 | , "exceptions" 67 | , "extra" 68 | , "file-embed" 69 | , "filelock" 70 | , "filepath" 71 | , "fsnotify" 72 | , "generic-deriving" 73 | , "hackage-security" 74 | , "hashable" 75 | , "hpack" 76 | , "hpc" 77 | , "http-client" 78 | , "http-client-tls" 79 | , "http-conduit" 80 | , "http-types" 81 | , "memory" 82 | , "microlens" 83 | , "mintty" 84 | , "monad-logger" 85 | , "mono-traversable" 86 | , "mtl" 87 | , "mustache" 88 | , "neat-interpolation" 89 | , "network-uri" 90 | , "open-browser" 91 | , "optparse-applicative" 92 | , "pantry" 93 | , "path" 94 | , "path-io" 95 | , "persistent" 96 | , "persistent-sqlite" 97 | , "persistent-template" 98 | , "pretty" 99 | , "primitive" 100 | , "process" 101 | , "project-template" 102 | , "regex-applicative-text" 103 | , "resourcet" 104 | , "retry >= 0.7" 105 | , "rio" 106 | , "semigroups" 107 | , "split" 108 | , "stm" 109 | , "store-core" 110 | , "streaming-commons" 111 | , "tar" 112 | , "template-haskell" 113 | , "temporary" 114 | , "text" 115 | , "text-metrics" 116 | , "th-reify-many" 117 | , "time" 118 | , "tls" 119 | , "transformers" 120 | , "typed-process" 121 | , "unicode-transforms" 122 | , "unix-compat" 123 | , "unliftio >= 0.2.8.0" 124 | , "unordered-containers" 125 | , "vector" 126 | , "yaml" 127 | , "zip-archive" 128 | , "zlib" 129 | ] 130 | , when = 131 | { condition = 132 | "os(windows)" 133 | , `then` = 134 | { cpp-options = [ "-DWINDOWS" ], dependencies = [ "Win32" ] } 135 | , `else` = 136 | { build-tools = [ "hsc2hs" ], dependencies = [ "unix" ] } 137 | } 138 | , library = 139 | { source-dirs = 140 | "src/" 141 | , ghc-options = 142 | [ "-fwarn-identities" ] 143 | , generated-exposed-modules = 144 | [ "Paths_stack" ] 145 | , exposed-modules = 146 | [ "Control.Concurrent.Execute" 147 | , "Data.Attoparsec.Args" 148 | , "Data.Attoparsec.Combinators" 149 | , "Data.Attoparsec.Interpreter" 150 | , "Data.Monoid.Map" 151 | , "Network.HTTP.Download" 152 | , "Network.HTTP.Download.Verified" 153 | , "Network.HTTP.StackClient" 154 | , "Options.Applicative.Args" 155 | , "Options.Applicative.Builder.Extra" 156 | , "Options.Applicative.Complicated" 157 | , "Path.CheckInstall" 158 | , "Path.Extra" 159 | , "Path.Find" 160 | , "Stack.Build" 161 | , "Stack.Build.Cache" 162 | , "Stack.Build.ConstructPlan" 163 | , "Stack.Build.Execute" 164 | , "Stack.Build.Haddock" 165 | , "Stack.Build.Installed" 166 | , "Stack.Build.Source" 167 | , "Stack.Build.Target" 168 | , "Stack.BuildPlan" 169 | , "Stack.Clean" 170 | , "Stack.Config" 171 | , "Stack.Config.Build" 172 | , "Stack.Config.Urls" 173 | , "Stack.Config.Docker" 174 | , "Stack.Config.Nix" 175 | , "Stack.ConfigCmd" 176 | , "Stack.Constants" 177 | , "Stack.Constants.Config" 178 | , "Stack.Coverage" 179 | , "Stack.DefaultColorWhen" 180 | , "Stack.DefaultStyles" 181 | , "Stack.Docker" 182 | , "Stack.Docker.GlobalDB" 183 | , "Stack.Dot" 184 | , "Stack.FileWatch" 185 | , "Stack.Freeze" 186 | , "Stack.GhcPkg" 187 | , "Stack.Ghci" 188 | , "Stack.Ghci.Script" 189 | , "Stack.Hoogle" 190 | , "Stack.IDE" 191 | , "Stack.Image" 192 | , "Stack.Init" 193 | , "Stack.Ls" 194 | , "Stack.New" 195 | , "Stack.Nix" 196 | , "Stack.Options.BenchParser" 197 | , "Stack.Options.BuildMonoidParser" 198 | , "Stack.Options.BuildParser" 199 | , "Stack.Options.CleanParser" 200 | , "Stack.Options.ConfigParser" 201 | , "Stack.Options.Completion" 202 | , "Stack.Options.DockerParser" 203 | , "Stack.Options.DotParser" 204 | , "Stack.Options.ExecParser" 205 | , "Stack.Options.FreezeParser" 206 | , "Stack.Options.GhcBuildParser" 207 | , "Stack.Options.GhciParser" 208 | , "Stack.Options.GhcVariantParser" 209 | , "Stack.Options.GlobalParser" 210 | , "Stack.Options.HaddockParser" 211 | , "Stack.Options.HpcReportParser" 212 | , "Stack.Options.LogLevelParser" 213 | , "Stack.Options.NewParser" 214 | , "Stack.Options.NixParser" 215 | , "Stack.Options.PackageParser" 216 | , "Stack.Options.ResolverParser" 217 | , "Stack.Options.ScriptParser" 218 | , "Stack.Options.SDistParser" 219 | , "Stack.Options.SolverParser" 220 | , "Stack.Options.TestParser" 221 | , "Stack.Options.Utils" 222 | , "Stack.Package" 223 | , "Stack.PackageDump" 224 | , "Stack.Path" 225 | , "Stack.Prelude" 226 | , "Stack.PrettyPrint" 227 | , "Stack.Runners" 228 | , "Stack.Script" 229 | , "Stack.SDist" 230 | , "Stack.Setup" 231 | , "Stack.Setup.Installed" 232 | , "Stack.SetupCmd" 233 | , "Stack.Sig" 234 | , "Stack.Sig.GPG" 235 | , "Stack.Sig.Sign" 236 | , "Stack.Snapshot" 237 | , "Stack.Solver" 238 | , "Stack.StoreTH" 239 | , "Stack.Types.Build" 240 | , "Stack.Types.BuildPlan" 241 | , "Stack.Types.CompilerBuild" 242 | , "Stack.Types.Urls" 243 | , "Stack.Types.Compiler" 244 | , "Stack.Types.Config" 245 | , "Stack.Types.Config.Build" 246 | , "Stack.Types.Docker" 247 | , "Stack.Types.GhcPkgId" 248 | , "Stack.Types.Image" 249 | , "Stack.Types.NamedComponent" 250 | , "Stack.Types.Nix" 251 | , "Stack.Types.Package" 252 | , "Stack.Types.PackageDump" 253 | , "Stack.Types.PackageName" 254 | , "Stack.Types.PrettyPrint" 255 | , "Stack.Types.Resolver" 256 | , "Stack.Types.Runner" 257 | , "Stack.Types.Sig" 258 | , "Stack.Types.StylesUpdate" 259 | , "Stack.Types.TemplateName" 260 | , "Stack.Types.Version" 261 | , "Stack.Types.VersionIntervals" 262 | , "Stack.Unpack" 263 | , "Stack.Upgrade" 264 | , "Stack.Upload" 265 | , "Text.PrettyPrint.Leijen.Extended" 266 | , "System.Permissions" 267 | , "System.Process.PagerEditor" 268 | , "System.Terminal" 269 | ] 270 | , when = 271 | { condition = 272 | "os(windows)" 273 | , `then` = 274 | { source-dirs = [ "src/windows/" ] } 275 | , `else` = 276 | { source-dirs = 277 | [ "src/unix/" ] 278 | , c-sources = 279 | [ "src/unix/cbits/uname.c" ] 280 | } 281 | } 282 | } 283 | , executables = 284 | { stack = 285 | { main = 286 | "Main.hs" 287 | , source-dirs = 288 | [ "src/main" ] 289 | , generated-other-modules = 290 | [ "Build_stack", "Paths_stack" ] 291 | , ghc-options = 292 | [ "-threaded", "-rtsopts" ] 293 | , dependencies = 294 | [ "stack" ] 295 | , when = 296 | [ { condition = 297 | "flag(static)" 298 | , cpp-options = 299 | [] : List Text 300 | , dependencies = 301 | [] : List Text 302 | , ld-options = 303 | [ "-static", "-pthread" ] 304 | } 305 | , { condition = 306 | "!(flag(disable-git-info))" 307 | , cpp-options = 308 | [ "-DUSE_GIT_INFO" ] 309 | , dependencies = 310 | [ "githash", "optparse-simple" ] 311 | , ld-options = 312 | [] : List Text 313 | } 314 | , { condition = 315 | "flag(hide-dependency-versions)" 316 | , cpp-options = 317 | [ "-DHIDE_DEP_VERSIONS" ] 318 | , dependencies = 319 | [] : List Text 320 | , ld-options = 321 | [] : List Text 322 | } 323 | , { condition = 324 | "flag(supported-build)" 325 | , cpp-options = 326 | [ "-DSUPPORTED_BUILD" ] 327 | , dependencies = 328 | [] : List Text 329 | , ld-options = 330 | [] : List Text 331 | } 332 | ] 333 | } 334 | } 335 | , tests = 336 | { stack-test = 337 | { main = 338 | "Spec.hs" 339 | , source-dirs = 340 | [ "src/test" ] 341 | , ghc-options = 342 | [ "-threaded" ] 343 | , dependencies = 344 | [ "QuickCheck", "hspec", "stack", "smallcheck" ] 345 | } 346 | , stack-integration-test = 347 | { main = 348 | "IntegrationSpec.hs" 349 | , source-dirs = 350 | [ "test/integration", "test/integration/lib" ] 351 | , ghc-options = 352 | [ "-threaded", "-rtsopts", "-with-rtsopts=-N" ] 353 | , dependencies = 354 | [ "hspec" ] 355 | , when = 356 | { condition = "!flag(integration-tests)", buildable = False } 357 | } 358 | } 359 | , flags = 360 | { static = 361 | { description = 362 | "Pass -static/-pthread to ghc when linking the stack binary." 363 | , manual = 364 | True 365 | , default = 366 | False 367 | } 368 | , disable-git-info = 369 | { description = 370 | "Disable compile-time inclusion of current git info in stack" 371 | , manual = 372 | True 373 | , default = 374 | False 375 | } 376 | , hide-dependency-versions = 377 | { description = 378 | "Hides dependency versions from \"stack --version\", used only by building with stack.yaml" 379 | , manual = 380 | True 381 | , default = 382 | False 383 | } 384 | , integration-tests = 385 | { description = 386 | "Run the integration test suite" 387 | , manual = 388 | True 389 | , default = 390 | False 391 | } 392 | , supported-build = 393 | { description = 394 | "If false, causes \"stack --version\" to issue a warning about the build being unsupported. True only if building with stack.yaml" 395 | , manual = 396 | True 397 | , default = 398 | False 399 | } 400 | } 401 | } 402 | -------------------------------------------------------------------------------- /test-suite-golden/test-files/real-world/stack/stack.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stack", 3 | "version": "1.10.0", 4 | "synopsis": "The Haskell Tool Stack", 5 | "description": "Please see the README.md for usage information, and\nthe wiki on Github for more details. Also, note that\nthe API for the library is not currently stable, and may\nchange significantly, even between minor releases. It is\ncurrently only intended for use by the executable.", 6 | "category": "Development", 7 | "homepage": "http://haskellstack.org", 8 | "author": "Commercial Haskell SIG", 9 | "maintainer": "manny@fpcomplete.com", 10 | "license": "BSD3", 11 | "github": "commercialhaskell/stack", 12 | "extra-source-files": [ 13 | "CONTRIBUTING.md", 14 | "ChangeLog.md", 15 | "README.md", 16 | "doc/*.md", 17 | "src/setup-shim/StackSetupShim.hs", 18 | "stack.yaml", 19 | "test/package-dump/ghc-7.10.txt", 20 | "test/package-dump/ghc-7.8.4-osx.txt", 21 | "test/package-dump/ghc-7.8.txt" 22 | ], 23 | "ghc-options": [ 24 | "-Wall", 25 | "-fwarn-tabs", 26 | "-fwarn-incomplete-uni-patterns", 27 | "-fwarn-incomplete-record-updates", 28 | "-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue #4739 · haskell/cabal](https://github.com/haskell/cabal/issues/4739)" 29 | ], 30 | "dependencies": [ 31 | "Cabal >= 2.4", 32 | "aeson", 33 | "annotated-wl-pprint", 34 | "ansi-terminal >= 0.8.1", 35 | "array", 36 | "async", 37 | "attoparsec", 38 | "base >=4.10 && < 5", 39 | "base64-bytestring", 40 | "bytestring", 41 | "colour", 42 | "conduit", 43 | "conduit-extra", 44 | "containers", 45 | "cryptonite", 46 | "cryptonite-conduit", 47 | "deepseq", 48 | "directory", 49 | "echo", 50 | "exceptions", 51 | "extra", 52 | "file-embed", 53 | "filelock", 54 | "filepath", 55 | "fsnotify", 56 | "generic-deriving", 57 | "hackage-security", 58 | "hashable", 59 | "hpack", 60 | "hpc", 61 | "http-client", 62 | "http-client-tls", 63 | "http-conduit", 64 | "http-types", 65 | "memory", 66 | "microlens", 67 | "mintty", 68 | "monad-logger", 69 | "mono-traversable", 70 | "mtl", 71 | "mustache", 72 | "neat-interpolation", 73 | "network-uri", 74 | "open-browser", 75 | "optparse-applicative", 76 | "pantry", 77 | "path", 78 | "path-io", 79 | "persistent", 80 | "persistent-sqlite", 81 | "persistent-template", 82 | "pretty", 83 | "primitive", 84 | "process", 85 | "project-template", 86 | "regex-applicative-text", 87 | "resourcet", 88 | "retry >= 0.7", 89 | "rio", 90 | "semigroups", 91 | "split", 92 | "stm", 93 | "store-core", 94 | "streaming-commons", 95 | "tar", 96 | "template-haskell", 97 | "temporary", 98 | "text", 99 | "text-metrics", 100 | "th-reify-many", 101 | "time", 102 | "tls", 103 | "transformers", 104 | "typed-process", 105 | "unicode-transforms", 106 | "unix-compat", 107 | "unliftio >= 0.2.8.0", 108 | "unordered-containers", 109 | "vector", 110 | "yaml", 111 | "zip-archive", 112 | "zlib" 113 | ], 114 | "when": { 115 | "condition": "os(windows)", 116 | "then": { 117 | "cpp-options": [ 118 | "-DWINDOWS" 119 | ], 120 | "dependencies": [ 121 | "Win32" 122 | ] 123 | }, 124 | "else": { 125 | "dependencies": [ 126 | "unix" 127 | ], 128 | "build-tools": [ 129 | "hsc2hs" 130 | ] 131 | } 132 | }, 133 | "custom-setup": { 134 | "dependencies": [ 135 | "base >=4.10 && < 5", 136 | "Cabal >= 2.4", 137 | "filepath" 138 | ] 139 | }, 140 | "flags": { 141 | "disable-git-info": { 142 | "description": "Disable compile-time inclusion of current git info in stack", 143 | "manual": true, 144 | "default": false 145 | }, 146 | "hide-dependency-versions": { 147 | "description": "Hides dependency versions from \"stack --version\", used only by building with stack.yaml", 148 | "manual": true, 149 | "default": false 150 | }, 151 | "integration-tests": { 152 | "description": "Run the integration test suite", 153 | "manual": true, 154 | "default": false 155 | }, 156 | "static": { 157 | "description": "Pass -static/-pthread to ghc when linking the stack binary.", 158 | "manual": true, 159 | "default": false 160 | }, 161 | "supported-build": { 162 | "description": "If false, causes \"stack --version\" to issue a warning about the build being unsupported. True only if building with stack.yaml", 163 | "manual": true, 164 | "default": false 165 | } 166 | }, 167 | "library": { 168 | "exposed-modules": [ 169 | "Control.Concurrent.Execute", 170 | "Data.Attoparsec.Args", 171 | "Data.Attoparsec.Combinators", 172 | "Data.Attoparsec.Interpreter", 173 | "Data.Monoid.Map", 174 | "Network.HTTP.Download", 175 | "Network.HTTP.Download.Verified", 176 | "Network.HTTP.StackClient", 177 | "Options.Applicative.Args", 178 | "Options.Applicative.Builder.Extra", 179 | "Options.Applicative.Complicated", 180 | "Path.CheckInstall", 181 | "Path.Extra", 182 | "Path.Find", 183 | "Stack.Build", 184 | "Stack.Build.Cache", 185 | "Stack.Build.ConstructPlan", 186 | "Stack.Build.Execute", 187 | "Stack.Build.Haddock", 188 | "Stack.Build.Installed", 189 | "Stack.Build.Source", 190 | "Stack.Build.Target", 191 | "Stack.BuildPlan", 192 | "Stack.Clean", 193 | "Stack.Config", 194 | "Stack.Config.Build", 195 | "Stack.Config.Urls", 196 | "Stack.Config.Docker", 197 | "Stack.Config.Nix", 198 | "Stack.ConfigCmd", 199 | "Stack.Constants", 200 | "Stack.Constants.Config", 201 | "Stack.Coverage", 202 | "Stack.DefaultColorWhen", 203 | "Stack.DefaultStyles", 204 | "Stack.Docker", 205 | "Stack.Docker.GlobalDB", 206 | "Stack.Dot", 207 | "Stack.FileWatch", 208 | "Stack.Freeze", 209 | "Stack.GhcPkg", 210 | "Stack.Ghci", 211 | "Stack.Ghci.Script", 212 | "Stack.Hoogle", 213 | "Stack.IDE", 214 | "Stack.Image", 215 | "Stack.Init", 216 | "Stack.Ls", 217 | "Stack.New", 218 | "Stack.Nix", 219 | "Stack.Options.BenchParser", 220 | "Stack.Options.BuildMonoidParser", 221 | "Stack.Options.BuildParser", 222 | "Stack.Options.CleanParser", 223 | "Stack.Options.ConfigParser", 224 | "Stack.Options.Completion", 225 | "Stack.Options.DockerParser", 226 | "Stack.Options.DotParser", 227 | "Stack.Options.ExecParser", 228 | "Stack.Options.FreezeParser", 229 | "Stack.Options.GhcBuildParser", 230 | "Stack.Options.GhciParser", 231 | "Stack.Options.GhcVariantParser", 232 | "Stack.Options.GlobalParser", 233 | "Stack.Options.HaddockParser", 234 | "Stack.Options.HpcReportParser", 235 | "Stack.Options.LogLevelParser", 236 | "Stack.Options.NewParser", 237 | "Stack.Options.NixParser", 238 | "Stack.Options.PackageParser", 239 | "Stack.Options.ResolverParser", 240 | "Stack.Options.ScriptParser", 241 | "Stack.Options.SDistParser", 242 | "Stack.Options.SolverParser", 243 | "Stack.Options.TestParser", 244 | "Stack.Options.Utils", 245 | "Stack.Package", 246 | "Stack.PackageDump", 247 | "Stack.Path", 248 | "Stack.Prelude", 249 | "Stack.PrettyPrint", 250 | "Stack.Runners", 251 | "Stack.Script", 252 | "Stack.SDist", 253 | "Stack.Setup", 254 | "Stack.Setup.Installed", 255 | "Stack.SetupCmd", 256 | "Stack.Sig", 257 | "Stack.Sig.GPG", 258 | "Stack.Sig.Sign", 259 | "Stack.Snapshot", 260 | "Stack.Solver", 261 | "Stack.StoreTH", 262 | "Stack.Types.Build", 263 | "Stack.Types.BuildPlan", 264 | "Stack.Types.CompilerBuild", 265 | "Stack.Types.Urls", 266 | "Stack.Types.Compiler", 267 | "Stack.Types.Config", 268 | "Stack.Types.Config.Build", 269 | "Stack.Types.Docker", 270 | "Stack.Types.GhcPkgId", 271 | "Stack.Types.Image", 272 | "Stack.Types.NamedComponent", 273 | "Stack.Types.Nix", 274 | "Stack.Types.Package", 275 | "Stack.Types.PackageDump", 276 | "Stack.Types.PackageName", 277 | "Stack.Types.PrettyPrint", 278 | "Stack.Types.Resolver", 279 | "Stack.Types.Runner", 280 | "Stack.Types.Sig", 281 | "Stack.Types.StylesUpdate", 282 | "Stack.Types.TemplateName", 283 | "Stack.Types.Version", 284 | "Stack.Types.VersionIntervals", 285 | "Stack.Unpack", 286 | "Stack.Upgrade", 287 | "Stack.Upload", 288 | "Text.PrettyPrint.Leijen.Extended", 289 | "System.Permissions", 290 | "System.Process.PagerEditor", 291 | "System.Terminal" 292 | ], 293 | "generated-exposed-modules": [ 294 | "Paths_stack" 295 | ], 296 | "source-dirs": "src/", 297 | "ghc-options": [ 298 | "-fwarn-identities" 299 | ], 300 | "when": { 301 | "condition": "os(windows)", 302 | "then": { 303 | "source-dirs": [ 304 | "src/windows/" 305 | ] 306 | }, 307 | "else": { 308 | "source-dirs": [ 309 | "src/unix/" 310 | ], 311 | "c-sources": [ 312 | "src/unix/cbits/uname.c" 313 | ] 314 | } 315 | } 316 | }, 317 | "executables": { 318 | "stack": { 319 | "main": "Main.hs", 320 | "generated-other-modules": [ 321 | "Build_stack", 322 | "Paths_stack" 323 | ], 324 | "source-dirs": [ 325 | "src/main" 326 | ], 327 | "ghc-options": [ 328 | "-threaded", 329 | "-rtsopts" 330 | ], 331 | "dependencies": [ 332 | "stack" 333 | ], 334 | "when": [ 335 | { 336 | "condition": "flag(static)", 337 | "cpp-options": [], 338 | "ld-options": [ 339 | "-static", 340 | "-pthread" 341 | ], 342 | "dependencies": [] 343 | }, 344 | { 345 | "condition": "!(flag(disable-git-info))", 346 | "cpp-options": [ 347 | "-DUSE_GIT_INFO" 348 | ], 349 | "ld-options": [], 350 | "dependencies": [ 351 | "githash", 352 | "optparse-simple" 353 | ] 354 | }, 355 | { 356 | "condition": "flag(hide-dependency-versions)", 357 | "cpp-options": [ 358 | "-DHIDE_DEP_VERSIONS" 359 | ], 360 | "ld-options": [], 361 | "dependencies": [] 362 | }, 363 | { 364 | "condition": "flag(supported-build)", 365 | "cpp-options": [ 366 | "-DSUPPORTED_BUILD" 367 | ], 368 | "ld-options": [], 369 | "dependencies": [] 370 | } 371 | ] 372 | } 373 | }, 374 | "tests": { 375 | "stack-integration-test": { 376 | "main": "IntegrationSpec.hs", 377 | "source-dirs": [ 378 | "test/integration", 379 | "test/integration/lib" 380 | ], 381 | "ghc-options": [ 382 | "-threaded", 383 | "-rtsopts", 384 | "-with-rtsopts=-N" 385 | ], 386 | "dependencies": [ 387 | "hspec" 388 | ], 389 | "when": { 390 | "condition": "!flag(integration-tests)", 391 | "buildable": false 392 | } 393 | }, 394 | "stack-test": { 395 | "main": "Spec.hs", 396 | "source-dirs": [ 397 | "src/test" 398 | ], 399 | "ghc-options": [ 400 | "-threaded" 401 | ], 402 | "dependencies": [ 403 | "QuickCheck", 404 | "hspec", 405 | "stack", 406 | "smallcheck" 407 | ] 408 | } 409 | } 410 | } 411 | --------------------------------------------------------------------------------