├── .gitignore ├── .travis.yml ├── Changelog.md ├── LICENSE ├── README.md ├── cabal-sdist.nix ├── cabal-to-dhall └── Main.hs ├── cabal.project ├── dhall-to-cabal.cabal ├── dhall-to-cabal.dhall ├── dhall-to-cabal.nix ├── dhall ├── PkgconfigVersionRange │ ├── anyVersion.dhall │ ├── earlierVersion.dhall │ ├── intersectVersionRanges.dhall │ ├── laterVersion.dhall │ ├── orEarlierVersion.dhall │ ├── orLaterVersion.dhall │ ├── thisVersion.dhall │ └── unionVersionRanges.dhall ├── SPDX │ ├── and.dhall │ ├── license.dhall │ ├── licenseVersionOrLater.dhall │ ├── or.dhall │ ├── ref.dhall │ └── refWithFile.dhall ├── Version │ └── v.dhall ├── VersionRange │ ├── anyVersion.dhall │ ├── differenceVersionRanges.dhall │ ├── earlierVersion.dhall │ ├── intersectVersionRanges.dhall │ ├── invertVersionRange.dhall │ ├── laterVersion.dhall │ ├── majorBoundVersion.dhall │ ├── noVersion.dhall │ ├── notThisVersion.dhall │ ├── orEarlierVersion.dhall │ ├── orLaterVersion.dhall │ ├── thisVersion.dhall │ ├── unionVersionRanges.dhall │ └── withinVersion.dhall ├── defaults │ ├── Benchmark.dhall │ ├── BuildInfo.dhall │ ├── CompilerOptions.dhall │ ├── Executable.dhall │ ├── MainLibrary.dhall │ ├── NamedLibrary.dhall │ ├── Package.dhall │ ├── SourceRepo.dhall │ └── TestSuite.dhall ├── prelude.dhall ├── types.dhall ├── types │ ├── Arch.dhall │ ├── Benchmark.dhall │ ├── BuildInfo.dhall │ ├── BuildType.dhall │ ├── Compiler.dhall │ ├── CompilerOptions.dhall │ ├── Config.dhall │ ├── Dependency.dhall │ ├── Executable.dhall │ ├── Extension.dhall │ ├── Flag.dhall │ ├── ForeignLibOption.dhall │ ├── ForeignLibType.dhall │ ├── ForeignLibrary.dhall │ ├── Guarded.dhall │ ├── Language.dhall │ ├── Library.dhall │ ├── LibraryName.dhall │ ├── LibraryVisibility.dhall │ ├── License.dhall │ ├── Mixin.dhall │ ├── ModuleRenaming.dhall │ ├── OS.dhall │ ├── Package.dhall │ ├── PkgconfigVersionRange.dhall │ ├── RepoKind.dhall │ ├── RepoType.dhall │ ├── SPDX.dhall │ ├── SPDX │ │ ├── LicenseExceptionId.dhall │ │ └── LicenseId.dhall │ ├── Scope.dhall │ ├── SetupBuildInfo.dhall │ ├── SourceRepo.dhall │ ├── TestSuite.dhall │ ├── TestType.dhall │ ├── Version.dhall │ ├── VersionRange.dhall │ └── builtin.dhall ├── unconditional.dhall └── utils │ ├── GitHub-project.dhall │ ├── majorVersions.dhall │ ├── mapBuildInfo.dhall │ ├── mapSourceRepos.dhall │ └── package.dhall ├── docs ├── conf.py ├── index.rst ├── requirements.txt └── types.rst ├── exe └── Main.hs ├── golden-tests ├── GoldenTests.hs ├── cabal-to-dhall │ ├── SPDX.cabal │ ├── SPDX.dhall │ ├── autogen-includes.cabal │ ├── autogen-includes.dhall │ ├── benchmark.cabal │ ├── benchmark.dhall │ ├── conditional-dependencies.cabal │ ├── conditional-dependencies.dhall │ ├── default-license-2.2.cabal │ ├── default-license-2.2.dhall │ ├── executable.cabal │ ├── executable.dhall │ ├── extra-dyn-lib-flavours.cabal │ ├── extra-dyn-lib-flavours.dhall │ ├── gh-36.cabal │ ├── gh-36.dhall │ ├── lib-vis-2.cabal │ ├── lib-vis-2.dhall │ ├── lib-vis.cabal │ ├── lib-vis.dhall │ ├── mixins-no-signatures.cabal │ ├── mixins-no-signatures.dhall │ ├── multilib.cabal │ ├── multilib.dhall │ ├── otheros.cabal │ ├── otheros.dhall │ ├── repotypeunknown.cabal │ ├── repotypeunknown.dhall │ ├── simple.cabal │ ├── simple.dhall │ ├── sourcerepo-defaults.cabal │ ├── sourcerepo-defaults.dhall │ ├── unknown-license.cabal │ └── unknown-license.dhall └── dhall-to-cabal │ ├── SPDX.cabal │ ├── SPDX.dhall │ ├── allrightsreserved-2.0.cabal │ ├── allrightsreserved-2.0.dhall │ ├── allrightsreserved-2.2.cabal │ ├── allrightsreserved-2.2.dhall │ ├── compiler-options-order.cabal │ ├── compiler-options-order.dhall │ ├── conditional-dependencies.cabal │ ├── conditional-dependencies.dhall │ ├── default-license-2.2.cabal │ ├── default-license-2.2.dhall │ ├── dhall-to-cabal.cabal │ ├── dhall-to-cabal.dhall │ ├── empty-package.cabal │ ├── empty-package.dhall │ ├── gh-53.cabal │ ├── gh-53.dhall │ ├── gh-55.cabal │ ├── gh-55.dhall │ ├── lib-vis-2.cabal │ ├── lib-vis-2.dhall │ ├── lib-vis.cabal │ ├── lib-vis.dhall │ ├── map-build-info.cabal │ ├── map-build-info.dhall │ ├── map-source-repo.cabal │ ├── map-source-repo.dhall │ ├── mixins-no-signatures.cabal │ ├── mixins-no-signatures.dhall │ ├── multilib.cabal │ ├── multilib.dhall │ ├── nested-conditions.cabal │ └── nested-conditions.dhall ├── lib ├── CabalToDhall.hs ├── Dhall │ └── Extra.hs ├── DhallLocation.hs ├── DhallToCabal.hs └── DhallToCabal │ ├── ConfigTree.hs │ ├── Diff.hs │ ├── FactorType.hs │ └── Util.hs ├── meta └── Main.hs ├── overrides ├── Cabal.nix ├── dhall.nix └── ghc-paths.nix ├── release.nix ├── shell.nix ├── stack.yaml └── tests ├── DhallToCabal └── Tests.hs └── Tests.hs /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | dist/ 3 | *.hi 4 | *.o 5 | dist-newstyle/ 6 | .stack-work/ 7 | .ghc.environment.* 8 | stack.yaml.lock 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: nix 2 | sudo: false 3 | 4 | script: travis_wait 20 nix-build ./shell.nix 5 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | # dhall-to-cabal change log 2 | 3 | ## Next -- [YYYY-MM-DD] 4 | 5 | * Use `dhall` version 1.25. 6 | 7 | * New utility function, `prelude.utils.mapBuildInfo`, which maps over 8 | the common fields of all non-setup components. 9 | 10 | * Port to Cabal 3.0. Included changes: 11 | 12 | * `types.CompilerOptions` now only knows about options for GHC and 13 | GHCJS. 14 | 15 | * `types.Dependency` now has a `library-names` field, to identify 16 | which library components of the dependency package to use. These 17 | can be build with `types.LibraryName`. `prelude.majorVersions` 18 | reflects this with a third parameter. 19 | 20 | * `types.BuildInfo.pkgconfig-depends.version` is now its own type, 21 | `types.PkgconfigVersionRange`. There are functions to construct it 22 | under `prelude.pkg-config`. 23 | 24 | * `prelude.defaults.Library` has been split into `MainLibrary` and 25 | `NamedLibrary`. Use `MainLibrary` in the `library` field, and 26 | `NamedLibrary` in the `sub-libraries` field. 27 | 28 | * New `types.Library` field, `visibility`, and a new type, 29 | `types.LibraryVisibility`. 30 | 31 | * New `types.BuildInfo` fields, `autogen-includes` and 32 | `extra-dyn-lib-flavours`. 33 | 34 | ## 1.3.4.0 -- 2019-07-05 35 | 36 | * Add compatibility for `optparse-applicative-0.15`. 37 | 38 | * Remove `dhall/types/CustomSetup.dhall` in favour of the identical 39 | `dhall/types/SetupBuildInfo.dhall`. 40 | 41 | * `cabal-to-dhall` no longer generates bogus output for an unknown 42 | kind of `source-repository` stanza. 43 | 44 | * Added `dhall/types/ForeignLibOption.dhall`, also available as 45 | `types.ForeignLibOption`, and `--print-type ForeignLibOption`. 46 | Likewise `ForeignLibType`. 47 | 48 | * Support `prettyprinter` 1.3. 49 | 50 | * Teach `--print-type` about `Dependency`, `SetupBuildInfo`, `TestType`, 51 | `Mixin` and `Flag`. 52 | 53 | * Use `dhall` version 1.24. 54 | 55 | ## 1.3.3.0 -- 2019-05-15 56 | 57 | * All constructors that previously took an empty record now use the 58 | new nullary syntax instead. This is a breaking change for user code. 59 | For example, instead of `types.Compiler.GHC {=}`, now you just write 60 | `types.Compiler.GHC`. 61 | 62 | * Use `dhall` version 1.23.0. 63 | 64 | * Educated `--print-type` about `Scope` and `ModuleRenaming`. 65 | 66 | * Fix `cabal-to-dhall` output for unknown licenses using `cabal` spec 67 | version below `2.0`. Now it uses values of type `License.Unknown Text` 68 | for them. 69 | 70 | * Improved `--print-type` and `--print-default` output to use 71 | multi-binding `let`. 72 | 73 | ## 1.3.2.0 -- 2019-02-12 74 | 75 | * Use `dhall` version 1.20.1. 76 | 77 | * `prelude.dhall` no longer provides types (as this isn't supported in 78 | Dhall 1.20.1). Instead, there is now a new `types.dhall` file. 79 | 80 | * `dhall-to-cabal` now accepts`--output-stdout`, `--output-dir-cwd 81 | DIR`, and `--output-dir-input DIR` flags control the destination of 82 | the generated `.cabal` file. `--output-dir-cwd` interprets its 83 | argument relative to the current working directory and 84 | `--output-dir-input` interprets its argument relative to the input 85 | file. 86 | 87 | The default has been changed to `--output-dir-input .`, which writes 88 | to the same directory as the input file; previously it corresponded 89 | to `--output-stdout`. 90 | 91 | ## 1.3.1.0 -- 2018-10-23 92 | 93 | * Allow `Cabal` version 2.4.0.0. There have been consequent changes to 94 | the extensions, compilers and licenses recognised. 95 | 96 | * Allow `dhall` version 1.18. 97 | 98 | * `dhall-to-cabal` and `cabal-to-dhall` now understand the `mixins` 99 | field properly. 100 | 101 | On the Dhall side, `types.ModuleRenaming` has changed significantly: 102 | it is now a union. 103 | 104 | `prelude.types.ModuleRenaming` has been added for convenient access 105 | to the new constructors. 106 | 107 | * Fix issue with alpha-normalized expressions. This was identified in issue #124 108 | and fixed in issue #126. 109 | 110 | 111 | ## 1.3.0.1 -- 2018-08-10 112 | 113 | ### Distribution Changes 114 | 115 | * Include all files necessary to run tests. 116 | 117 | 118 | ## 1.3.0.0 -- 2018-07-28 119 | 120 | ### Breaking API Changes 121 | 122 | * `DhallToCabal.dhallToCabal` now takes an `InputSettings` from 123 | `dhall` as its first argument. 124 | 125 | ### Functional Changes 126 | 127 | * `dhall-to-cabal` has a new `--print-default TYPE` flag. 128 | 129 | * When reading from a file, `dhall-to-cabal` now interprets imports as 130 | being relative to that file, rather than the current working 131 | directory. (#114) 132 | 133 | 134 | ## 1.2.0.0 -- 2018-07-05 135 | 136 | ### Breaking API Changes 137 | 138 | * Remove orphan `Dhall.Core.Inject` instances for `[Char]` and 139 | `CompilerFlavor`. 140 | 141 | * `CabalToDhall.cabalToDhall` is now a pure function that accepts a 142 | `GenericPackageDescription`. A new convenience function has been 143 | added to `CabalToDhall`, `parseGenericPackageDescriptionThrows`. 144 | 145 | ### Functional Changes 146 | 147 | * `os` conditions where the operating system's name was not recognised 148 | (e.g., `os(multics)`) were crashing cabal-to-dhall. They now work as 149 | expected. 150 | 151 | * `dhall-to-cabal` and `cabal-to-dhall` now respond to `--version`. 152 | 153 | * The `dhall` subdirectory has been reorganised so that things that 154 | are not types are not in the `types` subdirectory. Specifically, 155 | `dhall/types/Version/v.dhall`, all of 156 | `dhall/types/VersionRange/*.dhall` and the operations (i.e., the 157 | enumerations `LicenseId.dhall` and `LicenseExceptionId.dhall`) from 158 | `dhall/types/SPDX/*.dhall` have been moved to, respectively, 159 | `dhall/Version/v.dhall`, `dhall/VersionRange/*.dhall`, and 160 | `dhall/SPDX/*.dhall`. In addition, the files have been renamed as 161 | appropriate to reflect the name that they are exported from the 162 | prelude as; in practice, this means that they have gone from 163 | TitleCase to camelCase. 164 | 165 | Code that only imports `prelude.dhall` and `types.dhall` is 166 | unaffected by this change. 167 | 168 | * `prelude.defaults.Package.license` is now `AllRightsReserved`. 169 | 170 | * `dhall-to-cabal` now maps `AllRightsReserved` to `SPDX.NONE` when 171 | `cabal-version` is at least 2.2. 172 | 173 | * `cabal-to-dhall` will now generate more compact `.dhall` files by 174 | using defaults. 175 | 176 | * The default `build-type` is now omission, to use Cabal 2.2's 177 | inference, and the default `cabal-version` has been bumped to 2.2. 178 | 179 | * Export `prelude.types.Scopes`. 180 | 181 | ## Other Changes 182 | 183 | * Bump upper-bounds for `base`, `containers` and `contravariant`. This project 184 | can build on GHC 8.6 (though will need `--allow-newer` for `Cabal` until this 185 | is official released). 186 | 187 | 188 | ## 1.1.0.0 -- 2018-06-03 189 | 190 | ### Breaking Changes 191 | 192 | * The type of DhallToCabal.license has changed to 193 | `Dhall.Type (Either SPDX.License Cabal.License)` to accomodate Cabal 2.2. 194 | 195 | ### Other Changes 196 | 197 | * Increase upper-bound of base to allow 4.11. 198 | 199 | * Increase upper-bound of tasty to allow 1.1. 200 | 201 | * Switch to Dhall 1.14.0. 202 | 203 | * dhall-to-cabal: Fix tracking which branches are already true or false in 204 | conditionals. Dhall expressions with lots of conditions previously produced 205 | Cabal files that did not correctly match the requested conditions. See 206 | https://github.com/dhall-lang/dhall-to-cabal/pull/56, 207 | https://github.com/dhall-lang/dhall-to-cabal/issues/53 and 208 | https://github.com/dhall-lang/dhall-to-cabal/issues/55 for more information. 209 | 210 | Thank you to @jneira and @quasicomputational for helping identify and fix this 211 | bug. 212 | 213 | * cabal-to-dhall: Rewrite conditional handling to avoid hangs with complicated ones. 214 | See https://github.com/dhall-lang/dhall-to-cabal/pull/54 and linked issues. 215 | 216 | * Added a warning to generated `.cabal` files against hand-editing. 217 | 218 | * `cabal-to-dhall` now pretty prints the resulting Dhall. 219 | 220 | * The signature of `CabalToDhall.cabalToDhall` has changed: it now takes the location 221 | of the `prelude.dhall` and `types.dhall` to import as a parameter. 222 | 223 | * Upgrade to Cabal 2.2. This introduces SPDX license identifiers and Dhall 224 | functionality to manipulate them; see 225 | for a (convoluted) demonstration. 226 | 227 | * `prelude.defaults.Executable` has lost its `main-is` field, as it 228 | makes little sense to have an executable without it. 229 | 230 | * `--print-type` now omits the lengthy definition of `Extension`, instead importing 231 | it from the prelude. `--self-contained` is a new switch to disable this behaviour. 232 | 233 | 234 | ## 1.0.0.1 -- 2018-03-25 235 | 236 | Small packaging only tweaks: 237 | 238 | * Missing README.md 239 | * Missing author 240 | 241 | The irony of this change is not lost on me. 242 | 243 | ## 1.0.0 -- 2018-03-25 244 | 245 | First release! 246 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Oliver Charles 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cabal-sdist.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, cabal-install, ghc }: 2 | dir: 3 | let 4 | src-tree = mkDerivation { 5 | name = "src-sdist"; 6 | buildCommand = '' 7 | mkdir -p $out 8 | cp -R ${dir}/* . 9 | mkdir -p dist 10 | chmod a+w dist 11 | HOME=$(pwd) cabal sdist --output-directory=$out/src 12 | ''; 13 | buildInputs = [ cabal-install ghc ]; 14 | }; 15 | 16 | in 17 | import 18 | ( mkDerivation { 19 | name = "src.nix"; 20 | buildCommand = ''echo "${src-tree}"/src > $out''; 21 | } 22 | ) 23 | -------------------------------------------------------------------------------- /cabal-to-dhall/Main.hs: -------------------------------------------------------------------------------- 1 | {-# language NamedFieldPuns #-} 2 | {-# language OverloadedStrings #-} 3 | 4 | module Main ( main ) where 5 | 6 | import Control.Applicative ( (<**>), optional ) 7 | import Data.Foldable ( asum ) 8 | import Data.Version ( showVersion ) 9 | 10 | import qualified Data.ByteString as ByteString 11 | import qualified Data.Text.Prettyprint.Doc as Pretty 12 | import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty 13 | import qualified Options.Applicative as OptParse 14 | import qualified System.IO 15 | 16 | import CabalToDhall ( cabalToDhall, parseGenericPackageDescriptionThrows ) 17 | import DhallLocation ( dhallFromGitHub ) 18 | import Paths_dhall_to_cabal ( version ) 19 | 20 | 21 | data Command 22 | = RunCabalToDhall CabalToDhallOptions 23 | | PrintVersion 24 | 25 | 26 | data CabalToDhallOptions = CabalToDhallOptions 27 | { cabalFilePath :: Maybe String 28 | } 29 | 30 | 31 | cabalToDhallOptionsParser :: OptParse.Parser CabalToDhallOptions 32 | cabalToDhallOptionsParser = 33 | CabalToDhallOptions 34 | <$> 35 | optional 36 | ( OptParse.argument 37 | OptParse.str 38 | ( mconcat 39 | [ OptParse.metavar "" 40 | , OptParse.help "The Cabal file to convert to Dhall" 41 | ] 42 | ) 43 | ) 44 | 45 | 46 | printVersionParser :: OptParse.Parser () 47 | printVersionParser = 48 | OptParse.flag' 49 | () 50 | ( mconcat 51 | [ OptParse.long "version" 52 | , OptParse.help "Display dhall-to-cabal's version and exit." 53 | ] 54 | ) 55 | 56 | 57 | optionsParser = OptParse.info ( parser <**> OptParse.helper ) mempty 58 | where 59 | parser = 60 | asum 61 | [ RunCabalToDhall <$> cabalToDhallOptionsParser 62 | , PrintVersion <$ printVersionParser 63 | ] 64 | 65 | 66 | main :: IO () 67 | main = do 68 | command <- 69 | OptParse.execParser optionsParser 70 | 71 | case command of 72 | RunCabalToDhall options -> 73 | runCabalToDhall options 74 | PrintVersion -> 75 | printVersion 76 | 77 | 78 | runCabalToDhall :: CabalToDhallOptions -> IO () 79 | runCabalToDhall CabalToDhallOptions{ cabalFilePath } = do 80 | source <- 81 | case cabalFilePath of 82 | Nothing -> 83 | ByteString.getContents 84 | 85 | Just filePath -> 86 | ByteString.readFile filePath 87 | 88 | dhall <- cabalToDhall dhallFromGitHub <$> 89 | parseGenericPackageDescriptionThrows source 90 | 91 | Pretty.renderIO 92 | System.IO.stdout 93 | ( Pretty.layoutSmart opts 94 | ( Pretty.pretty dhall ) 95 | ) 96 | 97 | putStrLn "" 98 | 99 | 100 | 101 | -- Shamelessly taken from dhall-format 102 | 103 | -- Note: must remain in sync with the layout options in 104 | -- golden-tests/GoldenTests.hs, so that test output is easy to generate 105 | -- at the command line. 106 | opts :: Pretty.LayoutOptions 107 | opts = 108 | Pretty.defaultLayoutOptions 109 | { Pretty.layoutPageWidth = Pretty.AvailablePerLine 80 1.0 } 110 | 111 | 112 | printVersion :: IO () 113 | printVersion = do 114 | putStrLn ( "cabal-to-dhall version " ++ showVersion version ) 115 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: . 2 | -------------------------------------------------------------------------------- /dhall-to-cabal.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.4 2 | -- * * * * * * * * * * * * WARNING * * * * * * * * * * * * 3 | -- This file has been AUTO-GENERATED by dhall-to-cabal. 4 | -- 5 | -- Do not edit it by hand, because your changes will be over-written! 6 | -- 7 | -- Instead, edit the source Dhall file, namely 8 | -- 'dhall-to-cabal.dhall', and re-generate this file by running 9 | -- 'dhall-to-cabal -- dhall-to-cabal.dhall'. 10 | -- * * * * * * * * * * * * WARNING * * * * * * * * * * * * 11 | name: dhall-to-cabal 12 | version: 1.3.4.0 13 | license: MIT 14 | license-file: LICENSE 15 | maintainer: ollie@ocharles.org.uk 16 | author: Ollie Charles 17 | homepage: https://github.com/ocharles/dhall-to-cabal 18 | bug-reports: https://github.com/ocharles/dhall-to-cabal/issues 19 | synopsis: Compile Dhall expressions to Cabal files 20 | description: 21 | dhall-to-cabal takes Dhall expressions and compiles them into Cabal 22 | files. All of the features of Dhall are supported, such as let 23 | bindings and imports, and all features of Cabal are supported 24 | (including conditional stanzas). 25 | . 26 | 27 | category: Distribution 28 | build-type: Simple 29 | extra-source-files: 30 | Changelog.md 31 | README.md 32 | dhall/**/*.dhall 33 | golden-tests/dhall-to-cabal/*.dhall 34 | golden-tests/dhall-to-cabal/*.cabal 35 | golden-tests/cabal-to-dhall/*.dhall 36 | golden-tests/cabal-to-dhall/*.cabal 37 | 38 | source-repository head 39 | type: git 40 | location: https://github.com/ocharles/dhall-to-cabal 41 | 42 | library 43 | exposed-modules: 44 | CabalToDhall 45 | DhallLocation 46 | DhallToCabal 47 | DhallToCabal.FactorType 48 | DhallToCabal.Util 49 | 50 | hs-source-dirs: lib 51 | other-modules: 52 | DhallToCabal.ConfigTree 53 | DhallToCabal.Diff 54 | Dhall.Extra 55 | Paths_dhall_to_cabal 56 | 57 | autogen-modules: Paths_dhall_to_cabal 58 | default-language: Haskell2010 59 | other-extensions: 60 | ApplicativeDo GADTs GeneralizedNewtypeDeriving LambdaCase 61 | OverloadedStrings RecordWildCards TypeApplications 62 | 63 | ghc-options: 64 | -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude 65 | -Wno-missed-specialisations -Wno-all-missed-specialisations 66 | -Wno-missing-import-lists -Wno-missing-local-signatures 67 | -Wno-monomorphism-restriction -fno-warn-name-shadowing 68 | 69 | build-depends: 70 | base ^>=4.10 || ^>=4.11 || ^>=4.12, 71 | dhall ^>=1.26.0, 72 | Cabal ^>=3.0, 73 | bytestring ^>=0.10, 74 | containers ^>=0.5 || ^>=0.6, 75 | contravariant ^>=1.4 || ^>=1.5, 76 | filepath ^>=1.4, 77 | microlens ^>=0.1.0.0 || ^>=0.2.0.0 || ^>=0.3.0.0 || ^>=0.4.0.0, 78 | text ^>=1.2, 79 | transformers ^>=0.5.2, 80 | vector ^>=0.12 81 | 82 | executable dhall-to-cabal 83 | main-is: Main.hs 84 | hs-source-dirs: exe 85 | other-modules: Paths_dhall_to_cabal 86 | autogen-modules: Paths_dhall_to_cabal 87 | default-language: Haskell2010 88 | other-extensions: NamedFieldPuns 89 | ghc-options: 90 | -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude 91 | -Wno-missed-specialisations -Wno-all-missed-specialisations 92 | -Wno-missing-import-lists -Wno-missing-local-signatures 93 | -Wno-monomorphism-restriction -fno-warn-name-shadowing 94 | 95 | build-depends: 96 | base ^>=4.10 || ^>=4.11 || ^>=4.12, 97 | dhall ^>=1.26.0, 98 | Cabal ^>=3.0, 99 | containers ^>=0.5 || ^>=0.6, 100 | dhall-to-cabal -any, 101 | directory ^>=1.3.0.2, 102 | filepath ^>=1.4, 103 | microlens ^>=0.1.0.0 || ^>=0.2.0.0 || ^>=0.3.0.0 || ^>=0.4.0.0, 104 | optparse-applicative ^>=0.13.2 || ^>=0.14 || ^>=0.15, 105 | prettyprinter ^>=1.2.0.1 || ^>=1.3.0, 106 | text ^>=1.2, 107 | transformers ^>=0.5.2 108 | 109 | executable cabal-to-dhall 110 | main-is: Main.hs 111 | hs-source-dirs: cabal-to-dhall 112 | other-modules: Paths_dhall_to_cabal 113 | autogen-modules: Paths_dhall_to_cabal 114 | default-language: Haskell2010 115 | other-extensions: NamedFieldPuns 116 | ghc-options: 117 | -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude 118 | -Wno-missed-specialisations -Wno-all-missed-specialisations 119 | -Wno-missing-import-lists -Wno-missing-local-signatures 120 | -Wno-monomorphism-restriction -fno-warn-name-shadowing 121 | 122 | build-depends: 123 | base ^>=4.10 || ^>=4.11 || ^>=4.12, 124 | dhall ^>=1.26.0, 125 | bytestring ^>=0.10, 126 | dhall-to-cabal -any, 127 | optparse-applicative ^>=0.13.2 || ^>=0.14 || ^>=0.15, 128 | prettyprinter ^>=1.2.0.1 || ^>=1.3.0, 129 | text ^>=1.2 130 | 131 | executable dhall-to-cabal-meta 132 | main-is: Main.hs 133 | scope: private 134 | hs-source-dirs: meta 135 | default-language: Haskell2010 136 | ghc-options: 137 | -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude 138 | -Wno-missed-specialisations -Wno-all-missed-specialisations 139 | -Wno-missing-import-lists -Wno-missing-local-signatures 140 | -Wno-monomorphism-restriction -fno-warn-name-shadowing 141 | 142 | build-depends: 143 | base ^>=4.10 || ^>=4.11 || ^>=4.12, 144 | dhall ^>=1.26.0, 145 | directory ^>=1.3.0.2, 146 | dhall-to-cabal -any, 147 | filepath ^>=1.4, 148 | optparse-applicative ^>=0.13.2 || ^>=0.14 || ^>=0.15, 149 | prettyprinter ^>=1.2.0.1 || ^>=1.3.0 150 | 151 | test-suite golden-tests 152 | type: exitcode-stdio-1.0 153 | main-is: GoldenTests.hs 154 | hs-source-dirs: golden-tests 155 | default-language: Haskell2010 156 | ghc-options: 157 | -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude 158 | -Wno-missed-specialisations -Wno-all-missed-specialisations 159 | -Wno-missing-import-lists -Wno-missing-local-signatures 160 | -Wno-monomorphism-restriction -fno-warn-name-shadowing 161 | 162 | build-depends: 163 | base ^>=4.10 || ^>=4.11 || ^>=4.12, 164 | dhall ^>=1.26.0, 165 | Cabal ^>=3.0, 166 | Diff ^>=0.3.4, 167 | bytestring ^>=0.10, 168 | dhall-to-cabal -any, 169 | filepath ^>=1.4, 170 | microlens ^>=0.1.0.0 || ^>=0.2.0.0 || ^>=0.3.0.0 || ^>=0.4.0.0, 171 | prettyprinter ^>=1.2.0.1 || ^>=1.3.0, 172 | tasty ^>=0.11 || ^>=0.12 || ^>=1.0 || ^>=1.1 || ^>=1.2, 173 | tasty-golden ^>=2.3, 174 | text ^>=1.2 175 | 176 | test-suite unit-tests 177 | type: exitcode-stdio-1.0 178 | main-is: Tests.hs 179 | hs-source-dirs: tests 180 | other-modules: DhallToCabal.Tests 181 | default-language: Haskell2010 182 | ghc-options: 183 | -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude 184 | -Wno-missed-specialisations -Wno-all-missed-specialisations 185 | -Wno-missing-import-lists -Wno-missing-local-signatures 186 | -Wno-monomorphism-restriction -fno-warn-name-shadowing 187 | 188 | build-depends: 189 | base ^>=4.10 || ^>=4.11 || ^>=4.12, 190 | dhall ^>=1.26.0, 191 | Cabal ^>=3.0, 192 | dhall-to-cabal -any, 193 | tasty ^>=0.11 || ^>=0.12 || ^>=1.0 || ^>=1.1 || ^>=1.2, 194 | tasty-hunit ^>=0.10.0.1, 195 | text ^>=1.2 196 | -------------------------------------------------------------------------------- /dhall-to-cabal.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, base, bytestring, Cabal, containers, contravariant 2 | , dhall, Diff, directory, filepath, microlens, optparse-applicative 3 | , prettyprinter, stdenv, tasty, tasty-golden, tasty-hunit, text 4 | , transformers, vector 5 | }: 6 | mkDerivation { 7 | pname = "dhall-to-cabal"; 8 | version = "1.3.4.0"; 9 | src = ./.; 10 | isLibrary = true; 11 | isExecutable = true; 12 | libraryHaskellDepends = [ 13 | base bytestring Cabal containers contravariant dhall filepath 14 | microlens text transformers vector 15 | ]; 16 | executableHaskellDepends = [ 17 | base bytestring Cabal containers dhall directory filepath microlens 18 | optparse-applicative prettyprinter text transformers 19 | ]; 20 | testHaskellDepends = [ 21 | base bytestring Cabal dhall Diff filepath microlens prettyprinter 22 | tasty tasty-golden tasty-hunit text 23 | ]; 24 | homepage = "https://github.com/ocharles/dhall-to-cabal"; 25 | description = "Compile Dhall expressions to Cabal files"; 26 | license = stdenv.lib.licenses.mit; 27 | } 28 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/anyVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(PkgconfigVersionRange : Type) 2 | → λ(anyVersion : PkgconfigVersionRange) 3 | → λ(thisVersion : Text → PkgconfigVersionRange) 4 | → λ(laterVersion : Text → PkgconfigVersionRange) 5 | → λ(earlierVersion : Text → PkgconfigVersionRange) 6 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 7 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 8 | → λ ( unionVersionRanges 9 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 10 | ) 11 | → λ ( intersectVersionRanges 12 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 13 | ) 14 | → anyVersion 15 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/earlierVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : Text) 2 | → λ(PkgconfigVersionRange : Type) 3 | → λ(anyVersion : PkgconfigVersionRange) 4 | → λ(thisVersion : Text → PkgconfigVersionRange) 5 | → λ(laterVersion : Text → PkgconfigVersionRange) 6 | → λ(earlierVersion : Text → PkgconfigVersionRange) 7 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 8 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 9 | → λ ( unionVersionRanges 10 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 11 | ) 12 | → λ ( intersectVersionRanges 13 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 14 | ) 15 | → earlierVersion v 16 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/intersectVersionRanges.dhall: -------------------------------------------------------------------------------- 1 | λ(a : ../types/PkgconfigVersionRange.dhall) 2 | → λ(b : ../types/PkgconfigVersionRange.dhall) 3 | → λ(PkgconfigVersionRange : Type) 4 | → λ(anyVersion : PkgconfigVersionRange) 5 | → λ(thisVersion : Text → PkgconfigVersionRange) 6 | → λ(laterVersion : Text → PkgconfigVersionRange) 7 | → λ(earlierVersion : Text → PkgconfigVersionRange) 8 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 9 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 10 | → λ ( unionVersionRanges 11 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 12 | ) 13 | → λ ( intersectVersionRanges 14 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 15 | ) 16 | → intersectVersionRanges 17 | ( a 18 | PkgconfigVersionRange 19 | anyVersion 20 | thisVersion 21 | laterVersion 22 | earlierVersion 23 | orLaterVersion 24 | orEarlierVersion 25 | unionVersionRanges 26 | intersectVersionRanges 27 | ) 28 | ( b 29 | PkgconfigVersionRange 30 | anyVersion 31 | thisVersion 32 | laterVersion 33 | earlierVersion 34 | orLaterVersion 35 | orEarlierVersion 36 | unionVersionRanges 37 | intersectVersionRanges 38 | ) 39 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/laterVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : Text) 2 | → λ(PkgconfigVersionRange : Type) 3 | → λ(anyVersion : PkgconfigVersionRange) 4 | → λ(thisVersion : Text → PkgconfigVersionRange) 5 | → λ(laterVersion : Text → PkgconfigVersionRange) 6 | → λ(earlierVersion : Text → PkgconfigVersionRange) 7 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 8 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 9 | → λ ( unionVersionRanges 10 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 11 | ) 12 | → λ ( intersectVersionRanges 13 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 14 | ) 15 | → laterVersion v 16 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/orEarlierVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : Text) 2 | → λ(PkgconfigVersionRange : Type) 3 | → λ(anyVersion : PkgconfigVersionRange) 4 | → λ(thisVersion : Text → PkgconfigVersionRange) 5 | → λ(laterVersion : Text → PkgconfigVersionRange) 6 | → λ(earlierVersion : Text → PkgconfigVersionRange) 7 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 8 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 9 | → λ ( unionVersionRanges 10 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 11 | ) 12 | → λ ( intersectVersionRanges 13 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 14 | ) 15 | → orEarlierVersion v 16 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/orLaterVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : Text) 2 | → λ(PkgconfigVersionRange : Type) 3 | → λ(anyVersion : PkgconfigVersionRange) 4 | → λ(thisVersion : Text → PkgconfigVersionRange) 5 | → λ(laterVersion : Text → PkgconfigVersionRange) 6 | → λ(earlierVersion : Text → PkgconfigVersionRange) 7 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 8 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 9 | → λ ( unionVersionRanges 10 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 11 | ) 12 | → λ ( intersectVersionRanges 13 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 14 | ) 15 | → orLaterVersion v 16 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/thisVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : Text) 2 | → λ(PkgconfigVersionRange : Type) 3 | → λ(anyVersion : PkgconfigVersionRange) 4 | → λ(thisVersion : Text → PkgconfigVersionRange) 5 | → λ(laterVersion : Text → PkgconfigVersionRange) 6 | → λ(earlierVersion : Text → PkgconfigVersionRange) 7 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 8 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 9 | → λ ( unionVersionRanges 10 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 11 | ) 12 | → λ ( intersectVersionRanges 13 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 14 | ) 15 | → thisVersion v 16 | -------------------------------------------------------------------------------- /dhall/PkgconfigVersionRange/unionVersionRanges.dhall: -------------------------------------------------------------------------------- 1 | λ(a : ../types/PkgconfigVersionRange.dhall) 2 | → λ(b : ../types/PkgconfigVersionRange.dhall) 3 | → λ(PkgconfigVersionRange : Type) 4 | → λ(anyVersion : PkgconfigVersionRange) 5 | → λ(thisVersion : Text → PkgconfigVersionRange) 6 | → λ(laterVersion : Text → PkgconfigVersionRange) 7 | → λ(earlierVersion : Text → PkgconfigVersionRange) 8 | → λ(orLaterVersion : Text → PkgconfigVersionRange) 9 | → λ(orEarlierVersion : Text → PkgconfigVersionRange) 10 | → λ ( unionVersionRanges 11 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 12 | ) 13 | → λ ( intersectVersionRanges 14 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 15 | ) 16 | → unionVersionRanges 17 | ( a 18 | PkgconfigVersionRange 19 | anyVersion 20 | thisVersion 21 | laterVersion 22 | earlierVersion 23 | orLaterVersion 24 | orEarlierVersion 25 | unionVersionRanges 26 | intersectVersionRanges 27 | ) 28 | ( b 29 | PkgconfigVersionRange 30 | anyVersion 31 | thisVersion 32 | laterVersion 33 | earlierVersion 34 | orLaterVersion 35 | orEarlierVersion 36 | unionVersionRanges 37 | intersectVersionRanges 38 | ) 39 | -------------------------------------------------------------------------------- /dhall/SPDX/and.dhall: -------------------------------------------------------------------------------- 1 | let LicenseId = ../types/SPDX/LicenseId.dhall 2 | 3 | let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall 4 | 5 | in λ(a : ../types/SPDX.dhall) 6 | → λ(b : ../types/SPDX.dhall) 7 | → λ(SPDX : Type) 8 | → λ(license : LicenseId → Optional LicenseExceptionId → SPDX) 9 | → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX) 10 | → λ(ref : Text → Optional LicenseExceptionId → SPDX) 11 | → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX) 12 | → λ(and : SPDX → SPDX → SPDX) 13 | → λ(or : SPDX → SPDX → SPDX) 14 | → and 15 | (a SPDX license licenseVersionOrLater ref refWithFile and or) 16 | (b SPDX license licenseVersionOrLater ref refWithFile and or) 17 | -------------------------------------------------------------------------------- /dhall/SPDX/license.dhall: -------------------------------------------------------------------------------- 1 | let LicenseId = ../types/SPDX/LicenseId.dhall 2 | 3 | let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall 4 | 5 | in λ(licenseId : LicenseId) 6 | → λ(licenseExceptionIdOpt : Optional LicenseExceptionId) 7 | → λ(SPDX : Type) 8 | → λ(license : LicenseId → Optional LicenseExceptionId → SPDX) 9 | → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX) 10 | → λ(ref : Text → Optional LicenseExceptionId → SPDX) 11 | → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX) 12 | → λ(and : SPDX → SPDX → SPDX) 13 | → λ(or : SPDX → SPDX → SPDX) 14 | → license licenseId licenseExceptionIdOpt 15 | -------------------------------------------------------------------------------- /dhall/SPDX/licenseVersionOrLater.dhall: -------------------------------------------------------------------------------- 1 | let LicenseId = ../types/SPDX/LicenseId.dhall 2 | 3 | let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall 4 | 5 | in λ(licenseId : LicenseId) 6 | → λ(licenseExceptionIdOpt : Optional LicenseExceptionId) 7 | → λ(SPDX : Type) 8 | → λ(license : LicenseId → Optional LicenseExceptionId → SPDX) 9 | → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX) 10 | → λ(ref : Text → Optional LicenseExceptionId → SPDX) 11 | → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX) 12 | → λ(and : SPDX → SPDX → SPDX) 13 | → λ(or : SPDX → SPDX → SPDX) 14 | → licenseVersionOrLater licenseId licenseExceptionIdOpt 15 | -------------------------------------------------------------------------------- /dhall/SPDX/or.dhall: -------------------------------------------------------------------------------- 1 | let LicenseId = ../types/SPDX/LicenseId.dhall 2 | 3 | let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall 4 | 5 | in λ(a : ../types/SPDX.dhall) 6 | → λ(b : ../types/SPDX.dhall) 7 | → λ(SPDX : Type) 8 | → λ(license : LicenseId → Optional LicenseExceptionId → SPDX) 9 | → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX) 10 | → λ(ref : Text → Optional LicenseExceptionId → SPDX) 11 | → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX) 12 | → λ(and : SPDX → SPDX → SPDX) 13 | → λ(or : SPDX → SPDX → SPDX) 14 | → or 15 | (a SPDX license licenseVersionOrLater ref refWithFile and or) 16 | (b SPDX license licenseVersionOrLater ref refWithFile and or) 17 | -------------------------------------------------------------------------------- /dhall/SPDX/ref.dhall: -------------------------------------------------------------------------------- 1 | let LicenseId = ../types/SPDX/LicenseId.dhall 2 | 3 | let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall 4 | 5 | in λ(refName : Text) 6 | → λ(licenseExceptionIdOpt : Optional LicenseExceptionId) 7 | → λ(SPDX : Type) 8 | → λ(version : LicenseId → Optional LicenseExceptionId → SPDX) 9 | → λ(versionOrLater : LicenseId → Optional LicenseExceptionId → SPDX) 10 | → λ(ref : Text → Optional LicenseExceptionId → SPDX) 11 | → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX) 12 | → λ(and : SPDX → SPDX → SPDX) 13 | → λ(or : SPDX → SPDX → SPDX) 14 | → ref refName licenseExceptionIdOpt 15 | -------------------------------------------------------------------------------- /dhall/SPDX/refWithFile.dhall: -------------------------------------------------------------------------------- 1 | let LicenseId = ../types/SPDX/LicenseId.dhall 2 | 3 | let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall 4 | 5 | in λ(refName : Text) 6 | → λ(file : Text) 7 | → λ(licenseExceptionIdOpt : Optional LicenseExceptionId) 8 | → λ(SPDX : Type) 9 | → λ(license : LicenseId → Optional LicenseExceptionId → SPDX) 10 | → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX) 11 | → λ(ref : Text → Optional LicenseExceptionId → SPDX) 12 | → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX) 13 | → λ(and : SPDX → SPDX → SPDX) 14 | → λ(or : SPDX → SPDX → SPDX) 15 | → refWithFile refName file licenseExceptionIdOpt 16 | -------------------------------------------------------------------------------- /dhall/Version/v.dhall: -------------------------------------------------------------------------------- 1 | let v 2 | : ∀(str : Text) → ../types/Version.dhall 3 | = λ(str : Text) → λ(Version : Type) → λ(v : Text → Version) → v str 4 | 5 | in v 6 | -------------------------------------------------------------------------------- /dhall/VersionRange/anyVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(VersionRange : Type) 2 | → λ(anyVersion : VersionRange) 3 | → λ(noVersion : VersionRange) 4 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 5 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 7 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 8 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 10 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 11 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 12 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 13 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(invertVersionRange : VersionRange → VersionRange) 16 | → anyVersion 17 | -------------------------------------------------------------------------------- /dhall/VersionRange/differenceVersionRanges.dhall: -------------------------------------------------------------------------------- 1 | λ(a : ../types/VersionRange.dhall) 2 | → λ(b : ../types/VersionRange.dhall) 3 | → λ(VersionRange : Type) 4 | → λ(anyVersion : VersionRange) 5 | → λ(noVersion : VersionRange) 6 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 8 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 9 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 11 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 12 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 13 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 14 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 17 | → λ(invertVersionRange : VersionRange → VersionRange) 18 | → DifferenceVersionRanges 19 | ( a 20 | VersionRange 21 | anyVersion 22 | noVersion 23 | thisVersion 24 | notThisVersion 25 | laterVersion 26 | earlierVersion 27 | orLaterVersion 28 | orEarlierVersion 29 | withinVersion 30 | majorBoundVersion 31 | unionVersionRanges 32 | intersectVersionRanges 33 | differenceVersionRanges 34 | invertVersionRange 35 | ) 36 | ( b 37 | VersionRange 38 | anyVersion 39 | noVersion 40 | thisVersion 41 | notThisVersion 42 | laterVersion 43 | earlierVersion 44 | orLaterVersion 45 | orEarlierVersion 46 | withinVersion 47 | majorBoundVersion 48 | unionVersionRanges 49 | intersectVersionRanges 50 | differenceVersionRanges 51 | invertVersionRange 52 | ) 53 | -------------------------------------------------------------------------------- /dhall/VersionRange/earlierVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → earlierVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/intersectVersionRanges.dhall: -------------------------------------------------------------------------------- 1 | λ(a : ../types/VersionRange.dhall) 2 | → λ(b : ../types/VersionRange.dhall) 3 | → λ(VersionRange : Type) 4 | → λ(anyVersion : VersionRange) 5 | → λ(noVersion : VersionRange) 6 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 8 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 9 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 11 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 12 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 13 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 14 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 17 | → λ(invertVersionRange : VersionRange → VersionRange) 18 | → intersectVersionRanges 19 | ( a 20 | VersionRange 21 | anyVersion 22 | noVersion 23 | thisVersion 24 | notThisVersion 25 | laterVersion 26 | earlierVersion 27 | orLaterVersion 28 | orEarlierVersion 29 | withinVersion 30 | majorBoundVersion 31 | unionVersionRanges 32 | intersectVersionRanges 33 | differenceVersionRanges 34 | invertVersionRange 35 | ) 36 | ( b 37 | VersionRange 38 | anyVersion 39 | noVersion 40 | thisVersion 41 | notThisVersion 42 | laterVersion 43 | earlierVersion 44 | orLaterVersion 45 | orEarlierVersion 46 | withinVersion 47 | majorBoundVersion 48 | unionVersionRanges 49 | intersectVersionRanges 50 | differenceVersionRanges 51 | invertVersionRange 52 | ) 53 | -------------------------------------------------------------------------------- /dhall/VersionRange/invertVersionRange.dhall: -------------------------------------------------------------------------------- 1 | λ(a : ../types/VersionRange.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → invertVersionRange 18 | ( a 19 | VersionRange 20 | anyVersion 21 | noVersion 22 | thisVersion 23 | notThisVersion 24 | laterVersion 25 | earlierVersion 26 | orLaterVersion 27 | orEarlierVersion 28 | withinVersion 29 | majorBoundVersion 30 | unionVersionRanges 31 | intersectVersionRanges 32 | differenceVersionRanges 33 | invertVersionRange 34 | ) 35 | -------------------------------------------------------------------------------- /dhall/VersionRange/laterVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → laterVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/majorBoundVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → majorBoundVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/noVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(VersionRange : Type) 2 | → λ(anyVersion : VersionRange) 3 | → λ(noVersion : VersionRange) 4 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 5 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 7 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 8 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 10 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 11 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 12 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 13 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(invertVersionRange : VersionRange → VersionRange) 16 | → noVersion 17 | -------------------------------------------------------------------------------- /dhall/VersionRange/notThisVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → notThisVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/orEarlierVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → orEarlierVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/orLaterVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → orLaterVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/thisVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → thisVersion v 18 | -------------------------------------------------------------------------------- /dhall/VersionRange/unionVersionRanges.dhall: -------------------------------------------------------------------------------- 1 | λ(a : ../types/VersionRange.dhall) 2 | → λ(b : ../types/VersionRange.dhall) 3 | → λ(VersionRange : Type) 4 | → λ(anyVersion : VersionRange) 5 | → λ(noVersion : VersionRange) 6 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 8 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 9 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 11 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 12 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 13 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 14 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 17 | → λ(invertVersionRange : VersionRange → VersionRange) 18 | → unionVersionRanges 19 | ( a 20 | VersionRange 21 | anyVersion 22 | noVersion 23 | thisVersion 24 | notThisVersion 25 | laterVersion 26 | earlierVersion 27 | orLaterVersion 28 | orEarlierVersion 29 | withinVersion 30 | majorBoundVersion 31 | unionVersionRanges 32 | intersectVersionRanges 33 | differenceVersionRanges 34 | invertVersionRange 35 | ) 36 | ( b 37 | VersionRange 38 | anyVersion 39 | noVersion 40 | thisVersion 41 | notThisVersion 42 | laterVersion 43 | earlierVersion 44 | orLaterVersion 45 | orEarlierVersion 46 | withinVersion 47 | majorBoundVersion 48 | unionVersionRanges 49 | intersectVersionRanges 50 | differenceVersionRanges 51 | invertVersionRange 52 | ) 53 | -------------------------------------------------------------------------------- /dhall/VersionRange/withinVersion.dhall: -------------------------------------------------------------------------------- 1 | λ(v : ../types/Version.dhall) 2 | → λ(VersionRange : Type) 3 | → λ(anyVersion : VersionRange) 4 | → λ(noVersion : VersionRange) 5 | → λ(thisVersion : ../types/Version.dhall → VersionRange) 6 | → λ(notThisVersion : ../types/Version.dhall → VersionRange) 7 | → λ(laterVersion : ../types/Version.dhall → VersionRange) 8 | → λ(earlierVersion : ../types/Version.dhall → VersionRange) 9 | → λ(orLaterVersion : ../types/Version.dhall → VersionRange) 10 | → λ(orEarlierVersion : ../types/Version.dhall → VersionRange) 11 | → λ(withinVersion : ../types/Version.dhall → VersionRange) 12 | → λ(majorBoundVersion : ../types/Version.dhall → VersionRange) 13 | → λ(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → λ(invertVersionRange : VersionRange → VersionRange) 17 | → withinVersion v 18 | -------------------------------------------------------------------------------- /dhall/defaults/Benchmark.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall 3 | -------------------------------------------------------------------------------- /dhall/defaults/BuildInfo.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | let types = ../types.dhall 3 | 4 | in { autogen-modules = 5 | [] : List Text 6 | , build-depends = 7 | [] : List types.Dependency 8 | , build-tool-depends = 9 | [] : List 10 | { component : 11 | Text 12 | , package : 13 | Text 14 | , version : 15 | types.VersionRange 16 | } 17 | , build-tools = 18 | [] : List { exe : Text, version : types.VersionRange } 19 | , buildable = 20 | True 21 | , c-sources = 22 | [] : List Text 23 | , cc-options = 24 | [] : List Text 25 | , compiler-options = 26 | ./CompilerOptions.dhall 27 | , cpp-options = 28 | [] : List Text 29 | , default-extensions = 30 | [] : List types.Extension 31 | , default-language = 32 | None types.Language 33 | , extra-framework-dirs = 34 | [] : List Text 35 | , extra-ghci-libraries = 36 | [] : List Text 37 | , extra-lib-dirs = 38 | [] : List Text 39 | , extra-libraries = 40 | [] : List Text 41 | , frameworks = 42 | [] : List Text 43 | , hs-source-dirs = 44 | [] : List Text 45 | , includes = 46 | [] : List Text 47 | , include-dirs = 48 | [] : List Text 49 | , install-includes = 50 | [] : List Text 51 | , js-sources = 52 | [] : List Text 53 | , ld-options = 54 | [] : List Text 55 | , other-extensions = 56 | [] : List types.Extension 57 | , other-languages = 58 | [] : List types.Language 59 | , other-modules = 60 | [] : List Text 61 | , pkgconfig-depends = 62 | [] : List { name : Text, version : types.PkgconfigVersionRange } 63 | , profiling-options = 64 | ./CompilerOptions.dhall 65 | , shared-options = 66 | ./CompilerOptions.dhall 67 | , static-options = 68 | ./CompilerOptions.dhall 69 | , mixins = 70 | [] : List types.Mixin 71 | , asm-options = 72 | [] : List Text 73 | , asm-sources = 74 | [] : List Text 75 | , cmm-options = 76 | [] : List Text 77 | , cmm-sources = 78 | [] : List Text 79 | , cxx-options = 80 | [] : List Text 81 | , cxx-sources = 82 | [] : List Text 83 | , virtual-modules = 84 | [] : List Text 85 | , extra-lib-flavours = 86 | [] : List Text 87 | , extra-bundled-libs = 88 | [] : List Text 89 | , autogen-includes = 90 | [] : List Text 91 | , extra-dyn-lib-flavours = 92 | [] : List Text 93 | } 94 | -------------------------------------------------------------------------------- /dhall/defaults/CompilerOptions.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { GHC = [] : List Text, GHCJS = [] : List Text } 3 | -------------------------------------------------------------------------------- /dhall/defaults/Executable.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | let types = ../types.dhall in ./BuildInfo.dhall ⫽ { scope = types.Scope.Public } 3 | -------------------------------------------------------------------------------- /dhall/defaults/MainLibrary.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | let types = ../types.dhall 3 | 4 | in ./BuildInfo.dhall 5 | ⫽ { exposed-modules = 6 | [] : List Text 7 | , reexported-modules = 8 | [] : List 9 | { name : 10 | Text 11 | , original : 12 | { name : Text, package : Optional Text } 13 | } 14 | , signatures = 15 | [] : List Text 16 | , visibility = 17 | types.LibraryVisibility.public 18 | } 19 | -------------------------------------------------------------------------------- /dhall/defaults/NamedLibrary.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | let types = ../types.dhall 3 | 4 | in ./BuildInfo.dhall 5 | ⫽ { exposed-modules = 6 | [] : List Text 7 | , reexported-modules = 8 | [] : List 9 | { name : 10 | Text 11 | , original : 12 | { name : Text, package : Optional Text } 13 | } 14 | , signatures = 15 | [] : List Text 16 | , visibility = 17 | types.LibraryVisibility.private 18 | } 19 | -------------------------------------------------------------------------------- /dhall/defaults/Package.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | let types = ../types.dhall 3 | 4 | in { author = 5 | "" 6 | , flags = 7 | [] : List 8 | { default : 9 | Bool 10 | , description : 11 | Text 12 | , manual : 13 | Bool 14 | , name : 15 | Text 16 | } 17 | , benchmarks = 18 | [] : List 19 | { name : 20 | Text 21 | , benchmark : 22 | ∀(config : types.Config) → types.Benchmark 23 | } 24 | , bug-reports = 25 | "" 26 | , build-type = 27 | None types.BuildType 28 | , cabal-version = 29 | ../Version/v.dhall "2.2" 30 | , category = 31 | "" 32 | , copyright = 33 | "" 34 | , data-dir = 35 | "" 36 | , data-files = 37 | [] : List Text 38 | , description = 39 | "" 40 | , executables = 41 | [] : List 42 | { name : 43 | Text 44 | , executable : 45 | ∀(config : types.Config) → types.Executable 46 | } 47 | , extra-doc-files = 48 | [] : List Text 49 | , extra-source-files = 50 | [] : List Text 51 | , extra-tmp-files = 52 | [] : List Text 53 | , foreign-libraries = 54 | [] : List 55 | { name : 56 | Text 57 | , foreign-lib : 58 | ∀(config : types.Config) → types.ForeignLibrary 59 | } 60 | , homepage = 61 | "" 62 | , library = 63 | None (∀(config : types.Config) → types.Library) 64 | , license = 65 | types.License.AllRightsReserved 66 | , license-files = 67 | [] : List Text 68 | , maintainer = 69 | "" 70 | , package-url = 71 | "" 72 | , source-repos = 73 | [] : List types.SourceRepo 74 | , stability = 75 | "" 76 | , sub-libraries = 77 | [] : List 78 | { name : 79 | Text 80 | , library : 81 | ∀(config : types.Config) → types.Library 82 | } 83 | , synopsis = 84 | "" 85 | , test-suites = 86 | [] : List 87 | { name : 88 | Text 89 | , test-suite : 90 | ∀(config : types.Config) → types.TestSuite 91 | } 92 | , tested-with = 93 | [] : List { compiler : types.Compiler, version : types.VersionRange } 94 | , x-fields = 95 | [] : List { _1 : Text, _2 : Text } 96 | , custom-setup = 97 | None types.SetupBuildInfo 98 | } 99 | -------------------------------------------------------------------------------- /dhall/defaults/SourceRepo.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | let types = ../types.dhall 3 | 4 | in { type = 5 | None types.RepoType 6 | , location = 7 | None Text 8 | , module = 9 | None Text 10 | , branch = 11 | None Text 12 | , tag = 13 | None Text 14 | , subdir = 15 | None Text 16 | , kind = 17 | types.RepoKind.RepoHead 18 | } 19 | -------------------------------------------------------------------------------- /dhall/defaults/TestSuite.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall 3 | -------------------------------------------------------------------------------- /dhall/prelude.dhall: -------------------------------------------------------------------------------- 1 | { defaults = 2 | { CompilerOptions = 3 | ./defaults/CompilerOptions.dhall 4 | , MainLibrary = 5 | ./defaults/MainLibrary.dhall 6 | , NamedLibrary = 7 | ./defaults/NamedLibrary.dhall 8 | , Benchmark = 9 | ./defaults/Benchmark.dhall 10 | , Executable = 11 | ./defaults/Executable.dhall 12 | , Package = 13 | ./defaults/Package.dhall 14 | , SourceRepo = 15 | ./defaults/SourceRepo.dhall 16 | , TestSuite = 17 | ./defaults/TestSuite.dhall 18 | } 19 | , anyVersion = 20 | ./VersionRange/anyVersion.dhall 21 | , earlierVersion = 22 | ./VersionRange/earlierVersion.dhall 23 | , orEarlierVersion = 24 | ./VersionRange/orEarlierVersion.dhall 25 | , intersectVersionRanges = 26 | ./VersionRange/intersectVersionRanges.dhall 27 | , unionVersionRanges = 28 | ./VersionRange/unionVersionRanges.dhall 29 | , majorBoundVersion = 30 | ./VersionRange/majorBoundVersion.dhall 31 | , orLaterVersion = 32 | ./VersionRange/orLaterVersion.dhall 33 | , laterVersion = 34 | ./VersionRange/laterVersion.dhall 35 | , thisVersion = 36 | ./VersionRange/thisVersion.dhall 37 | , notThisVersion = 38 | ./VersionRange/notThisVersion.dhall 39 | , withinVersion = 40 | ./VersionRange/withinVersion.dhall 41 | , v = 42 | ./Version/v.dhall 43 | , noVersion = 44 | ./VersionRange/noVersion.dhall 45 | , utils = 46 | ./utils/package.dhall 47 | , unconditional = 48 | ./unconditional.dhall 49 | , pkg-config = 50 | { anyVersion = 51 | ./PkgconfigVersionRange/anyVersion.dhall 52 | , thisVersion = 53 | ./PkgconfigVersionRange/thisVersion.dhall 54 | , laterVersion = 55 | ./PkgconfigVersionRange/laterVersion.dhall 56 | , earlierVersion = 57 | ./PkgconfigVersionRange/earlierVersion.dhall 58 | , orLaterVersion = 59 | ./PkgconfigVersionRange/orLaterVersion.dhall 60 | , orEarlierVersion = 61 | ./PkgconfigVersionRange/orEarlierVersion.dhall 62 | , unionVersionRanges = 63 | ./PkgconfigVersionRange/unionVersionRanges.dhall 64 | , intersectVersionRanges = 65 | ./PkgconfigVersionRange/intersectVersionRanges.dhall 66 | } 67 | , SPDX = 68 | { license = 69 | ./SPDX/license.dhall 70 | , licenseVersionOrLater = 71 | ./SPDX/licenseVersionOrLater.dhall 72 | , ref = 73 | ./SPDX/ref.dhall 74 | , refWithFile = 75 | ./SPDX/refWithFile.dhall 76 | , and = 77 | ./SPDX/and.dhall 78 | , or = 79 | ./SPDX/or.dhall 80 | , noException = 81 | None ./types/SPDX/LicenseExceptionId.dhall 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /dhall/types.dhall: -------------------------------------------------------------------------------- 1 | { Arch = 2 | ./types/Arch.dhall 3 | , Benchmark = 4 | ./types/Benchmark.dhall 5 | , BuildInfo = 6 | ./types/BuildInfo.dhall 7 | , BuildType = 8 | ./types/BuildType.dhall 9 | , Compiler = 10 | ./types/Compiler.dhall 11 | , CompilerOptions = 12 | ./types/CompilerOptions.dhall 13 | , Config = 14 | ./types/Config.dhall 15 | , Dependency = 16 | ./types/Dependency.dhall 17 | , Executable = 18 | ./types/Executable.dhall 19 | , Extension = 20 | ./types/Extension.dhall 21 | , Extensions = 22 | ./types/Extension.dhall 23 | , Flag = 24 | ./types/Flag.dhall 25 | , ForeignLibOption = 26 | ./types/ForeignLibOption.dhall 27 | , ForeignLibType = 28 | ./types/ForeignLibType.dhall 29 | , ForeignLibrary = 30 | ./types/ForeignLibrary.dhall 31 | , Language = 32 | ./types/Language.dhall 33 | , Languages = 34 | ./types/Language.dhall 35 | , Library = 36 | ./types/Library.dhall 37 | , LibraryName = 38 | ./types/LibraryName.dhall 39 | , LibraryVisibility = 40 | ./types/LibraryVisibility.dhall 41 | , License = 42 | ./types/License.dhall 43 | , LicenseExceptionId = 44 | ./types/SPDX/LicenseExceptionId.dhall 45 | , LicenseId = 46 | ./types/SPDX/LicenseId.dhall 47 | , Mixin = 48 | ./types/Mixin.dhall 49 | , ModuleRenaming = 50 | ./types/ModuleRenaming.dhall 51 | , OS = 52 | ./types/OS.dhall 53 | , Package = 54 | ./types/Package.dhall 55 | , PkgconfigVersionRange = 56 | ./types/PkgconfigVersionRange.dhall 57 | , RepoKind = 58 | ./types/RepoKind.dhall 59 | , RepoType = 60 | ./types/RepoType.dhall 61 | , Scope = 62 | ./types/Scope.dhall 63 | , SetupBuildInfo = 64 | ./types/SetupBuildInfo.dhall 65 | , SPDX = 66 | ./types/SPDX.dhall 67 | , SourceRepo = 68 | ./types/SourceRepo.dhall 69 | , TestSuite = 70 | ./types/TestSuite.dhall 71 | , TestType = 72 | ./types/TestType.dhall 73 | , Version = 74 | ./types/Version.dhall 75 | , VersionRange = 76 | ./types/VersionRange.dhall 77 | } 78 | -------------------------------------------------------------------------------- /dhall/types/Arch.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < AArch64 3 | | Alpha 4 | | Arm 5 | | Hppa 6 | | I386 7 | | IA64 8 | | JavaScript 9 | | M68k 10 | | Mips 11 | | OtherArch : 12 | { _1 : Text } 13 | | PPC 14 | | PPC64 15 | | Rs6000 16 | | S390 17 | | SH 18 | | Sparc 19 | | Vax 20 | | X86_64 21 | > 22 | -------------------------------------------------------------------------------- /dhall/types/Benchmark.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall ⩓ { main-is : Text } 3 | -------------------------------------------------------------------------------- /dhall/types/BuildInfo.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { asm-options : 3 | List Text 4 | , asm-sources : 5 | List Text 6 | , autogen-includes : 7 | List Text 8 | , autogen-modules : 9 | List Text 10 | , build-depends : 11 | List ./Dependency.dhall 12 | , build-tool-depends : 13 | List { package : Text, component : Text, version : ./VersionRange.dhall } 14 | , build-tools : 15 | List { exe : Text, version : ./VersionRange.dhall } 16 | , buildable : 17 | Bool 18 | , c-sources : 19 | List Text 20 | , cc-options : 21 | List Text 22 | , cmm-options : 23 | List Text 24 | , cmm-sources : 25 | List Text 26 | , compiler-options : 27 | ./CompilerOptions.dhall 28 | , cpp-options : 29 | List Text 30 | , cxx-options : 31 | List Text 32 | , cxx-sources : 33 | List Text 34 | , default-extensions : 35 | List ./Extension.dhall 36 | , default-language : 37 | Optional ./Language.dhall 38 | , extra-bundled-libs : 39 | List Text 40 | , extra-dyn-lib-flavours : 41 | List Text 42 | , extra-framework-dirs : 43 | List Text 44 | , extra-ghci-libraries : 45 | List Text 46 | , extra-lib-dirs : 47 | List Text 48 | , extra-lib-flavours : 49 | List Text 50 | , extra-libraries : 51 | List Text 52 | , frameworks : 53 | List Text 54 | , hs-source-dirs : 55 | List Text 56 | , include-dirs : 57 | List Text 58 | , includes : 59 | List Text 60 | , install-includes : 61 | List Text 62 | , js-sources : 63 | List Text 64 | , ld-options : 65 | List Text 66 | , mixins : 67 | List ./Mixin.dhall 68 | , other-extensions : 69 | List ./Extension.dhall 70 | , other-languages : 71 | List ./Language.dhall 72 | , other-modules : 73 | List Text 74 | , pkgconfig-depends : 75 | List { name : Text, version : ./PkgconfigVersionRange.dhall } 76 | , profiling-options : 77 | ./CompilerOptions.dhall 78 | , shared-options : 79 | ./CompilerOptions.dhall 80 | , static-options : 81 | ./CompilerOptions.dhall 82 | , virtual-modules : 83 | List Text 84 | } 85 | -------------------------------------------------------------------------------- /dhall/types/BuildType.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Configure | Custom | Make | Simple > 3 | -------------------------------------------------------------------------------- /dhall/types/Compiler.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Eta 3 | | GHC 4 | | GHCJS 5 | | HBC 6 | | HaskellSuite : 7 | { _1 : Text } 8 | | Helium 9 | | Hugs 10 | | JHC 11 | | LHC 12 | | NHC 13 | | OtherCompiler : 14 | { _1 : Text } 15 | | UHC 16 | | YHC 17 | > 18 | -------------------------------------------------------------------------------- /dhall/types/CompilerOptions.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { GHC : List Text, GHCJS : List Text } 3 | -------------------------------------------------------------------------------- /dhall/types/Config.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { arch : 3 | ./Arch.dhall → Bool 4 | , flag : 5 | Text → Bool 6 | , impl : 7 | ./Compiler.dhall → ./VersionRange.dhall → Bool 8 | , os : 9 | ./OS.dhall → Bool 10 | } 11 | -------------------------------------------------------------------------------- /dhall/types/Dependency.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { bounds : 3 | ./VersionRange.dhall 4 | , library-names : 5 | List ./LibraryName.dhall 6 | , package : 7 | Text 8 | } 9 | -------------------------------------------------------------------------------- /dhall/types/Executable.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall ⩓ { main-is : Text, scope : ./Scope.dhall } 3 | -------------------------------------------------------------------------------- /dhall/types/Extension.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < AllowAmbiguousTypes : 3 | Bool 4 | | ApplicativeDo : 5 | Bool 6 | | Arrows : 7 | Bool 8 | | AutoDeriveTypeable : 9 | Bool 10 | | BangPatterns : 11 | Bool 12 | | BinaryLiterals : 13 | Bool 14 | | BlockArguments : 15 | Bool 16 | | CApiFFI : 17 | Bool 18 | | CPP : 19 | Bool 20 | | ConstrainedClassMethods : 21 | Bool 22 | | ConstraintKinds : 23 | Bool 24 | | DataKinds : 25 | Bool 26 | | DatatypeContexts : 27 | Bool 28 | | DefaultSignatures : 29 | Bool 30 | | DeriveAnyClass : 31 | Bool 32 | | DeriveDataTypeable : 33 | Bool 34 | | DeriveFoldable : 35 | Bool 36 | | DeriveFunctor : 37 | Bool 38 | | DeriveGeneric : 39 | Bool 40 | | DeriveLift : 41 | Bool 42 | | DeriveTraversable : 43 | Bool 44 | | DerivingStrategies : 45 | Bool 46 | | DerivingVia : 47 | Bool 48 | | DisambiguateRecordFields : 49 | Bool 50 | | DoAndIfThenElse : 51 | Bool 52 | | DoRec : 53 | Bool 54 | | DuplicateRecordFields : 55 | Bool 56 | | EmptyCase : 57 | Bool 58 | | EmptyDataDecls : 59 | Bool 60 | | EmptyDataDeriving : 61 | Bool 62 | | ExistentialQuantification : 63 | Bool 64 | | ExplicitForAll : 65 | Bool 66 | | ExplicitNamespaces : 67 | Bool 68 | | ExtendedDefaultRules : 69 | Bool 70 | | ExtensibleRecords : 71 | Bool 72 | | FlexibleContexts : 73 | Bool 74 | | FlexibleInstances : 75 | Bool 76 | | ForeignFunctionInterface : 77 | Bool 78 | | FunctionalDependencies : 79 | Bool 80 | | GADTSyntax : 81 | Bool 82 | | GADTs : 83 | Bool 84 | | GHCForeignImportPrim : 85 | Bool 86 | | GeneralisedNewtypeDeriving : 87 | Bool 88 | | GeneralizedNewtypeDeriving : 89 | Bool 90 | | Generics : 91 | Bool 92 | | HereDocuments : 93 | Bool 94 | | HexFloatLiterals : 95 | Bool 96 | | ImplicitParams : 97 | Bool 98 | | ImplicitPrelude : 99 | Bool 100 | | ImpredicativeTypes : 101 | Bool 102 | | IncoherentInstances : 103 | Bool 104 | | InstanceSigs : 105 | Bool 106 | | InterruptibleFFI : 107 | Bool 108 | | JavaScriptFFI : 109 | Bool 110 | | KindSignatures : 111 | Bool 112 | | LambdaCase : 113 | Bool 114 | | LiberalTypeSynonyms : 115 | Bool 116 | | MagicHash : 117 | Bool 118 | | MonadComprehensions : 119 | Bool 120 | | MonadFailDesugaring : 121 | Bool 122 | | MonoLocalBinds : 123 | Bool 124 | | MonoPatBinds : 125 | Bool 126 | | MonomorphismRestriction : 127 | Bool 128 | | MultiParamTypeClasses : 129 | Bool 130 | | MultiWayIf : 131 | Bool 132 | | NPlusKPatterns : 133 | Bool 134 | | NamedFieldPuns : 135 | Bool 136 | | NamedWildCards : 137 | Bool 138 | | NegativeLiterals : 139 | Bool 140 | | NewQualifiedOperators : 141 | Bool 142 | | NondecreasingIndentation : 143 | Bool 144 | | NullaryTypeClasses : 145 | Bool 146 | | NumDecimals : 147 | Bool 148 | | NumericUnderscores : 149 | Bool 150 | | OverlappingInstances : 151 | Bool 152 | | OverloadedLabels : 153 | Bool 154 | | OverloadedLists : 155 | Bool 156 | | OverloadedStrings : 157 | Bool 158 | | PackageImports : 159 | Bool 160 | | ParallelArrays : 161 | Bool 162 | | ParallelListComp : 163 | Bool 164 | | PartialTypeSignatures : 165 | Bool 166 | | PatternGuards : 167 | Bool 168 | | PatternSignatures : 169 | Bool 170 | | PatternSynonyms : 171 | Bool 172 | | PolyKinds : 173 | Bool 174 | | PolymorphicComponents : 175 | Bool 176 | | PostfixOperators : 177 | Bool 178 | | QuantifiedConstraints : 179 | Bool 180 | | QuasiQuotes : 181 | Bool 182 | | Rank2Types : 183 | Bool 184 | | RankNTypes : 185 | Bool 186 | | RebindableSyntax : 187 | Bool 188 | | RecordPuns : 189 | Bool 190 | | RecordWildCards : 191 | Bool 192 | | RecursiveDo : 193 | Bool 194 | | RegularPatterns : 195 | Bool 196 | | RelaxedPolyRec : 197 | Bool 198 | | RestrictedTypeSynonyms : 199 | Bool 200 | | RoleAnnotations : 201 | Bool 202 | | Safe : 203 | Bool 204 | | SafeImports : 205 | Bool 206 | | ScopedTypeVariables : 207 | Bool 208 | | StandaloneDeriving : 209 | Bool 210 | | StarIsType : 211 | Bool 212 | | StaticPointers : 213 | Bool 214 | | Strict : 215 | Bool 216 | | StrictData : 217 | Bool 218 | | TemplateHaskell : 219 | Bool 220 | | TemplateHaskellQuotes : 221 | Bool 222 | | TraditionalRecordSyntax : 223 | Bool 224 | | TransformListComp : 225 | Bool 226 | | Trustworthy : 227 | Bool 228 | | TupleSections : 229 | Bool 230 | | TypeApplications : 231 | Bool 232 | | TypeFamilies : 233 | Bool 234 | | TypeFamilyDependencies : 235 | Bool 236 | | TypeInType : 237 | Bool 238 | | TypeOperators : 239 | Bool 240 | | TypeSynonymInstances : 241 | Bool 242 | | UnboxedSums : 243 | Bool 244 | | UnboxedTuples : 245 | Bool 246 | | UndecidableInstances : 247 | Bool 248 | | UndecidableSuperClasses : 249 | Bool 250 | | UnicodeSyntax : 251 | Bool 252 | | UnliftedFFITypes : 253 | Bool 254 | | Unsafe : 255 | Bool 256 | | ViewPatterns : 257 | Bool 258 | | XmlSyntax : 259 | Bool 260 | > 261 | -------------------------------------------------------------------------------- /dhall/types/Flag.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { default : Bool, description : Text, manual : Bool, name : Text } 3 | -------------------------------------------------------------------------------- /dhall/types/ForeignLibOption.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Standalone > 3 | -------------------------------------------------------------------------------- /dhall/types/ForeignLibType.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Shared | Static > 3 | -------------------------------------------------------------------------------- /dhall/types/ForeignLibrary.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall 3 | ⩓ { type : 4 | ./ForeignLibType.dhall 5 | , options : 6 | List ./ForeignLibOption.dhall 7 | , lib-version-info : 8 | Optional { current : Natural, revision : Natural, age : Natural } 9 | , lib-version-linux : 10 | Optional ./Version.dhall 11 | , mod-def-files : 12 | List Text 13 | } 14 | -------------------------------------------------------------------------------- /dhall/types/Guarded.dhall: -------------------------------------------------------------------------------- 1 | λ(A : Type) → ./Config.dhall → A 2 | -------------------------------------------------------------------------------- /dhall/types/Language.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Haskell2010 | Haskell98 | UnknownLanguage : { _1 : Text } > 3 | -------------------------------------------------------------------------------- /dhall/types/Library.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall 3 | ⩓ { exposed-modules : 4 | List Text 5 | , reexported-modules : 6 | List { original : { package : Optional Text, name : Text }, name : Text } 7 | , signatures : 8 | List Text 9 | , visibility : 10 | ./LibraryVisibility.dhall 11 | } 12 | -------------------------------------------------------------------------------- /dhall/types/LibraryName.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < main-library | sub-library : Text > 3 | -------------------------------------------------------------------------------- /dhall/types/LibraryVisibility.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < private | public > 3 | -------------------------------------------------------------------------------- /dhall/types/License.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < AGPL : 3 | Optional ./Version.dhall 4 | | AllRightsReserved 5 | | Apache : 6 | Optional ./Version.dhall 7 | | BSD2 8 | | BSD3 9 | | BSD4 10 | | GPL : 11 | Optional ./Version.dhall 12 | | ISC 13 | | LGPL : 14 | Optional ./Version.dhall 15 | | MIT 16 | | MPL : 17 | ./Version.dhall 18 | | Other 19 | | PublicDomain 20 | | SPDX : 21 | ./SPDX.dhall 22 | | Unknown : 23 | Text 24 | | Unspecified 25 | > 26 | -------------------------------------------------------------------------------- /dhall/types/Mixin.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { package : 3 | Text 4 | , renaming : 5 | { provides : ./ModuleRenaming.dhall, requires : ./ModuleRenaming.dhall } 6 | } 7 | -------------------------------------------------------------------------------- /dhall/types/ModuleRenaming.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < default | hiding : List Text | renaming : List { rename : Text, to : Text } > 3 | -------------------------------------------------------------------------------- /dhall/types/OS.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < AIX 3 | | Android 4 | | DragonFly 5 | | FreeBSD 6 | | Ghcjs 7 | | HPUX 8 | | HaLVM 9 | | Hurd 10 | | IOS 11 | | IRIX 12 | | Linux 13 | | NetBSD 14 | | OSX 15 | | OpenBSD 16 | | OtherOS : 17 | { _1 : Text } 18 | | Solaris 19 | | Windows 20 | > 21 | -------------------------------------------------------------------------------- /dhall/types/Package.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { author : 3 | Text 4 | , benchmarks : 5 | List { name : Text, benchmark : ./Config.dhall → ./Benchmark.dhall } 6 | , bug-reports : 7 | Text 8 | , build-type : 9 | Optional ./BuildType.dhall 10 | , cabal-version : 11 | ./Version.dhall 12 | , category : 13 | Text 14 | , copyright : 15 | Text 16 | , custom-setup : 17 | Optional ./SetupBuildInfo.dhall 18 | , data-dir : 19 | Text 20 | , data-files : 21 | List Text 22 | , description : 23 | Text 24 | , executables : 25 | List { name : Text, executable : ./Config.dhall → ./Executable.dhall } 26 | , extra-doc-files : 27 | List Text 28 | , extra-source-files : 29 | List Text 30 | , extra-tmp-files : 31 | List Text 32 | , flags : 33 | List ./Flag.dhall 34 | , foreign-libraries : 35 | List { name : Text, foreign-lib : ./Config.dhall → ./ForeignLibrary.dhall } 36 | , homepage : 37 | Text 38 | , library : 39 | Optional (./Config.dhall → ./Library.dhall) 40 | , license : 41 | ./License.dhall 42 | , license-files : 43 | List Text 44 | , maintainer : 45 | Text 46 | , name : 47 | Text 48 | , package-url : 49 | Text 50 | , source-repos : 51 | List ./SourceRepo.dhall 52 | , stability : 53 | Text 54 | , sub-libraries : 55 | List { name : Text, library : ./Config.dhall → ./Library.dhall } 56 | , synopsis : 57 | Text 58 | , test-suites : 59 | List { name : Text, test-suite : ./Config.dhall → ./TestSuite.dhall } 60 | , tested-with : 61 | List { compiler : ./Compiler.dhall, version : ./VersionRange.dhall } 62 | , version : 63 | ./Version.dhall 64 | , x-fields : 65 | List { _1 : Text, _2 : Text } 66 | } 67 | -------------------------------------------------------------------------------- /dhall/types/PkgconfigVersionRange.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ∀(PkgconfigVersionRange : Type) 3 | → ∀(anyVersion : PkgconfigVersionRange) 4 | → ∀(thisVersion : Text → PkgconfigVersionRange) 5 | → ∀(laterVersion : Text → PkgconfigVersionRange) 6 | → ∀(earlierVersion : Text → PkgconfigVersionRange) 7 | → ∀(orLaterVersion : Text → PkgconfigVersionRange) 8 | → ∀(orEarlierVersion : Text → PkgconfigVersionRange) 9 | → ∀ ( unionVersionRanges 10 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 11 | ) 12 | → ∀ ( intersectVersionRanges 13 | : PkgconfigVersionRange → PkgconfigVersionRange → PkgconfigVersionRange 14 | ) 15 | → PkgconfigVersionRange 16 | -------------------------------------------------------------------------------- /dhall/types/RepoKind.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < RepoHead | RepoKindUnknown : { _1 : Text } | RepoThis > 3 | -------------------------------------------------------------------------------- /dhall/types/RepoType.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Bazaar 3 | | CVS 4 | | Darcs 5 | | Git 6 | | GnuArch 7 | | Mercurial 8 | | Monotone 9 | | OtherRepoType : 10 | { _1 : Text } 11 | | SVN 12 | > 13 | -------------------------------------------------------------------------------- /dhall/types/SPDX.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ∀(SPDX : Type) 3 | → ∀ ( license 4 | : ∀(id : ./SPDX/LicenseId.dhall) 5 | → ∀(exception : Optional ./SPDX/LicenseExceptionId.dhall) 6 | → SPDX 7 | ) 8 | → ∀ ( licenseVersionOrLater 9 | : ∀(id : ./SPDX/LicenseId.dhall) 10 | → ∀(exception : Optional ./SPDX/LicenseExceptionId.dhall) 11 | → SPDX 12 | ) 13 | → ∀ ( ref 14 | : ∀(ref : Text) 15 | → ∀(exception : Optional ./SPDX/LicenseExceptionId.dhall) 16 | → SPDX 17 | ) 18 | → ∀ ( refWithFile 19 | : ∀(ref : Text) 20 | → ∀(file : Text) 21 | → ∀(exception : Optional ./SPDX/LicenseExceptionId.dhall) 22 | → SPDX 23 | ) 24 | → ∀(and : SPDX → SPDX → SPDX) 25 | → ∀(or : SPDX → SPDX → SPDX) 26 | → SPDX 27 | -------------------------------------------------------------------------------- /dhall/types/SPDX/LicenseExceptionId.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Autoconf_exception_2_0 3 | | Autoconf_exception_3_0 4 | | Bison_exception_2_2 5 | | Bootloader_exception 6 | | CLISP_exception_2_0 7 | | Classpath_exception_2_0 8 | | DS389_exception 9 | | DigiRule_FOSS_exception 10 | | ECos_exception_2_0 11 | | FLTK_exception 12 | | Fawkes_Runtime_exception 13 | | Font_exception_2_0 14 | | Freertos_exception_2_0 15 | | GCC_exception_2_0 16 | | GCC_exception_3_1 17 | | GPL_CC_1_0 18 | | Gnu_javamail_exception 19 | | I2p_gpl_java_exception 20 | | LLVM_exception 21 | | LZMA_exception 22 | | Libtool_exception 23 | | Linux_syscall_note 24 | | Mif_exception 25 | | Nokia_Qt_exception_1_1 26 | | OCCT_exception_1_0 27 | | OCaml_LGPL_linking_exception 28 | | OpenJDK_assembly_exception_1_0 29 | | Openvpn_openssl_exception 30 | | PS_or_PDF_font_exception_20170817 31 | | Qt_GPL_exception_1_0 32 | | Qt_LGPL_exception_1_1 33 | | Qwt_exception_1_0 34 | | Swift_exception 35 | | U_boot_exception_2_0 36 | | Universal_FOSS_exception_1_0 37 | | WxWindows_exception_3_1 38 | > 39 | -------------------------------------------------------------------------------- /dhall/types/SPDX/LicenseId.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < AAL 3 | | ADSL 4 | | AFL_1_1 5 | | AFL_1_2 6 | | AFL_2_0 7 | | AFL_2_1 8 | | AFL_3_0 9 | | AGPL_1_0 10 | | AGPL_1_0_only 11 | | AGPL_1_0_or_later 12 | | AGPL_3_0_only 13 | | AGPL_3_0_or_later 14 | | AMDPLPA 15 | | AML 16 | | AMPAS 17 | | ANTLR_PD 18 | | APAFML 19 | | APL_1_0 20 | | APSL_1_0 21 | | APSL_1_1 22 | | APSL_1_2 23 | | APSL_2_0 24 | | Abstyles 25 | | Adobe_2006 26 | | Adobe_Glyph 27 | | Afmparse 28 | | Aladdin 29 | | Apache_1_0 30 | | Apache_1_1 31 | | Apache_2_0 32 | | Artistic_1_0 33 | | Artistic_1_0_Perl 34 | | Artistic_1_0_cl8 35 | | Artistic_2_0 36 | | BSD_1_Clause 37 | | BSD_2_Clause 38 | | BSD_2_Clause_FreeBSD 39 | | BSD_2_Clause_NetBSD 40 | | BSD_2_Clause_Patent 41 | | BSD_3_Clause 42 | | BSD_3_Clause_Attribution 43 | | BSD_3_Clause_Clear 44 | | BSD_3_Clause_LBNL 45 | | BSD_3_Clause_No_Nuclear_License 46 | | BSD_3_Clause_No_Nuclear_License_2014 47 | | BSD_3_Clause_No_Nuclear_Warranty 48 | | BSD_3_Clause_Open_MPI 49 | | BSD_4_Clause 50 | | BSD_4_Clause_UC 51 | | BSD_Protection 52 | | BSD_Source_Code 53 | | BSL_1_0 54 | | Bahyph 55 | | Barr 56 | | Beerware 57 | | BitTorrent_1_0 58 | | BitTorrent_1_1 59 | | Blessing 60 | | BlueOak_1_0_0 61 | | Borceux 62 | | Bzip2_1_0_5 63 | | Bzip2_1_0_6 64 | | CATOSL_1_1 65 | | CC0_1_0 66 | | CC_BY_1_0 67 | | CC_BY_2_0 68 | | CC_BY_2_5 69 | | CC_BY_3_0 70 | | CC_BY_4_0 71 | | CC_BY_NC_1_0 72 | | CC_BY_NC_2_0 73 | | CC_BY_NC_2_5 74 | | CC_BY_NC_3_0 75 | | CC_BY_NC_4_0 76 | | CC_BY_NC_ND_1_0 77 | | CC_BY_NC_ND_2_0 78 | | CC_BY_NC_ND_2_5 79 | | CC_BY_NC_ND_3_0 80 | | CC_BY_NC_ND_4_0 81 | | CC_BY_NC_SA_1_0 82 | | CC_BY_NC_SA_2_0 83 | | CC_BY_NC_SA_2_5 84 | | CC_BY_NC_SA_3_0 85 | | CC_BY_NC_SA_4_0 86 | | CC_BY_ND_1_0 87 | | CC_BY_ND_2_0 88 | | CC_BY_ND_2_5 89 | | CC_BY_ND_3_0 90 | | CC_BY_ND_4_0 91 | | CC_BY_SA_1_0 92 | | CC_BY_SA_2_0 93 | | CC_BY_SA_2_5 94 | | CC_BY_SA_3_0 95 | | CC_BY_SA_4_0 96 | | CC_PDDC 97 | | CDDL_1_0 98 | | CDDL_1_1 99 | | CDLA_Permissive_1_0 100 | | CDLA_Sharing_1_0 101 | | CECILL_1_0 102 | | CECILL_1_1 103 | | CECILL_2_0 104 | | CECILL_2_1 105 | | CECILL_B 106 | | CECILL_C 107 | | CERN_OHL_1_1 108 | | CERN_OHL_1_2 109 | | CNRI_Jython 110 | | CNRI_Python 111 | | CNRI_Python_GPL_Compatible 112 | | CPAL_1_0 113 | | CPL_1_0 114 | | CPOL_1_02 115 | | CUA_OPL_1_0 116 | | Caldera 117 | | ClArtistic 118 | | Condor_1_1 119 | | Copyleft_next_0_3_0 120 | | Copyleft_next_0_3_1 121 | | Crossword 122 | | CrystalStacker 123 | | Cube 124 | | Curl 125 | | DOC 126 | | DSDP 127 | | D_FSL_1_0 128 | | Diffmark 129 | | Dotseqn 130 | | Dvipdfm 131 | | ECL_1_0 132 | | ECL_2_0 133 | | EFL_1_0 134 | | EFL_2_0 135 | | EGenix 136 | | EPL_1_0 137 | | EPL_2_0 138 | | EUDatagrid 139 | | EUPL_1_0 140 | | EUPL_1_1 141 | | EUPL_1_2 142 | | Entessa 143 | | ErlPL_1_1 144 | | Eurosym 145 | | FSFAP 146 | | FSFUL 147 | | FSFULLR 148 | | FTL 149 | | Fair 150 | | Frameworx_1_0 151 | | FreeImage 152 | | GFDL_1_1_only 153 | | GFDL_1_1_or_later 154 | | GFDL_1_2_only 155 | | GFDL_1_2_or_later 156 | | GFDL_1_3_only 157 | | GFDL_1_3_or_later 158 | | GL2PS 159 | | GPL_1_0_only 160 | | GPL_1_0_or_later 161 | | GPL_2_0_only 162 | | GPL_2_0_or_later 163 | | GPL_3_0_only 164 | | GPL_3_0_or_later 165 | | GSOAP_1_3b 166 | | Giftware 167 | | Glide 168 | | Glulxe 169 | | Gnuplot 170 | | HPND 171 | | HPND_sell_variant 172 | | HaskellReport 173 | | IBM_pibs 174 | | ICU 175 | | IJG 176 | | IMatix 177 | | IPA 178 | | IPL_1_0 179 | | ISC 180 | | ImageMagick 181 | | Imlib2 182 | | Info_ZIP 183 | | Intel 184 | | Intel_ACPI 185 | | Interbase_1_0 186 | | JPNIC 187 | | JSON 188 | | JasPer_2_0 189 | | LAL_1_2 190 | | LAL_1_3 191 | | LGPLLR 192 | | LGPL_2_0_only 193 | | LGPL_2_0_or_later 194 | | LGPL_2_1_only 195 | | LGPL_2_1_or_later 196 | | LGPL_3_0_only 197 | | LGPL_3_0_or_later 198 | | LPL_1_0 199 | | LPL_1_02 200 | | LPPL_1_0 201 | | LPPL_1_1 202 | | LPPL_1_2 203 | | LPPL_1_3a 204 | | LPPL_1_3c 205 | | Latex2e 206 | | Leptonica 207 | | LiLiQ_P_1_1 208 | | LiLiQ_R_1_1 209 | | LiLiQ_Rplus_1_1 210 | | Libpng 211 | | Libpng_2_0 212 | | Libtiff 213 | | Linux_OpenIB 214 | | MIT 215 | | MITNFA 216 | | MIT_0 217 | | MIT_CMU 218 | | MIT_advertising 219 | | MIT_enna 220 | | MIT_feh 221 | | MPL_1_0 222 | | MPL_1_1 223 | | MPL_2_0 224 | | MPL_2_0_no_copyleft_exception 225 | | MS_PL 226 | | MS_RL 227 | | MTLL 228 | | MakeIndex 229 | | MirOS 230 | | Motosoto 231 | | Mpich2 232 | | Multics 233 | | Mup 234 | | NASA_1_3 235 | | NBPL_1_0 236 | | NCSA 237 | | NGPL 238 | | NLOD_1_0 239 | | NLPL 240 | | NOSL 241 | | NPL_1_0 242 | | NPL_1_1 243 | | NPOSL_3_0 244 | | NRL 245 | | NTP 246 | | Naumen 247 | | NetCDF 248 | | Net_SNMP 249 | | Newsletr 250 | | Nokia 251 | | Noweb 252 | | NullBSD 253 | | OCCT_PL 254 | | OCLC_2_0 255 | | ODC_By_1_0 256 | | ODbL_1_0 257 | | OFL_1_0 258 | | OFL_1_1 259 | | OGL_UK_1_0 260 | | OGL_UK_2_0 261 | | OGL_UK_3_0 262 | | OGTSL 263 | | OLDAP_1_1 264 | | OLDAP_1_2 265 | | OLDAP_1_3 266 | | OLDAP_1_4 267 | | OLDAP_2_0 268 | | OLDAP_2_0_1 269 | | OLDAP_2_1 270 | | OLDAP_2_2 271 | | OLDAP_2_2_1 272 | | OLDAP_2_2_2 273 | | OLDAP_2_3 274 | | OLDAP_2_4 275 | | OLDAP_2_5 276 | | OLDAP_2_6 277 | | OLDAP_2_7 278 | | OLDAP_2_8 279 | | OML 280 | | OPL_1_0 281 | | OSET_PL_2_1 282 | | OSL_1_0 283 | | OSL_1_1 284 | | OSL_2_0 285 | | OSL_2_1 286 | | OSL_3_0 287 | | OpenSSL 288 | | PDDL_1_0 289 | | PHP_3_0 290 | | PHP_3_01 291 | | Parity_6_0_0 292 | | Plexus 293 | | PostgreSQL 294 | | Psfrag 295 | | Psutils 296 | | Python_2_0 297 | | QPL_1_0 298 | | Qhull 299 | | RHeCos_1_1 300 | | RPL_1_1 301 | | RPL_1_5 302 | | RPSL_1_0 303 | | RSA_MD 304 | | RSCPL 305 | | Rdisc 306 | | Ruby 307 | | SAX_PD 308 | | SCEA 309 | | SGI_B_1_0 310 | | SGI_B_1_1 311 | | SGI_B_2_0 312 | | SHL_0_5 313 | | SHL_0_51 314 | | SISSL 315 | | SISSL_1_2 316 | | SMLNJ 317 | | SMPPL 318 | | SNIA 319 | | SPL_1_0 320 | | SSPL_1_0 321 | | SWL 322 | | Saxpath 323 | | Sendmail 324 | | Sendmail_8_23 325 | | SimPL_2_0 326 | | Sleepycat 327 | | Spencer_86 328 | | Spencer_94 329 | | Spencer_99 330 | | SugarCRM_1_1_3 331 | | TAPR_OHL_1_0 332 | | TCL 333 | | TCP_wrappers 334 | | TMate 335 | | TORQUE_1_1 336 | | TOSL 337 | | TU_Berlin_1_0 338 | | TU_Berlin_2_0 339 | | UPL_1_0 340 | | Unicode_DFS_2015 341 | | Unicode_DFS_2016 342 | | Unicode_TOU 343 | | Unlicense 344 | | VOSTROM 345 | | VSL_1_0 346 | | Vim 347 | | W3C 348 | | W3C_19980720 349 | | W3C_20150513 350 | | WTFPL 351 | | Watcom_1_0 352 | | Wsuipa 353 | | X11 354 | | XFree86_1_1 355 | | XSkat 356 | | Xerox 357 | | Xinetd 358 | | Xnet 359 | | Xpp 360 | | YPL_1_0 361 | | YPL_1_1 362 | | ZPL_1_1 363 | | ZPL_2_0 364 | | ZPL_2_1 365 | | Zed 366 | | Zend_2_0 367 | | Zimbra_1_3 368 | | Zimbra_1_4 369 | | Zlib 370 | | Zlib_acknowledgement 371 | > 372 | -------------------------------------------------------------------------------- /dhall/types/Scope.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < Private | Public > 3 | -------------------------------------------------------------------------------- /dhall/types/SetupBuildInfo.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { setup-depends : List ./Dependency.dhall } 3 | -------------------------------------------------------------------------------- /dhall/types/SourceRepo.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | { branch : 3 | Optional Text 4 | , kind : 5 | ./RepoKind.dhall 6 | , location : 7 | Optional Text 8 | , module : 9 | Optional Text 10 | , subdir : 11 | Optional Text 12 | , tag : 13 | Optional Text 14 | , type : 15 | Optional ./RepoType.dhall 16 | } 17 | -------------------------------------------------------------------------------- /dhall/types/TestSuite.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ./BuildInfo.dhall ⩓ { type : ./TestType.dhall } 3 | -------------------------------------------------------------------------------- /dhall/types/TestType.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | < detailed : { module : Text } | exitcode-stdio : { main-is : Text } > 3 | -------------------------------------------------------------------------------- /dhall/types/Version.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ∀(Version : Type) → ∀(v : Text → Version) → Version 3 | -------------------------------------------------------------------------------- /dhall/types/VersionRange.dhall: -------------------------------------------------------------------------------- 1 | -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written). 2 | ∀(VersionRange : Type) 3 | → ∀(anyVersion : VersionRange) 4 | → ∀(noVersion : VersionRange) 5 | → ∀(thisVersion : ./Version.dhall → VersionRange) 6 | → ∀(notThisVersion : ./Version.dhall → VersionRange) 7 | → ∀(laterVersion : ./Version.dhall → VersionRange) 8 | → ∀(earlierVersion : ./Version.dhall → VersionRange) 9 | → ∀(orLaterVersion : ./Version.dhall → VersionRange) 10 | → ∀(orEarlierVersion : ./Version.dhall → VersionRange) 11 | → ∀(withinVersion : ./Version.dhall → VersionRange) 12 | → ∀(majorBoundVersion : ./Version.dhall → VersionRange) 13 | → ∀(unionVersionRanges : VersionRange → VersionRange → VersionRange) 14 | → ∀(intersectVersionRanges : VersionRange → VersionRange → VersionRange) 15 | → ∀(differenceVersionRanges : VersionRange → VersionRange → VersionRange) 16 | → ∀(invertVersionRange : VersionRange → VersionRange) 17 | → VersionRange 18 | -------------------------------------------------------------------------------- /dhall/types/builtin.dhall: -------------------------------------------------------------------------------- 1 | { v : Text → List Natural } 2 | -------------------------------------------------------------------------------- /dhall/unconditional.dhall: -------------------------------------------------------------------------------- 1 | let unconditional 2 | : ∀(A : Type) → A → ./types/Guarded.dhall A 3 | = λ(A : Type) → λ(a : A) → λ(_ : ./types/Config.dhall) → a 4 | 5 | let executable 6 | : ∀(name : Text) 7 | → ∀(executable : ./types/Executable.dhall) 8 | → { name : 9 | Text 10 | , executable : 11 | ./types/Guarded.dhall ./types/Executable.dhall 12 | } 13 | = λ(name : Text) 14 | → λ(executable : ./types/Executable.dhall) 15 | → { name = 16 | name 17 | , executable = 18 | unconditional ./types/Executable.dhall executable 19 | } 20 | 21 | let library 22 | : ∀(library : ./types/Library.dhall) 23 | → Optional (./types/Guarded.dhall ./types/Library.dhall) 24 | = λ(library : ./types/Library.dhall) 25 | → Some (unconditional ./types/Library.dhall library) 26 | 27 | let test-suite 28 | : ∀(name : Text) 29 | → ∀(test-suite : ./types/TestSuite.dhall) 30 | → { name : 31 | Text 32 | , test-suite : 33 | ./types/Guarded.dhall ./types/TestSuite.dhall 34 | } 35 | = λ(name : Text) 36 | → λ(test-suite : ./types/TestSuite.dhall) 37 | → { name = 38 | name 39 | , test-suite = 40 | unconditional ./types/TestSuite.dhall test-suite 41 | } 42 | 43 | in { executable = executable, library = library, test-suite = test-suite } 44 | -------------------------------------------------------------------------------- /dhall/utils/GitHub-project.dhall: -------------------------------------------------------------------------------- 1 | let GitHubProject : Type = { owner : Text, repo : Text } 2 | 3 | let gitHubProject = 4 | λ(github : GitHubProject) 5 | → let gitHubRoot = "https://github.com/${github.owner}/${github.repo}" 6 | 7 | in ../defaults/Package.dhall 8 | ⫽ { name = 9 | github.repo 10 | , bug-reports = 11 | "${gitHubRoot}/issues" 12 | , homepage = 13 | gitHubRoot 14 | , source-repos = 15 | [ ../defaults/SourceRepo.dhall 16 | ⫽ { location = 17 | Some gitHubRoot 18 | , type = 19 | Some (../types/RepoType.dhall).Git 20 | } 21 | ] 22 | } 23 | 24 | in gitHubProject 25 | -------------------------------------------------------------------------------- /dhall/utils/majorVersions.dhall: -------------------------------------------------------------------------------- 1 | let Dependency = ../types/Dependency.dhall 2 | 3 | let LibraryName = ../types/LibraryName.dhall 4 | 5 | let Version = ../types/Version.dhall 6 | 7 | let VersionRange = ../types/VersionRange.dhall 8 | 9 | let Versions = 10 | { unionVersionRanges = 11 | ../VersionRange/unionVersionRanges.dhall 12 | , majorBoundVersion = 13 | ../VersionRange/majorBoundVersion.dhall 14 | , noVersion = 15 | ../VersionRange/noVersion.dhall 16 | } 17 | 18 | let majorVersions 19 | : Text → List Version → List LibraryName → Dependency 20 | = λ(package : Text) 21 | → λ(versions : List Version) 22 | → λ(library-names : List LibraryName) 23 | → { package = 24 | package 25 | , bounds = 26 | Optional/fold 27 | VersionRange 28 | ( List/fold 29 | Version 30 | versions 31 | (Optional VersionRange) 32 | ( λ(v : Version) 33 | → λ(r : Optional VersionRange) 34 | → Optional/fold 35 | VersionRange 36 | r 37 | (Optional VersionRange) 38 | ( λ(r : VersionRange) 39 | → Some 40 | ( Versions.unionVersionRanges 41 | (Versions.majorBoundVersion v) 42 | r 43 | ) 44 | ) 45 | (Some (Versions.majorBoundVersion v)) 46 | ) 47 | (None VersionRange) 48 | ) 49 | VersionRange 50 | (λ(a : VersionRange) → a) 51 | Versions.noVersion 52 | , library-names = 53 | library-names 54 | } 55 | 56 | in majorVersions 57 | -------------------------------------------------------------------------------- /dhall/utils/mapBuildInfo.dhall: -------------------------------------------------------------------------------- 1 | let types = ../types.dhall 2 | 3 | let mapOptional = https://prelude.dhall-lang.org/v10.0.0/Optional/map 4 | 5 | let mapList = https://prelude.dhall-lang.org/v10.0.0/List/map 6 | 7 | let mapGuarded = 8 | λ(a : Type) 9 | → λ(f : a → a) 10 | → λ(x : types.Config → a) 11 | → λ(config : types.Config) 12 | → f (x config) 13 | 14 | let NamedGuardedExecutable = 15 | { name : Text, executable : types.Config → types.Executable } 16 | 17 | let NamedGuardedLibrary = 18 | { name : Text, library : types.Config → types.Library } 19 | 20 | let NamedGuardedTestSuite = 21 | { name : Text, test-suite : types.Config → types.TestSuite } 22 | 23 | let NamedGuardedBenchmark = 24 | { name : Text, benchmark : types.Config → types.Benchmark } 25 | 26 | let NamedGuardedForeignLibrary = 27 | { name : Text, foreign-lib : types.Config → types.ForeignLibrary } 28 | 29 | in λ(f : types.BuildInfo → types.BuildInfo) 30 | → λ(package : types.Package) 31 | → package 32 | ⫽ { library = 33 | mapOptional 34 | (types.Config → types.Library) 35 | (types.Config → types.Library) 36 | ( mapGuarded 37 | types.Library 38 | ( λ(component : types.Library) 39 | → component ⫽ f component.(types.BuildInfo) 40 | ) 41 | ) 42 | package.library 43 | , executables = 44 | mapList 45 | NamedGuardedExecutable 46 | NamedGuardedExecutable 47 | ( λ(namedGuardedExecutable : NamedGuardedExecutable) 48 | → { name = 49 | namedGuardedExecutable.name 50 | , executable = 51 | mapGuarded 52 | types.Executable 53 | ( λ(component : types.Executable) 54 | → component ⫽ f component.(types.BuildInfo) 55 | ) 56 | namedGuardedExecutable.executable 57 | } 58 | ) 59 | package.executables 60 | , sub-libraries = 61 | mapList 62 | NamedGuardedLibrary 63 | NamedGuardedLibrary 64 | ( λ(namedGuardedLibrary : NamedGuardedLibrary) 65 | → { name = 66 | namedGuardedLibrary.name 67 | , library = 68 | mapGuarded 69 | types.Library 70 | ( λ(component : types.Library) 71 | → component ⫽ f component.(types.BuildInfo) 72 | ) 73 | namedGuardedLibrary.library 74 | } 75 | ) 76 | package.sub-libraries 77 | , test-suites = 78 | mapList 79 | NamedGuardedTestSuite 80 | NamedGuardedTestSuite 81 | ( λ(namedGuardedTestSuite : NamedGuardedTestSuite) 82 | → { name = 83 | namedGuardedTestSuite.name 84 | , test-suite = 85 | mapGuarded 86 | types.TestSuite 87 | ( λ(component : types.TestSuite) 88 | → component ⫽ f component.(types.BuildInfo) 89 | ) 90 | namedGuardedTestSuite.test-suite 91 | } 92 | ) 93 | package.test-suites 94 | , benchmarks = 95 | mapList 96 | NamedGuardedBenchmark 97 | NamedGuardedBenchmark 98 | ( λ(namedGuardedBenchmark : NamedGuardedBenchmark) 99 | → { name = 100 | namedGuardedBenchmark.name 101 | , benchmark = 102 | mapGuarded 103 | types.Benchmark 104 | ( λ(component : types.Benchmark) 105 | → component ⫽ f component.(types.BuildInfo) 106 | ) 107 | namedGuardedBenchmark.benchmark 108 | } 109 | ) 110 | package.benchmarks 111 | , foreign-libraries = 112 | mapList 113 | NamedGuardedForeignLibrary 114 | NamedGuardedForeignLibrary 115 | ( λ(namedGuardedForeignLibrary : NamedGuardedForeignLibrary) 116 | → { name = 117 | namedGuardedForeignLibrary.name 118 | , foreign-lib = 119 | mapGuarded 120 | types.ForeignLibrary 121 | ( λ(component : types.ForeignLibrary) 122 | → component ⫽ f component.(types.BuildInfo) 123 | ) 124 | namedGuardedForeignLibrary.foreign-lib 125 | } 126 | ) 127 | package.foreign-libraries 128 | } 129 | -------------------------------------------------------------------------------- /dhall/utils/mapSourceRepos.dhall: -------------------------------------------------------------------------------- 1 | let SourceRepo = ../types/SourceRepo.dhall 2 | 3 | let Package = ../types/Package.dhall 4 | 5 | let mapSourceRepos 6 | : (SourceRepo → SourceRepo) → Package → Package 7 | = λ(f : SourceRepo → SourceRepo) 8 | → λ(pkg : Package) 9 | → pkg 10 | ⫽ { source-repos = 11 | List/build 12 | SourceRepo 13 | ( λ(list : Type) 14 | → λ(cons : SourceRepo → list → list) 15 | → List/fold 16 | SourceRepo 17 | pkg.source-repos 18 | list 19 | (λ(x : SourceRepo) → cons (f x)) 20 | ) 21 | } 22 | 23 | in mapSourceRepos 24 | -------------------------------------------------------------------------------- /dhall/utils/package.dhall: -------------------------------------------------------------------------------- 1 | { GitHub-project = 2 | ./GitHub-project.dhall 3 | , majorVersions = 4 | ./majorVersions.dhall 5 | , mapBuildInfo = 6 | ./mapBuildInfo.dhall 7 | , mapSourceRepos = 8 | ./mapSourceRepos.dhall 9 | } 10 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | intersphinx_mapping = { 4 | 'dhall-to-cabal': ('https://dhall-to-cabal.readthedocs.io/en/latest', None) 5 | } 6 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | types 5 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | alabaster==0.7.7 2 | argh==0.26.1 3 | Babel==2.9.1 4 | backports-abc==0.4 5 | backports.ssl-match-hostname==3.5.0.1 6 | certifi==2015.11.20.1 7 | CommonMark==0.5.4 8 | docutils==0.12 9 | Jinja2==2.11.3 10 | livereload==2.4.1 11 | MarkupSafe==0.23 12 | pathtools==0.1.2 13 | Pygments==2.7.4 14 | pytz==2015.7 15 | PyYAML==5.4 16 | recommonmark==0.4.0 17 | singledispatch==3.4.0.3 18 | six==1.10.0 19 | snowballstemmer==1.2.1 20 | Sphinx==1.3.6 21 | sphinx-autobuild==0.5.2 22 | sphinx-rtd-theme==0.1.9 23 | tornado==4.3 24 | watchdog==0.8.3 25 | wheel==0.26.0 26 | -------------------------------------------------------------------------------- /docs/types.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | Types 3 | ======= 4 | 5 | dhall/types/Package.dhall 6 | ------------------------- 7 | 8 | ``author`` : ``Text`` 9 | The author of this package. 10 | ``benchmarks`` : ``List ``:dhall-to-cabal:type:`Benchmark` 11 | A list of benchmarks to run for this package. 12 | -------------------------------------------------------------------------------- /golden-tests/GoldenTests.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | {-# LANGUAGE ViewPatterns #-} 3 | module Main ( main ) where 4 | 5 | import Data.Algorithm.Diff 6 | import Data.Algorithm.DiffOutput 7 | import Data.Function ( (&) ) 8 | import Lens.Micro ( set ) 9 | import System.FilePath ( takeBaseName, takeDirectory, replaceExtension ) 10 | import Test.Tasty ( defaultMain, TestTree, testGroup ) 11 | import Test.Tasty.Golden ( findByExtension ) 12 | import Test.Tasty.Golden.Advanced ( goldenTest ) 13 | 14 | import qualified Data.ByteString as BS 15 | import qualified Data.Text.IO as StrictText 16 | import qualified Data.Text.Lazy.IO as LazyText 17 | import qualified Data.Text.Lazy as LazyText 18 | import qualified Data.Text.Prettyprint.Doc as Pretty 19 | import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty 20 | import qualified Dhall 21 | import qualified Dhall.Core 22 | import qualified Distribution.PackageDescription.Parsec as Cabal 23 | import qualified Distribution.PackageDescription.PrettyPrint as Cabal 24 | import qualified Distribution.Verbosity as Cabal 25 | 26 | import CabalToDhall ( cabalToDhall, parseGenericPackageDescriptionThrows ) 27 | import DhallLocation ( DhallLocation ( DhallLocation ) ) 28 | import DhallToCabal ( dhallToCabal ) 29 | 30 | 31 | 32 | main :: IO () 33 | main = 34 | defaultMain =<< goldenTests 35 | 36 | 37 | preludeLocation :: Dhall.Core.Import 38 | preludeLocation = 39 | Dhall.Core.Import 40 | { Dhall.Core.importHashed = 41 | Dhall.Core.ImportHashed 42 | { Dhall.Core.hash = 43 | Nothing 44 | , Dhall.Core.importType = 45 | Dhall.Core.Local 46 | Dhall.Core.Here 47 | ( Dhall.Core.File 48 | ( Dhall.Core.Directory [ "dhall", "..", ".." ] ) 49 | "prelude.dhall" 50 | ) 51 | } 52 | , Dhall.Core.importMode = 53 | Dhall.Core.Code 54 | } 55 | 56 | 57 | typesLocation :: Dhall.Core.Import 58 | typesLocation = 59 | Dhall.Core.Import 60 | { Dhall.Core.importHashed = 61 | Dhall.Core.ImportHashed 62 | { Dhall.Core.hash = 63 | Nothing 64 | , Dhall.Core.importType = 65 | Dhall.Core.Local 66 | Dhall.Core.Here 67 | ( Dhall.Core.File 68 | ( Dhall.Core.Directory [ "dhall", "..", ".." ] ) 69 | "types.dhall" 70 | ) 71 | } 72 | , Dhall.Core.importMode = 73 | Dhall.Core.Code 74 | } 75 | 76 | 77 | goldenTests :: IO TestTree 78 | goldenTests = do 79 | -- Note: must remain in sync with the layout options in 80 | -- cabal-to-dhall/Main.hs, so that test output is easy to generate 81 | -- at the command line. 82 | let layoutOpts = Pretty.defaultLayoutOptions 83 | { Pretty.layoutPageWidth = Pretty.AvailablePerLine 80 1.0 } 84 | dhallLocation = DhallLocation preludeLocation typesLocation 85 | 86 | dhallFiles <- 87 | findByExtension [ ".dhall" ] "golden-tests/dhall-to-cabal" 88 | cabalFiles <- 89 | findByExtension [ ".cabal" ] "golden-tests/cabal-to-dhall" 90 | 91 | return 92 | $ testGroup "golden tests" 93 | [ testGroup "dhall-to-cabal" 94 | [ goldenTest 95 | ( takeBaseName dhallFile ) 96 | ( Cabal.readGenericPackageDescription Cabal.normal cabalFile ) 97 | ( StrictText.readFile dhallFile >>= dhallToCabal settings ) 98 | ( \ ( Cabal.showGenericPackageDescription -> exp ) ( Cabal.showGenericPackageDescription -> act ) -> do 99 | if exp == act then 100 | return Nothing 101 | else do 102 | putStrLn $ "Diff between expected " ++ cabalFile ++ 103 | " and actual " ++ dhallFile ++ " :" 104 | let gDiff = getGroupedDiff (lines exp) (lines act) 105 | putStrLn $ ppDiff gDiff 106 | return $ Just "Generated .cabal file does not match input" 107 | ) 108 | ( Cabal.writeGenericPackageDescription cabalFile ) 109 | | dhallFile <- dhallFiles 110 | , let cabalFile = replaceExtension dhallFile ".cabal" 111 | settings = Dhall.defaultInputSettings 112 | & set Dhall.rootDirectory ( takeDirectory dhallFile ) 113 | & set Dhall.sourceName dhallFile 114 | ] 115 | , testGroup "cabal-to-dhall" 116 | [ goldenTest 117 | ( takeBaseName cabalFile ) 118 | ( LazyText.readFile dhallFile ) 119 | ( BS.readFile cabalFile >>= parseGenericPackageDescriptionThrows 120 | & fmap ( Pretty.renderLazy 121 | . Pretty.layoutSmart layoutOpts . Pretty.pretty 122 | . cabalToDhall dhallLocation 123 | ) 124 | ) 125 | 126 | ( \( LazyText.unpack -> exp ) ( LazyText.unpack -> act ) -> do 127 | let 128 | gDiff = 129 | getGroupedDiff ( lines exp ) ( lines act ) 130 | 131 | ppDiff' = 132 | ppDiff gDiff 133 | 134 | if ppDiff' == "\n" 135 | then return Nothing 136 | else do 137 | putStrLn 138 | ( "Diff between expected " 139 | ++ dhallFile 140 | ++ " and actual " 141 | ++ cabalFile 142 | ++ " :" 143 | ) 144 | 145 | putStrLn ppDiff' 146 | 147 | return ( Just "Generated .dhall file does not match input" ) 148 | ) 149 | ( LazyText.writeFile dhallFile ) 150 | | cabalFile <- cabalFiles 151 | , let dhallFile = replaceExtension cabalFile ".dhall" 152 | ] 153 | ] 154 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/SPDX.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: foo 3 | version: 0 4 | license: (AGPL-3.0-or-later WITH Classpath-exception-2.0 OR Apache-2.0+) AND (LicenseRef-MyFancyLicense OR DocumentRef-LICENSE.txt:LicenseRef-MyFancierLicense) 5 | 6 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/SPDX.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { license = 7 | types.License.SPDX 8 | ( prelude.SPDX.and 9 | ( prelude.SPDX.or 10 | ( prelude.SPDX.license 11 | types.LicenseId.AGPL_3_0_or_later 12 | (Some types.LicenseExceptionId.Classpath_exception_2_0) 13 | ) 14 | ( prelude.SPDX.licenseVersionOrLater 15 | types.LicenseId.Apache_2_0 16 | (None types.LicenseExceptionId) 17 | ) 18 | ) 19 | ( prelude.SPDX.or 20 | ( prelude.SPDX.ref 21 | "MyFancyLicense" 22 | (None types.LicenseExceptionId) 23 | ) 24 | ( prelude.SPDX.refWithFile 25 | "MyFancierLicense" 26 | "LICENSE.txt" 27 | (None types.LicenseExceptionId) 28 | ) 29 | ) 30 | ) 31 | , name = 32 | "foo" 33 | , version = 34 | prelude.v "0" 35 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/autogen-includes.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: foo 3 | version: 0 4 | 5 | library 6 | default-language: Haskell2010 7 | autogen-includes: foo bar 8 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/autogen-includes.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "3.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → prelude.defaults.MainLibrary 12 | ⫽ { autogen-includes = 13 | [ "foo", "bar" ] 14 | , default-language = 15 | Some types.Language.Haskell2010 16 | } 17 | ) 18 | , name = 19 | "foo" 20 | , version = 21 | prelude.v "0" 22 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/benchmark.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.0 2 | name: blah 3 | version: 1 4 | 5 | benchmark fancy-benchmark 6 | type: exitcode-stdio-1.0 7 | main-is: Main.hs 8 | ghc-options: -O2 9 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/benchmark.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { benchmarks = 7 | [ { benchmark = 8 | λ(config : types.Config) 9 | → prelude.defaults.Benchmark 10 | ⫽ { compiler-options = 11 | prelude.defaults.CompilerOptions ⫽ { GHC = [ "-O2" ] } 12 | , main-is = 13 | "Main.hs" 14 | } 15 | , name = 16 | "fancy-benchmark" 17 | } 18 | ] 19 | , cabal-version = 20 | prelude.v "2.0" 21 | , name = 22 | "blah" 23 | , version = 24 | prelude.v "1" 25 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/conditional-dependencies.cabal: -------------------------------------------------------------------------------- 1 | name: Name 2 | version: 1 3 | cabal-version: 2.0 4 | license: UnspecifiedLicense 5 | 6 | library 7 | 8 | if impl(ghc >=8.2) 9 | build-depends: 10 | B -any 11 | 12 | if impl(ghc >=8.4) 13 | build-depends: 14 | C -any 15 | build-depends: 16 | A -any 17 | 18 | 19 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/conditional-dependencies.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → if config.impl 12 | types.Compiler.GHC 13 | ( prelude.unionVersionRanges 14 | (prelude.thisVersion (prelude.v "8.2")) 15 | (prelude.laterVersion (prelude.v "8.2")) 16 | ) 17 | 18 | then if config.impl 19 | types.Compiler.GHC 20 | ( prelude.unionVersionRanges 21 | (prelude.thisVersion (prelude.v "8.4")) 22 | (prelude.laterVersion (prelude.v "8.4")) 23 | ) 24 | 25 | then prelude.defaults.MainLibrary 26 | ⫽ { build-depends = 27 | [ { bounds = 28 | prelude.anyVersion 29 | , library-names = 30 | [ types.LibraryName.main-library ] 31 | , package = 32 | "A" 33 | } 34 | , { bounds = 35 | prelude.anyVersion 36 | , library-names = 37 | [ types.LibraryName.main-library ] 38 | , package = 39 | "B" 40 | } 41 | , { bounds = 42 | prelude.anyVersion 43 | , library-names = 44 | [ types.LibraryName.main-library ] 45 | , package = 46 | "C" 47 | } 48 | ] 49 | } 50 | 51 | else prelude.defaults.MainLibrary 52 | ⫽ { build-depends = 53 | [ { bounds = 54 | prelude.anyVersion 55 | , library-names = 56 | [ types.LibraryName.main-library ] 57 | , package = 58 | "A" 59 | } 60 | , { bounds = 61 | prelude.anyVersion 62 | , library-names = 63 | [ types.LibraryName.main-library ] 64 | , package = 65 | "B" 66 | } 67 | ] 68 | } 69 | 70 | else if config.impl 71 | types.Compiler.GHC 72 | ( prelude.unionVersionRanges 73 | (prelude.thisVersion (prelude.v "8.4")) 74 | (prelude.laterVersion (prelude.v "8.4")) 75 | ) 76 | 77 | then prelude.defaults.MainLibrary 78 | ⫽ { build-depends = 79 | [ { bounds = 80 | prelude.anyVersion 81 | , library-names = 82 | [ types.LibraryName.main-library ] 83 | , package = 84 | "A" 85 | } 86 | , { bounds = 87 | prelude.anyVersion 88 | , library-names = 89 | [ types.LibraryName.main-library ] 90 | , package = 91 | "C" 92 | } 93 | ] 94 | } 95 | 96 | else prelude.defaults.MainLibrary 97 | ⫽ { build-depends = 98 | [ { bounds = 99 | prelude.anyVersion 100 | , library-names = 101 | [ types.LibraryName.main-library ] 102 | , package = 103 | "A" 104 | } 105 | ] 106 | } 107 | ) 108 | , license = 109 | types.License.Unspecified 110 | , name = 111 | "Name" 112 | , version = 113 | prelude.v "1" 114 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/default-license-2.2.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: test 3 | version: 1.0 4 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/default-license-2.2.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package ⫽ { name = "test", version = prelude.v "1.0" } 6 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/executable.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.0 2 | name: blah 3 | version: 1 4 | 5 | executable hello 6 | main-is: Main.hs 7 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/executable.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.0" 8 | , executables = 9 | [ { executable = 10 | λ(config : types.Config) 11 | → prelude.defaults.Executable ⫽ { main-is = "Main.hs" } 12 | , name = 13 | "hello" 14 | } 15 | ] 16 | , name = 17 | "blah" 18 | , version = 19 | prelude.v "1" 20 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/extra-dyn-lib-flavours.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: foo 3 | version: 0 4 | 5 | library 6 | default-language: Haskell2010 7 | extra-dynamic-library-flavours: foo bar 8 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/extra-dyn-lib-flavours.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "3.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → prelude.defaults.MainLibrary 12 | ⫽ { default-language = 13 | Some types.Language.Haskell2010 14 | , extra-dyn-lib-flavours = 15 | [ "foo", "bar" ] 16 | } 17 | ) 18 | , name = 19 | "foo" 20 | , version = 21 | prelude.v "0" 22 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/gh-36.cabal: -------------------------------------------------------------------------------- 1 | name: wai-servlet 2 | version: 0.1.5.0 3 | cabal-version: 2.0 4 | 5 | Flag wai-servlet-debug 6 | Description: print debug output. not suitable for production 7 | Default: False 8 | 9 | library 10 | if impl(ghc >= 0.0.9.7) 11 | cpp-options: -DINTEROP 12 | if impl(ghc < 0.7.0.2) 13 | cpp-options: -DPURE_JAVA_WITH 14 | if impl(ghc >= 0.0.9) 15 | c-sources: java/Utils.java 16 | if flag(wai-servlet-debug) 17 | cpp-options: -DWAI_SERVLET_DEBUG 18 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/gh-36.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.0" 8 | , flags = 9 | [ { default = 10 | False 11 | , description = 12 | "print debug output. not suitable for production" 13 | , manual = 14 | False 15 | , name = 16 | "wai-servlet-debug" 17 | } 18 | ] 19 | , library = 20 | Some 21 | ( λ(config : types.Config) 22 | → if config.impl 23 | types.Compiler.GHC 24 | ( prelude.unionVersionRanges 25 | (prelude.thisVersion (prelude.v "0.0.9.7")) 26 | (prelude.laterVersion (prelude.v "0.0.9.7")) 27 | ) 28 | 29 | then if config.impl 30 | types.Compiler.GHC 31 | (prelude.earlierVersion (prelude.v "0.7.0.2")) 32 | 33 | then if config.impl 34 | types.Compiler.GHC 35 | ( prelude.unionVersionRanges 36 | ( prelude.thisVersion 37 | (prelude.v "0.0.9") 38 | ) 39 | ( prelude.laterVersion 40 | (prelude.v "0.0.9") 41 | ) 42 | ) 43 | 44 | then if config.flag "wai-servlet-debug" 45 | 46 | then prelude.defaults.MainLibrary 47 | ⫽ { c-sources = 48 | [ "java/Utils.java" ] 49 | , cpp-options = 50 | [ "-DINTEROP" 51 | , "-DPURE_JAVA_WITH" 52 | , "-DWAI_SERVLET_DEBUG" 53 | ] 54 | } 55 | 56 | else prelude.defaults.MainLibrary 57 | ⫽ { c-sources = 58 | [ "java/Utils.java" ] 59 | , cpp-options = 60 | [ "-DINTEROP", "-DPURE_JAVA_WITH" ] 61 | } 62 | 63 | else if config.flag "wai-servlet-debug" 64 | 65 | then prelude.defaults.MainLibrary 66 | ⫽ { cpp-options = 67 | [ "-DINTEROP" 68 | , "-DPURE_JAVA_WITH" 69 | , "-DWAI_SERVLET_DEBUG" 70 | ] 71 | } 72 | 73 | else prelude.defaults.MainLibrary 74 | ⫽ { cpp-options = 75 | [ "-DINTEROP", "-DPURE_JAVA_WITH" ] 76 | } 77 | 78 | else if config.impl 79 | types.Compiler.GHC 80 | ( prelude.unionVersionRanges 81 | (prelude.thisVersion (prelude.v "0.0.9")) 82 | (prelude.laterVersion (prelude.v "0.0.9")) 83 | ) 84 | 85 | then if config.flag "wai-servlet-debug" 86 | 87 | then prelude.defaults.MainLibrary 88 | ⫽ { c-sources = 89 | [ "java/Utils.java" ] 90 | , cpp-options = 91 | [ "-DINTEROP", "-DWAI_SERVLET_DEBUG" ] 92 | } 93 | 94 | else prelude.defaults.MainLibrary 95 | ⫽ { c-sources = 96 | [ "java/Utils.java" ] 97 | , cpp-options = 98 | [ "-DINTEROP" ] 99 | } 100 | 101 | else if config.flag "wai-servlet-debug" 102 | 103 | then prelude.defaults.MainLibrary 104 | ⫽ { cpp-options = 105 | [ "-DINTEROP", "-DWAI_SERVLET_DEBUG" ] 106 | } 107 | 108 | else prelude.defaults.MainLibrary 109 | ⫽ { cpp-options = [ "-DINTEROP" ] } 110 | 111 | else if config.impl 112 | types.Compiler.GHC 113 | (prelude.earlierVersion (prelude.v "0.7.0.2")) 114 | 115 | then if config.impl 116 | types.Compiler.GHC 117 | ( prelude.unionVersionRanges 118 | (prelude.thisVersion (prelude.v "0.0.9")) 119 | (prelude.laterVersion (prelude.v "0.0.9")) 120 | ) 121 | 122 | then if config.flag "wai-servlet-debug" 123 | 124 | then prelude.defaults.MainLibrary 125 | ⫽ { c-sources = 126 | [ "java/Utils.java" ] 127 | , cpp-options = 128 | [ "-DPURE_JAVA_WITH" 129 | , "-DWAI_SERVLET_DEBUG" 130 | ] 131 | } 132 | 133 | else prelude.defaults.MainLibrary 134 | ⫽ { c-sources = 135 | [ "java/Utils.java" ] 136 | , cpp-options = 137 | [ "-DPURE_JAVA_WITH" ] 138 | } 139 | 140 | else if config.flag "wai-servlet-debug" 141 | 142 | then prelude.defaults.MainLibrary 143 | ⫽ { cpp-options = 144 | [ "-DPURE_JAVA_WITH", "-DWAI_SERVLET_DEBUG" ] 145 | } 146 | 147 | else prelude.defaults.MainLibrary 148 | ⫽ { cpp-options = [ "-DPURE_JAVA_WITH" ] } 149 | 150 | else if config.impl 151 | types.Compiler.GHC 152 | ( prelude.unionVersionRanges 153 | (prelude.thisVersion (prelude.v "0.0.9")) 154 | (prelude.laterVersion (prelude.v "0.0.9")) 155 | ) 156 | 157 | then if config.flag "wai-servlet-debug" 158 | 159 | then prelude.defaults.MainLibrary 160 | ⫽ { c-sources = 161 | [ "java/Utils.java" ] 162 | , cpp-options = 163 | [ "-DWAI_SERVLET_DEBUG" ] 164 | } 165 | 166 | else prelude.defaults.MainLibrary 167 | ⫽ { c-sources = [ "java/Utils.java" ] } 168 | 169 | else if config.flag "wai-servlet-debug" 170 | 171 | then prelude.defaults.MainLibrary 172 | ⫽ { cpp-options = [ "-DWAI_SERVLET_DEBUG" ] } 173 | 174 | else prelude.defaults.MainLibrary 175 | ) 176 | , name = 177 | "wai-servlet" 178 | , version = 179 | prelude.v "0.1.5.0" 180 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/lib-vis-2.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: multilib 3 | version: 0 4 | 5 | library 6 | visibility: public 7 | default-language: Haskell2010 8 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/lib-vis-2.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "3.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → prelude.defaults.MainLibrary 12 | ⫽ { default-language = Some types.Language.Haskell2010 } 13 | ) 14 | , name = 15 | "multilib" 16 | , version = 17 | prelude.v "0" 18 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/lib-vis.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: multilib 3 | version: 0 4 | 5 | library x 6 | visibility: public 7 | default-language: Haskell2010 8 | 9 | library y 10 | visibility: private 11 | default-language: Haskell2010 12 | 13 | library 14 | visibility: private 15 | default-language: Haskell2010 16 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/lib-vis.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "3.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → prelude.defaults.MainLibrary 12 | ⫽ { default-language = Some types.Language.Haskell2010 } 13 | ) 14 | , name = 15 | "multilib" 16 | , sub-libraries = 17 | [ { library = 18 | λ(config : types.Config) 19 | → prelude.defaults.NamedLibrary 20 | ⫽ { default-language = 21 | Some types.Language.Haskell2010 22 | , visibility = 23 | types.LibraryVisibility.public 24 | } 25 | , name = 26 | "x" 27 | } 28 | , { library = 29 | λ(config : types.Config) 30 | → prelude.defaults.NamedLibrary 31 | ⫽ { default-language = Some types.Language.Haskell2010 } 32 | , name = 33 | "y" 34 | } 35 | ] 36 | , version = 37 | prelude.v "0" 38 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/mixins-no-signatures.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: mixins-test 3 | version: 0 4 | 5 | library 6 | mixins: 7 | foo, 8 | bar (Some.Module, Some.Other.Module, Third.Module as Renamed), 9 | baz hiding (Hidden, Also.Hidden) 10 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/mixins-no-signatures.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { library = 7 | Some 8 | ( λ(config : types.Config) 9 | → prelude.defaults.MainLibrary 10 | ⫽ { mixins = 11 | [ { package = 12 | "foo" 13 | , renaming = 14 | { provides = 15 | types.ModuleRenaming.default 16 | , requires = 17 | types.ModuleRenaming.default 18 | } 19 | } 20 | , { package = 21 | "bar" 22 | , renaming = 23 | { provides = 24 | types.ModuleRenaming.renaming 25 | [ { rename = "Some.Module", to = "Some.Module" } 26 | , { rename = 27 | "Some.Other.Module" 28 | , to = 29 | "Some.Other.Module" 30 | } 31 | , { rename = "Third.Module", to = "Renamed" } 32 | ] 33 | , requires = 34 | types.ModuleRenaming.default 35 | } 36 | } 37 | , { package = 38 | "baz" 39 | , renaming = 40 | { provides = 41 | types.ModuleRenaming.hiding 42 | [ "Hidden", "Also.Hidden" ] 43 | , requires = 44 | types.ModuleRenaming.default 45 | } 46 | } 47 | ] 48 | } 49 | ) 50 | , name = 51 | "mixins-test" 52 | , version = 53 | prelude.v "0" 54 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/multilib.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: multilib 3 | version: 0 4 | 5 | library 6 | default-language: Haskell2010 7 | build-depends: 8 | A, 9 | B:{b1, b2, b3} >= 3, 10 | B:{b2} < 3.5, 11 | C:{C, c1}, 12 | D:{} 13 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/multilib.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "3.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → prelude.defaults.MainLibrary 12 | ⫽ { build-depends = 13 | [ { bounds = 14 | prelude.anyVersion 15 | , library-names = 16 | [ types.LibraryName.main-library ] 17 | , package = 18 | "A" 19 | } 20 | , { bounds = 21 | prelude.unionVersionRanges 22 | (prelude.thisVersion (prelude.v "3")) 23 | (prelude.laterVersion (prelude.v "3")) 24 | , library-names = 25 | [ types.LibraryName.sub-library "b1" 26 | , types.LibraryName.sub-library "b2" 27 | , types.LibraryName.sub-library "b3" 28 | ] 29 | , package = 30 | "B" 31 | } 32 | , { bounds = 33 | prelude.earlierVersion (prelude.v "3.5") 34 | , library-names = 35 | [ types.LibraryName.sub-library "b2" ] 36 | , package = 37 | "B" 38 | } 39 | , { bounds = 40 | prelude.anyVersion 41 | , library-names = 42 | [ types.LibraryName.main-library 43 | , types.LibraryName.sub-library "c1" 44 | ] 45 | , package = 46 | "C" 47 | } 48 | , { bounds = 49 | prelude.anyVersion 50 | , library-names = 51 | [] : List types.LibraryName 52 | , package = 53 | "D" 54 | } 55 | ] 56 | , default-language = 57 | Some types.Language.Haskell2010 58 | } 59 | ) 60 | , name = 61 | "multilib" 62 | , version = 63 | prelude.v "0" 64 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/otheros.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.0 2 | name: test 3 | version: 0 4 | 5 | library 6 | exposed-modules: 7 | A 8 | if os(multics) 9 | exposed-modules: 10 | B 11 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/otheros.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.0" 8 | , library = 9 | Some 10 | ( λ(config : types.Config) 11 | → if config.os (types.OS.OtherOS { _1 = "multics" }) 12 | 13 | then prelude.defaults.MainLibrary 14 | ⫽ { exposed-modules = [ "A", "B" ] } 15 | 16 | else prelude.defaults.MainLibrary ⫽ { exposed-modules = [ "A" ] } 17 | ) 18 | , name = 19 | "test" 20 | , version = 21 | prelude.v "0" 22 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/repotypeunknown.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.4 2 | name: foo 3 | version: 2 4 | 5 | source-repository blargh 6 | type: git 7 | location: https://example.com 8 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/repotypeunknown.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.4" 8 | , name = 9 | "foo" 10 | , source-repos = 11 | [ prelude.defaults.SourceRepo 12 | ⫽ { kind = 13 | types.RepoKind.RepoKindUnknown { _1 = "blargh" } 14 | , location = 15 | Some "https://example.com" 16 | , type = 17 | Some types.RepoType.Git 18 | } 19 | ] 20 | , version = 21 | prelude.v "2" 22 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/simple.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.0 2 | name: test 3 | version: 1.0 4 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/simple.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.0" 8 | , name = 9 | "test" 10 | , version = 11 | prelude.v "1.0" 12 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/sourcerepo-defaults.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: test 3 | version: 0 4 | 5 | source-repository head 6 | type: git 7 | location: example.com 8 | 9 | source-repository this 10 | type: darcs 11 | location: example.org 12 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "test" 8 | , source-repos = 9 | [ prelude.defaults.SourceRepo 10 | ⫽ { location = Some "example.com", type = Some types.RepoType.Git } 11 | , prelude.defaults.SourceRepo 12 | ⫽ { kind = 13 | types.RepoKind.RepoThis 14 | , location = 15 | Some "example.org" 16 | , type = 17 | Some types.RepoType.Darcs 18 | } 19 | ] 20 | , version = 21 | prelude.v "0" 22 | } -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/unknown-license.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | name: test 3 | version: 1.0 4 | license: MYUnknownLicense 5 | -------------------------------------------------------------------------------- /golden-tests/cabal-to-dhall/unknown-license.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "1.12" 8 | , license = 9 | types.License.Unknown "MYUnknownLicense" 10 | , name = 11 | "test" 12 | , version = 13 | prelude.v "1.0" 14 | } -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/SPDX.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: foo 3 | version: 0 4 | license: (AGPL-3.0-or-later OR Apache-2.0+ WITH Classpath-exception-2.0) AND (LicenseRef-MyFancyLicense OR DocumentRef-LICENSE.txt:LicenseRef-MyFancierLicense) 5 | 6 | library 7 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/SPDX.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "foo" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "2.2" 12 | , license = 13 | types.License.SPDX 14 | ( prelude.SPDX.and 15 | ( prelude.SPDX.or 16 | ( prelude.SPDX.license 17 | types.LicenseId.AGPL_3_0_or_later 18 | prelude.SPDX.noException 19 | ) 20 | ( prelude.SPDX.licenseVersionOrLater 21 | types.LicenseId.Apache_2_0 22 | (Some types.LicenseExceptionId.Classpath_exception_2_0) 23 | ) 24 | ) 25 | ( prelude.SPDX.or 26 | ( prelude.SPDX.ref 27 | "MyFancyLicense" 28 | (None types.LicenseExceptionId) 29 | ) 30 | ( prelude.SPDX.refWithFile 31 | "MyFancierLicense" 32 | "LICENSE.txt" 33 | (None types.LicenseExceptionId) 34 | ) 35 | ) 36 | ) 37 | , library = 38 | prelude.unconditional.library prelude.defaults.MainLibrary 39 | } 40 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/allrightsreserved-2.0.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.0 2 | name: foo 3 | version: 0 4 | license: AllRightsReserved 5 | 6 | library 7 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/allrightsreserved-2.0.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "foo" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "2.0" 12 | , license = 13 | types.License.AllRightsReserved 14 | , library = 15 | prelude.unconditional.library prelude.defaults.MainLibrary 16 | } 17 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/allrightsreserved-2.2.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: foo 3 | version: 0 4 | license: NONE 5 | 6 | library 7 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/allrightsreserved-2.2.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "foo" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "2.2" 12 | , license = 13 | types.License.AllRightsReserved 14 | , library = 15 | prelude.unconditional.library prelude.defaults.MainLibrary 16 | } 17 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/compiler-options-order.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: Name 3 | version: 1 4 | 5 | library 6 | exposed-modules: 7 | Foo 8 | Bar 9 | 10 | ghc-options: A F 11 | 12 | if impl(ghc >=8.2) 13 | ghc-options: B D 14 | 15 | else 16 | 17 | if impl(ghc >=8.4) 18 | ghc-options: C E 19 | 20 | else 21 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/compiler-options-order.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | let v = prelude.v 6 | 7 | let ghcImpl = 8 | λ(cfg : types.Config) 9 | → λ(ver : types.VersionRange) 10 | → cfg.impl types.Compiler.GHC ver 11 | 12 | in ../../dhall/defaults/Package.dhall 13 | ⫽ { name = 14 | "Name" 15 | , version = 16 | ../../dhall/Version/v.dhall "1" 17 | , library = 18 | Some 19 | ( λ(config : types.Config) 20 | → prelude.defaults.MainLibrary 21 | ⫽ { exposed-modules = 22 | [ "Foo", "Bar" ] 23 | , compiler-options = 24 | prelude.defaults.CompilerOptions 25 | ⫽ { GHC = 26 | [ "A" ] 27 | # ( if ghcImpl 28 | config 29 | (prelude.orLaterVersion (v "8.2")) 30 | 31 | then [ "B" ] 32 | 33 | else [] : List Text 34 | ) 35 | # ( if ghcImpl 36 | config 37 | (prelude.orLaterVersion (v "8.4")) 38 | 39 | then [ "C" ] 40 | 41 | else [] : List Text 42 | ) 43 | # ( if ghcImpl 44 | config 45 | (prelude.orLaterVersion (v "8.2")) 46 | 47 | then [ "D" ] 48 | 49 | else [] : List Text 50 | ) 51 | # ( if ghcImpl 52 | config 53 | (prelude.orLaterVersion (v "8.4")) 54 | 55 | then [ "E" ] 56 | 57 | else [] : List Text 58 | ) 59 | # [ "F" ] 60 | } 61 | } 62 | ) 63 | } 64 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/conditional-dependencies.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: Name 3 | version: 1 4 | license: NONE 5 | 6 | library 7 | build-depends: 8 | A -any 9 | 10 | if impl(ghc >=8.2) 11 | build-depends: 12 | B -any 13 | else 14 | 15 | if impl(ghc >=8.4) 16 | build-depends: 17 | C -any 18 | else 19 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/conditional-dependencies.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | let v = prelude.v 6 | 7 | let ghcImpl = 8 | λ(cfg : types.Config) 9 | → λ(ver : types.VersionRange) 10 | → cfg.impl types.Compiler.GHC ver 11 | 12 | in ../../dhall/defaults/Package.dhall 13 | ⫽ { name = 14 | "Name" 15 | , version = 16 | v "1" 17 | , library = 18 | Some 19 | ( λ(config : types.Config) 20 | → prelude.defaults.MainLibrary 21 | ⫽ { build-depends = 22 | [ { package = "A", bounds = prelude.anyVersion, library-names = [ types.LibraryName.main-library ] } ] 23 | # ( if ghcImpl 24 | config 25 | (prelude.orLaterVersion (v "8.2")) 26 | 27 | then [ { package = "B", bounds = prelude.anyVersion, library-names = [ types.LibraryName.main-library ] } ] 28 | 29 | else [] : List types.Dependency 30 | ) 31 | # ( if ghcImpl 32 | config 33 | (prelude.orLaterVersion (v "8.4")) 34 | 35 | then [ { package = "C", bounds = prelude.anyVersion, library-names = [ types.LibraryName.main-library ] } ] 36 | 37 | else [] : List types.Dependency 38 | ) 39 | } 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/default-license-2.2.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: foo 3 | version: 0 4 | license: NONE 5 | 6 | library 7 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/default-license-2.2.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "foo" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "2.2" 12 | , library = 13 | prelude.unconditional.library prelude.defaults.MainLibrary 14 | } 15 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/dhall-to-cabal.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: dhall-to-cabal 3 | version: 1.0.0 4 | license: MIT 5 | license-file: LICENSE 6 | maintainer: ollie@ocharles.org.uk 7 | homepage: https://github.com/ocharles/dhall-to-cabal 8 | bug-reports: https://github.com/ocharles/dhall-to-cabal/issues 9 | synopsis: Compile Dhall expressions to Cabal files 10 | description: 11 | dhall-to-cabal takes Dhall expressions and compiles them into Cabal 12 | files. All of the features of Dhall are supported, such as let 13 | bindings and imports, and all features of Cabal are supported 14 | (including conditional stanzas). 15 | . 16 | category: Distribution 17 | extra-source-files: 18 | Changelog.md 19 | dhall/defaults/BuildInfo.dhall 20 | dhall/defaults/Library.dhall 21 | dhall/defaults/CompilerOptions.dhall 22 | dhall/defaults/SourceRepo.dhall 23 | dhall/defaults/TestSuite.dhall 24 | dhall/defaults/Executable.dhall 25 | dhall/defaults/Package.dhall 26 | dhall/defaults/Benchmark.dhall 27 | dhall/unconditional.dhall 28 | dhall/GitHub-project.dhall 29 | dhall/prelude.dhall 30 | dhall/types/VersionRange.dhall 31 | dhall/types/OS.dhall 32 | dhall/types/Guarded.dhall 33 | dhall/types/License.dhall 34 | dhall/types/Library.dhall 35 | dhall/types/Version.dhall 36 | dhall/types/Language.dhall 37 | dhall/types/Extension.dhall 38 | dhall/types/CompilerOptions.dhall 39 | dhall/types/SourceRepo.dhall 40 | dhall/types/TestSuite.dhall 41 | dhall/types/Executable.dhall 42 | dhall/types/Dependency.dhall 43 | dhall/types/Mixin.dhall 44 | dhall/types/Compiler.dhall 45 | dhall/types/Config.dhall 46 | dhall/types/Package.dhall 47 | dhall/types/builtin.dhall 48 | dhall/types/BuildType.dhall 49 | dhall/types/RepoKind.dhall 50 | dhall/types/Version/v.dhall 51 | dhall/types/Arch.dhall 52 | dhall/types/Scope.dhall 53 | dhall/types/CustomSetup.dhall 54 | dhall/types/Benchmark.dhall 55 | dhall/types/Flag.dhall 56 | dhall/types/ForeignLibrary.dhall 57 | dhall/types/ModuleRenaming.dhall 58 | dhall/types/RepoType.dhall 59 | dhall/types/TestType.dhall 60 | dhall/types/VersionRange/IntersectVersionRanges.dhall 61 | dhall/types/VersionRange/WithinVersion.dhall 62 | dhall/types/VersionRange/InvertVersionRange.dhall 63 | dhall/types/VersionRange/EarlierVersion.dhall 64 | dhall/types/VersionRange/DifferenceVersionRanges.dhall 65 | dhall/types/VersionRange/ThisVersion.dhall 66 | dhall/types/VersionRange/OrLaterVersion.dhall 67 | dhall/types/VersionRange/OrEarlierVersion.dhall 68 | dhall/types/VersionRange/AnyVersion.dhall 69 | dhall/types/VersionRange/NotThisVersion.dhall 70 | dhall/types/VersionRange/LaterVersion.dhall 71 | dhall/types/VersionRange/NoVersion.dhall 72 | dhall/types/VersionRange/MajorBoundVersion.dhall 73 | dhall/types/VersionRange/UnionVersionRanges.dhall 74 | dhall/types/SetupBuildInfo.dhall 75 | 76 | source-repository head 77 | type: git 78 | location: https://github.com/ocharles/dhall-to-cabal 79 | 80 | library 81 | exposed-modules: 82 | DhallToCabal 83 | hs-source-dirs: lib 84 | other-modules: 85 | DhallToCabal.ConfigTree 86 | DhallToCabal.Diff 87 | Dhall.Extra 88 | default-language: Haskell2010 89 | other-extensions: ApplicativeDo GADTs GeneralizedNewtypeDeriving 90 | LambdaCase OverloadedStrings RecordWildCards TypeApplications 91 | ghc-options: -Wall -fno-warn-name-shadowing 92 | build-depends: 93 | Cabal ^>=2.0, 94 | base ^>=4.10, 95 | bytestring ^>=0.10, 96 | containers ^>=0.5, 97 | dhall ^>=1.12.0, 98 | formatting ^>=6.3.1, 99 | hashable ^>=1.2.6.1, 100 | insert-ordered-containers ^>=0.2.1.0, 101 | text ^>=1.2, 102 | transformers ^>=0.5.2, 103 | trifecta ^>=1.7, 104 | vector ^>=0.12 105 | 106 | executable dhall-to-cabal 107 | main-is: Main.hs 108 | hs-source-dirs: exe 109 | default-language: Haskell2010 110 | other-extensions: NamedFieldPuns 111 | build-depends: 112 | Cabal ^>=2.0, 113 | base ^>=4.10, 114 | dhall ^>=1.12.0, 115 | dhall-to-cabal -any, 116 | optparse-applicative ^>=0.13.2 || ^>=0.14, 117 | prettyprinter ^>=1.2.0.1, 118 | text ^>=1.2 119 | 120 | executable cabal-to-dhall 121 | main-is: Main.hs 122 | hs-source-dirs: cabal-to-dhall 123 | default-language: Haskell2010 124 | other-extensions: NamedFieldPuns 125 | build-depends: 126 | Cabal ^>=2.0, 127 | base ^>=4.10, 128 | contravariant ^>=1.4, 129 | dhall ^>=1.12.0, 130 | hashable ^>=1.2.6.1, 131 | dhall-to-cabal -any, 132 | insert-ordered-containers ^>=0.2.1.0, 133 | optparse-applicative ^>=0.13.2 || ^>=0.14, 134 | prettyprinter ^>=1.2.0.1, 135 | text ^>=1.2 136 | 137 | test-suite golden-tests 138 | type: exitcode-stdio-1.0 139 | main-is: GoldenTests.hs 140 | hs-source-dirs: golden-tests 141 | default-language: Haskell2010 142 | build-depends: 143 | base ^>=4.10, 144 | Cabal ^>=2.0, 145 | Diff ^>=0.3.4, 146 | bytestring ^>=0.10, 147 | dhall-to-cabal -any, 148 | filepath ^>=1.4, 149 | tasty ^>=0.11, 150 | tasty-golden ^>=2.3, 151 | text ^>=1.2 152 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/empty-package.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: Name 3 | version: 1 4 | license: NONE 5 | 6 | executable foo 7 | main-is: Main.hs 8 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/empty-package.dhall: -------------------------------------------------------------------------------- 1 | ../../dhall/defaults/Package.dhall 2 | ⫽ { name = 3 | "Name" 4 | , version = 5 | ../../dhall/Version/v.dhall "1" 6 | , executables = 7 | [ { name = 8 | "foo" 9 | , executable = 10 | λ(config : ../../dhall/types/Config.dhall) 11 | → ../../dhall/defaults/Executable.dhall ⫽ { main-is = "Main.hs" } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/gh-53.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.0 2 | name: wai-servlet 3 | version: 0.1.5.0 4 | license: AllRightsReserved 5 | 6 | flag wai-servlet-debug 7 | description: 8 | print debug output. not suitable for production 9 | default: False 10 | 11 | library 12 | 13 | if impl(ghc >=0.0.9) 14 | c-sources: 15 | java/Utils.java 16 | else 17 | 18 | if flag(wai-servlet-debug) 19 | cpp-options: -DWAI_SERVLET_DEBUG 20 | else 21 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/gh-53.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { cabal-version = 7 | prelude.v "2.0" 8 | , name = 9 | "wai-servlet" 10 | , version = 11 | prelude.v "0.1.5.0" 12 | , flags = 13 | [ { default = 14 | False 15 | , description = 16 | "print debug output. not suitable for production" 17 | , manual = 18 | False 19 | , name = 20 | "wai-servlet-debug" 21 | } 22 | ] 23 | , library = 24 | Some 25 | ( λ(config : types.Config) 26 | → if config.impl 27 | types.Compiler.GHC 28 | (prelude.orLaterVersion (prelude.v "0.0.9")) 29 | 30 | then if config.flag "wai-servlet-debug" 31 | 32 | then prelude.defaults.MainLibrary 33 | ⫽ { c-sources = 34 | [ "java/Utils.java" ] 35 | , cpp-options = 36 | [ "-DWAI_SERVLET_DEBUG" ] 37 | } 38 | 39 | else prelude.defaults.MainLibrary 40 | ⫽ { c-sources = [ "java/Utils.java" ] } 41 | 42 | else if config.flag "wai-servlet-debug" 43 | 44 | then prelude.defaults.MainLibrary 45 | ⫽ { cpp-options = [ "-DWAI_SERVLET_DEBUG" ] } 46 | 47 | else prelude.defaults.MainLibrary 48 | ) 49 | } 50 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/gh-55.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: Name 3 | version: 1 4 | license: NONE 5 | 6 | library 7 | exposed-modules: 8 | Module1 9 | 10 | if impl(ghc >=7.1.3) 11 | exposed-modules: 12 | Module2 13 | cpp-options: -DCOND1 14 | other-modules: 15 | OtherModule 16 | else 17 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/gh-55.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | let v = prelude.v 6 | 7 | let ghcImpl = 8 | λ(cfg : types.Config) 9 | → λ(ver : types.VersionRange) 10 | → cfg.impl types.Compiler.GHC ver 11 | 12 | in ./../../dhall/defaults/Package.dhall 13 | ⫽ { name = 14 | "Name" 15 | , version = 16 | v "1" 17 | , library = 18 | Some 19 | ( λ(config : types.Config) 20 | → prelude.defaults.MainLibrary 21 | ⫽ { exposed-modules = 22 | [ "Module1" ] 23 | # ( if ghcImpl 24 | config 25 | (prelude.orLaterVersion (v "7.1.3")) 26 | 27 | then [ "Module2" ] 28 | 29 | else [] : List Text 30 | ) 31 | , other-modules = 32 | if ghcImpl config (prelude.orLaterVersion (v "7.1.3")) 33 | 34 | then [ "OtherModule" ] 35 | 36 | else [] : List Text 37 | , cpp-options = 38 | if ghcImpl config (prelude.orLaterVersion (v "7.1.3")) 39 | 40 | then [ "-DCOND1" ] 41 | 42 | else [] : List Text 43 | } 44 | ) 45 | } 46 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/lib-vis-2.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: multilib 3 | version: 0 4 | 5 | library 6 | default-language: Haskell2010 7 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/lib-vis-2.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "multilib" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "3.0" 12 | , library = 13 | Some 14 | ( λ(config : types.Config) 15 | → prelude.defaults.MainLibrary 16 | ⫽ { default-language = 17 | Some types.Language.Haskell2010 18 | } 19 | ) 20 | } -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/lib-vis.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: multilib 3 | version: 0 4 | 5 | library 6 | default-language: Haskell2010 7 | 8 | library x 9 | visibility: public 10 | default-language: Haskell2010 11 | 12 | library y 13 | default-language: Haskell2010 14 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/lib-vis.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "multilib" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "3.0" 12 | , library = 13 | Some 14 | ( λ(config : types.Config) 15 | → prelude.defaults.MainLibrary 16 | ⫽ { default-language = 17 | Some types.Language.Haskell2010 18 | } 19 | ) 20 | , sub-libraries = 21 | [ { library = 22 | λ(config : types.Config) 23 | → prelude.defaults.NamedLibrary 24 | ⫽ { visibility = 25 | types.LibraryVisibility.public 26 | , default-language = 27 | Some types.Language.Haskell2010 28 | } 29 | , name = 30 | "x" 31 | } 32 | , { library = 33 | λ(config : types.Config) 34 | → prelude.defaults.NamedLibrary 35 | ⫽ { default-language = 36 | Some types.Language.Haskell2010 37 | } 38 | , name = 39 | "y" 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/map-build-info.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: pkg 3 | version: 0 4 | 5 | custom-setup 6 | setup-depends: setup ^>=1.0 7 | 8 | library 9 | build-depends: 10 | library ^>=1.0, 11 | injected ^>=1.0 12 | 13 | library sublib 14 | build-depends: 15 | sublib ^>=1.0, 16 | injected ^>=1.0 17 | 18 | foreign-library flib 19 | type: native-static 20 | build-depends: 21 | flib ^>=1.0, 22 | injected ^>=1.0 23 | 24 | executable exe 25 | main-is: Exe.hs 26 | build-depends: 27 | exe ^>=1.0, 28 | injected ^>=1.0 29 | 30 | test-suite tests 31 | type: exitcode-stdio-1.0 32 | main-is: Test.hs 33 | build-depends: 34 | tests ^>=1.0, 35 | injected ^>=1.0 36 | 37 | benchmark bench 38 | type: exitcode-stdio-1.0 39 | main-is: Bench.hs 40 | build-depends: 41 | bench ^>=1.0, 42 | injected ^>=1.0 43 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/map-build-info.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | let f = 6 | λ(buildInfo : types.BuildInfo) 7 | → buildInfo 8 | ⫽ { build-depends = 9 | buildInfo.build-depends 10 | # [ prelude.utils.majorVersions "injected" [ prelude.v "1.0" ] [ types.LibraryName.main-library ] ] 11 | } 12 | 13 | in prelude.utils.mapBuildInfo 14 | f 15 | ( prelude.defaults.Package 16 | ⫽ { name = 17 | "pkg" 18 | , version = 19 | prelude.v "0" 20 | , library = 21 | Some 22 | ( λ(config : types.Config) 23 | → prelude.defaults.MainLibrary 24 | ⫽ { build-depends = 25 | [ prelude.utils.majorVersions 26 | "library" 27 | [ prelude.v "1.0" ] 28 | [ types.LibraryName.main-library ] 29 | ] 30 | } 31 | ) 32 | , custom-setup = 33 | Some 34 | { setup-depends = 35 | [ prelude.utils.majorVersions "setup" [ prelude.v "1.0" ] [ types.LibraryName.main-library ] ] 36 | } 37 | , benchmarks = 38 | [ { name = 39 | "bench" 40 | , benchmark = 41 | λ(config : types.Config) 42 | → prelude.defaults.Benchmark 43 | ⫽ { main-is = 44 | "Bench.hs" 45 | , build-depends = 46 | [ prelude.utils.majorVersions 47 | "bench" 48 | [ prelude.v "1.0" ] 49 | [ types.LibraryName.main-library ] 50 | ] 51 | } 52 | } 53 | ] 54 | , executables = 55 | [ { name = 56 | "exe" 57 | , executable = 58 | λ(config : types.Config) 59 | → prelude.defaults.Executable 60 | ⫽ { main-is = 61 | "Exe.hs" 62 | , build-depends = 63 | [ prelude.utils.majorVersions 64 | "exe" 65 | [ prelude.v "1.0" ] 66 | [ types.LibraryName.main-library ] 67 | ] 68 | } 69 | } 70 | ] 71 | , foreign-libraries = 72 | [ { name = 73 | "flib" 74 | , foreign-lib = 75 | λ(config : types.Config) 76 | → ../../dhall/defaults/BuildInfo.dhall 77 | ⫽ { type = types.ForeignLibType.Static 78 | , options = [] : List types.ForeignLibOption 79 | , mod-def-files = [] : List Text 80 | , lib-version-info = None { current : Natural, revision : Natural, age : Natural } 81 | , lib-version-linux = None types.Version 82 | , build-depends = 83 | [ prelude.utils.majorVersions 84 | "flib" 85 | [ prelude.v "1.0" ] 86 | [ types.LibraryName.main-library ] 87 | ] 88 | } 89 | } 90 | ] 91 | , sub-libraries = 92 | [ { name = 93 | "sublib" 94 | , library = 95 | λ(config : types.Config) 96 | → prelude.defaults.NamedLibrary 97 | ⫽ { build-depends = 98 | [ prelude.utils.majorVersions 99 | "sublib" 100 | [ prelude.v "1.0" ] 101 | [ types.LibraryName.main-library ] 102 | ] 103 | } 104 | } 105 | ] 106 | , test-suites = 107 | [ { name = 108 | "tests" 109 | , test-suite = 110 | λ(config : types.Config) 111 | → prelude.defaults.TestSuite 112 | ⫽ { type = 113 | types.TestType.exitcode-stdio { main-is = "Test.hs" } 114 | , build-depends = 115 | [ prelude.utils.majorVersions 116 | "tests" 117 | [ prelude.v "1.0" ] 118 | [ types.LibraryName.main-library ] 119 | ] 120 | } 121 | } 122 | ] 123 | } 124 | ) 125 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/map-source-repo.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: repo 3 | version: 1.0.0 4 | license: NONE 5 | homepage: https://github.com/owner/repo 6 | bug-reports: https://github.com/owner/repo/issues 7 | 8 | source-repository this 9 | type: git 10 | location: https://github.com/owner/repo 11 | tag: 1.0.0 12 | 13 | executable foo 14 | main-is: Main.hs 15 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/map-source-repo.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | let updateRepo = 6 | prelude.utils.mapSourceRepos 7 | ( λ(srcRepo : types.SourceRepo) 8 | → srcRepo ⫽ { tag = Some "1.0.0", kind = types.RepoKind.RepoThis } 9 | ) 10 | 11 | let project = prelude.utils.GitHub-project { owner = "owner", repo = "repo" } 12 | 13 | in updateRepo 14 | ( project 15 | ⫽ { version = 16 | prelude.v "1.0.0" 17 | , executables = 18 | [ { name = 19 | "foo" 20 | , executable = 21 | λ(config : ../../dhall/types/Config.dhall) 22 | → ../../dhall/defaults/Executable.dhall 23 | ⫽ { main-is = "Main.hs" } 24 | } 25 | ] 26 | } 27 | ) 28 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/mixins-no-signatures.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: mixins-test 3 | version: 0 4 | 5 | library 6 | mixins: 7 | foo, 8 | bar (Some.Module, Some.Other.Module, Third.Module as Renamed), 9 | baz hiding (Hidden, Also.Hidden) 10 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/mixins-no-signatures.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "mixins-test" 8 | , version = 9 | prelude.v "0" 10 | , library = 11 | Some 12 | ( λ(config : types.Config) 13 | → prelude.defaults.MainLibrary 14 | ⫽ { mixins = 15 | [ { package = 16 | "foo" 17 | , renaming = 18 | { provides = 19 | types.ModuleRenaming.default 20 | , requires = 21 | types.ModuleRenaming.default 22 | } 23 | } 24 | , { package = 25 | "bar" 26 | , renaming = 27 | { provides = 28 | types.ModuleRenaming.renaming 29 | [ { rename = "Some.Module", to = "Some.Module" } 30 | , { rename = 31 | "Some.Other.Module" 32 | , to = 33 | "Some.Other.Module" 34 | } 35 | , { rename = "Third.Module", to = "Renamed" } 36 | ] 37 | , requires = 38 | types.ModuleRenaming.default 39 | } 40 | } 41 | , { package = 42 | "baz" 43 | , renaming = 44 | { provides = 45 | types.ModuleRenaming.hiding 46 | [ "Hidden", "Also.Hidden" ] 47 | , requires = 48 | types.ModuleRenaming.default 49 | } 50 | } 51 | ] 52 | } 53 | ) 54 | } 55 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/multilib.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: multilib 3 | version: 0 4 | 5 | library 6 | default-language: Haskell2010 7 | build-depends: 8 | A -any, 9 | B : {b1, b2, b3} ==3 || >3, 10 | B : {b2} <3.5, 11 | C : {C, c1} -any, 12 | D : {} -any 13 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/multilib.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ./../../dhall/prelude.dhall 2 | 3 | let types = ./../../dhall/types.dhall 4 | 5 | in prelude.defaults.Package 6 | ⫽ { name = 7 | "multilib" 8 | , version = 9 | prelude.v "0" 10 | , cabal-version = 11 | prelude.v "3.0" 12 | , library = 13 | Some 14 | ( λ(config : types.Config) 15 | → prelude.defaults.MainLibrary 16 | ⫽ { build-depends = 17 | [ { bounds = 18 | prelude.anyVersion 19 | , library-names = 20 | [ types.LibraryName.main-library ] 21 | , package = 22 | "A" 23 | } 24 | , { bounds = 25 | prelude.unionVersionRanges 26 | (prelude.thisVersion (prelude.v "3")) 27 | (prelude.laterVersion (prelude.v "3")) 28 | , library-names = 29 | [ types.LibraryName.sub-library "b1" 30 | , types.LibraryName.sub-library "b2" 31 | , types.LibraryName.sub-library "b3" 32 | ] 33 | , package = 34 | "B" 35 | } 36 | , { bounds = 37 | prelude.earlierVersion (prelude.v "3.5") 38 | , library-names = 39 | [ types.LibraryName.sub-library "b2" ] 40 | , package = 41 | "B" 42 | } 43 | , { bounds = 44 | prelude.anyVersion 45 | , library-names = 46 | [ types.LibraryName.main-library 47 | , types.LibraryName.sub-library "c1" 48 | ] 49 | , package = 50 | "C" 51 | } 52 | , { bounds = 53 | prelude.anyVersion 54 | , library-names = 55 | [] : List types.LibraryName 56 | , package = 57 | "D" 58 | } 59 | ] 60 | , default-language = 61 | Some types.Language.Haskell2010 62 | } 63 | ) 64 | } -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/nested-conditions.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: foo 3 | version: 0 4 | 5 | library 6 | ghc-options: -Weverything 7 | 8 | if impl(ghc >=8.2) 9 | ghc-options: -Wno-redundant-constraints 10 | 11 | else 12 | 13 | if impl(ghc >=8.4) 14 | ghc-options: -Wno-missing-export-lists 15 | 16 | else 17 | -------------------------------------------------------------------------------- /golden-tests/dhall-to-cabal/nested-conditions.dhall: -------------------------------------------------------------------------------- 1 | let prelude = ../../dhall/prelude.dhall 2 | 3 | let types = ../../dhall/types.dhall 4 | 5 | let v = prelude.v 6 | 7 | in prelude.defaults.Package 8 | ⫽ { name = 9 | "foo" 10 | , version = 11 | v "0" 12 | , library = 13 | Some 14 | ( λ(config : types.Config) 15 | → prelude.defaults.MainLibrary 16 | ⫽ { compiler-options = 17 | prelude.defaults.CompilerOptions 18 | ⫽ { GHC = 19 | [ "-Weverything" ] 20 | # ( if config.impl 21 | types.Compiler.GHC 22 | (prelude.orLaterVersion (v "8.2")) 23 | 24 | then [ "-Wno-redundant-constraints" ] : List Text 25 | 26 | else [] : List Text 27 | ) 28 | # ( if config.impl 29 | types.Compiler.GHC 30 | (prelude.orLaterVersion (v "8.4")) 31 | 32 | then [ "-Wno-missing-export-lists" ] : List Text 33 | 34 | else [] : List Text 35 | ) 36 | } 37 | } 38 | ) 39 | } 40 | -------------------------------------------------------------------------------- /lib/Dhall/Extra.hs: -------------------------------------------------------------------------------- 1 | {-# language ApplicativeDo #-} 2 | {-# language GADTs #-} 3 | {-# language GeneralizedNewtypeDeriving #-} 4 | {-# language LambdaCase #-} 5 | {-# language OverloadedStrings #-} 6 | {-# language RecordWildCards #-} 7 | 8 | module Dhall.Extra 9 | ( validateType 10 | , sortExpr 11 | ) 12 | where 13 | 14 | import qualified Dhall 15 | import qualified Dhall.Core as Dhall ( Expr ) 16 | import qualified Dhall.Core as Expr ( Expr(..) ) 17 | import qualified Dhall.Map as Map 18 | 19 | 20 | validateType :: Dhall.Type ( Maybe a ) -> Dhall.Type a 21 | validateType a = 22 | a { Dhall.extract = 23 | \expr -> 24 | case Dhall.toMonadic (Dhall.extract a expr) of 25 | Left extractErrors -> Dhall.fromMonadic (Left extractErrors) 26 | Right Nothing -> Dhall.extractError "Validation failed" 27 | Right (Just ok) -> pure ok 28 | } 29 | 30 | 31 | sortExpr :: Dhall.Expr s a -> Dhall.Expr s a 32 | sortExpr = \case 33 | Expr.RecordLit r -> 34 | Expr.RecordLit ( Map.sort r ) 35 | 36 | Expr.Record r -> 37 | Expr.Record ( Map.sort r ) 38 | 39 | Expr.Union r -> 40 | Expr.Union ( Map.sort r ) 41 | 42 | e -> 43 | e 44 | -------------------------------------------------------------------------------- /lib/DhallLocation.hs: -------------------------------------------------------------------------------- 1 | {-# language OverloadedStrings #-} 2 | 3 | module DhallLocation 4 | ( DhallLocation(..) 5 | , dhallFromGitHub 6 | ) 7 | where 8 | 9 | import Data.Version ( showVersion ) 10 | 11 | import qualified Data.Text as StrictText 12 | import qualified Dhall.Core 13 | 14 | import qualified Paths_dhall_to_cabal as Paths 15 | 16 | 17 | data DhallLocation = DhallLocation 18 | { preludeLocation :: Dhall.Core.Import 19 | , typesLocation :: Dhall.Core.Import 20 | } 21 | 22 | 23 | version :: StrictText.Text 24 | version = StrictText.pack ( showVersion Paths.version ) 25 | 26 | 27 | dhallFromGitHub :: DhallLocation 28 | dhallFromGitHub = 29 | DhallLocation 30 | { preludeLocation = 31 | Dhall.Core.Import 32 | { Dhall.Core.importHashed = 33 | Dhall.Core.ImportHashed 34 | { Dhall.Core.hash = 35 | Nothing 36 | , Dhall.Core.importType = 37 | Dhall.Core.Remote 38 | ( Dhall.Core.URL 39 | Dhall.Core.HTTPS 40 | "raw.githubusercontent.com" 41 | ( Dhall.Core.File 42 | ( Dhall.Core.Directory [ "dhall", version, "dhall-to-cabal", "dhall-lang" ] ) 43 | "prelude.dhall" 44 | ) 45 | Nothing 46 | Nothing 47 | ) 48 | } 49 | , Dhall.Core.importMode = 50 | Dhall.Core.Code 51 | } 52 | 53 | , typesLocation = 54 | Dhall.Core.Import 55 | { Dhall.Core.importHashed = 56 | Dhall.Core.ImportHashed 57 | { Dhall.Core.hash = 58 | Nothing 59 | , Dhall.Core.importType = 60 | Dhall.Core.Remote 61 | ( Dhall.Core.URL 62 | Dhall.Core.HTTPS 63 | "raw.githubusercontent.com" 64 | ( Dhall.Core.File 65 | ( Dhall.Core.Directory [ "dhall", version, "dhall-to-cabal", "dhall-lang" ] ) 66 | "types.dhall" 67 | ) 68 | Nothing 69 | Nothing 70 | ) 71 | } 72 | , Dhall.Core.importMode = 73 | Dhall.Core.Code 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/DhallToCabal/ConfigTree.hs: -------------------------------------------------------------------------------- 1 | {-# language DeriveFunctor #-} 2 | {-# language LambdaCase #-} 3 | {-# language OverloadedStrings #-} 4 | 5 | module DhallToCabal.ConfigTree ( ConfigTree(..), toConfigTree ) where 6 | 7 | import Control.Monad 8 | import Data.Semigroup ( Semigroup ( (<>) ) ) 9 | import Dhall.Core hiding ( Const ) 10 | import Dhall.Optics ( transformMOf ) 11 | 12 | 13 | -- | 'ConfigTree' captures a logic-monad like expansion of the result of 14 | -- Bool-valued expressions. 15 | 16 | data ConfigTree cond a 17 | = Leaf a 18 | | Branch cond ( ConfigTree cond a ) ( ConfigTree cond a ) 19 | deriving (Functor, Show) 20 | 21 | instance Applicative ( ConfigTree cond ) where 22 | pure = Leaf 23 | (<*>) = ap 24 | 25 | instance Monad ( ConfigTree cond ) where 26 | return = pure 27 | 28 | Leaf a >>= f = f a 29 | Branch cond l r >>= f = Branch cond ( l >>= f ) ( r >>= f ) 30 | 31 | instance ( Semigroup a ) => Semigroup ( ConfigTree cond a ) where 32 | (<>) = liftM2 (<>) 33 | 34 | instance ( Monoid a ) => Monoid ( ConfigTree cond a ) where 35 | mempty = pure mempty 36 | mappend = liftM2 mappend 37 | 38 | 39 | -- | Given a Dhall expression that is of the form @λ( config : Config ) -> a@, 40 | -- find all saturated uses of @config@, and substitute in either @True@ or 41 | -- @False@. The two substitutions are captured in a 'Branch'. 42 | 43 | toConfigTree 44 | :: ( Eq a ) 45 | => Expr s a 46 | -> ConfigTree ( Expr s a ) ( Expr s a ) 47 | toConfigTree e = 48 | let 49 | v = 50 | "config" 51 | 52 | saturated = 53 | normalize ( App e ( Var v ) ) 54 | 55 | loop e = 56 | case normalize <$> rewriteConfigUse v e of 57 | Leaf a -> 58 | Leaf a 59 | 60 | Branch cond l r -> 61 | Branch cond ( loop =<< l ) ( loop =<< r ) 62 | 63 | in loop saturated 64 | 65 | 66 | 67 | -- | Find all config-like uses of a given variable, and expand them into all 68 | -- possible results of evaluation. 69 | 70 | rewriteConfigUse :: Var -> Expr s a -> ConfigTree (Expr s a) (Expr s a) 71 | rewriteConfigUse v = 72 | transformMOf 73 | subExpressions 74 | ( \expr -> 75 | if isConfigUse expr then 76 | Branch 77 | expr 78 | ( pure ( BoolLit True ) ) 79 | ( pure ( BoolLit False ) ) 80 | else 81 | pure expr 82 | ) 83 | 84 | where 85 | 86 | isConfigUse (App (Field (Var x') "os") _) | v == x' = True 87 | isConfigUse (App (Field (Var x') "arch") _) | v == x' = True 88 | isConfigUse (App (App (Field (Var x') "impl") _) _) | v == x' = True 89 | isConfigUse (App (Field (Var x') "flag") _) | v == x' = True 90 | isConfigUse _ = False 91 | -------------------------------------------------------------------------------- /lib/DhallToCabal/Diff.hs: -------------------------------------------------------------------------------- 1 | {-# language DefaultSignatures #-} 2 | {-# language FlexibleContexts #-} 3 | {-# language TypeOperators #-} 4 | 5 | module DhallToCabal.Diff ( Diffable(..) ) where 6 | 7 | import Data.List ( (\\), intersect ) 8 | 9 | import qualified Distribution.Compiler as Cabal 10 | import qualified Distribution.PackageDescription as Cabal 11 | import qualified Distribution.Types.ExecutableScope as Cabal 12 | import qualified Distribution.Types.ForeignLib as Cabal 13 | import qualified Distribution.Types.ForeignLibType as Cabal 14 | import qualified Distribution.Types.LibraryVisibility as Cabal 15 | import qualified Distribution.Types.UnqualComponentName as Cabal 16 | import qualified GHC.Generics as Generic 17 | 18 | 19 | 20 | diffEqVia :: ( Monoid a, Eq b ) => ( a -> b ) -> a -> a -> ( b, b, b ) 21 | diffEqVia f left right = 22 | if f left == f right then 23 | ( f left, f mempty, f mempty ) 24 | else 25 | ( f mempty, f left, f right ) 26 | 27 | 28 | 29 | class Diffable a where 30 | diff :: a -> a -> ( a, a, a ) 31 | default diff :: ( Generic.Generic a, GDiffable ( Generic.Rep a ) ) => a -> a -> ( a, a, a ) 32 | diff a b = 33 | let 34 | ( common, left, right ) = 35 | gdiff ( Generic.from a ) ( Generic.from b ) 36 | 37 | in 38 | ( Generic.to common, Generic.to left, Generic.to right ) 39 | 40 | 41 | 42 | instance Diffable Cabal.BuildInfo where 43 | diff a b = 44 | let 45 | ( commonBuildable, leftBuildable, rightBuildable ) = 46 | diffEqVia Cabal.buildable a b 47 | 48 | ( common, left, right ) = 49 | case gdiff ( Generic.from a ) ( Generic.from b ) of 50 | ( common, left, right ) -> 51 | ( Generic.to common, Generic.to left, Generic.to right ) 52 | 53 | in 54 | ( common { Cabal.buildable = commonBuildable } 55 | , left { Cabal.buildable = leftBuildable } 56 | , right { Cabal.buildable = rightBuildable } 57 | ) 58 | 59 | 60 | 61 | instance Diffable Cabal.Library where 62 | diff a b = 63 | let 64 | ( commonLibExposed, leftLibExposed, rightLibExposed ) = 65 | diffEqVia Cabal.libExposed a b 66 | 67 | ( common, left, right ) = 68 | case gdiff ( Generic.from a ) ( Generic.from b ) of 69 | ( common, left, right ) -> 70 | ( Generic.to common, Generic.to left, Generic.to right ) 71 | 72 | in 73 | ( common { Cabal.libExposed = commonLibExposed } 74 | , left { Cabal.libExposed = leftLibExposed } 75 | , right { Cabal.libExposed = rightLibExposed } 76 | ) 77 | 78 | 79 | instance Diffable Cabal.Benchmark 80 | 81 | 82 | 83 | instance Diffable Cabal.TestSuite 84 | 85 | 86 | 87 | instance Diffable Cabal.Executable where 88 | diff a b = 89 | let 90 | ( commonModulePath, leftModulePath, rightModulePath ) = 91 | diffEqVia Cabal.modulePath a b 92 | 93 | ( common, left, right ) = 94 | case gdiff ( Generic.from a ) ( Generic.from b ) of 95 | ( common, left, right ) -> 96 | ( Generic.to common, Generic.to left, Generic.to right ) 97 | 98 | in 99 | ( common { Cabal.modulePath = commonModulePath } 100 | , left { Cabal.modulePath = leftModulePath } 101 | , right { Cabal.modulePath = rightModulePath } 102 | ) 103 | 104 | 105 | 106 | instance Diffable Cabal.ForeignLib 107 | 108 | 109 | 110 | instance Eq a => Diffable ( Maybe a ) where 111 | diff left right = 112 | if left == right then 113 | ( left, Nothing, Nothing ) 114 | else 115 | ( Nothing, left, right ) 116 | 117 | 118 | 119 | instance Diffable Cabal.UnqualComponentName where 120 | diff left right = 121 | if left == right then 122 | ( left, mempty, mempty ) 123 | else 124 | ( mempty, left, right ) 125 | 126 | 127 | 128 | instance Diffable Cabal.BenchmarkInterface where 129 | diff left right = 130 | if left == right then 131 | ( left, mempty, mempty ) 132 | else 133 | ( mempty, left, right ) 134 | 135 | 136 | 137 | instance Diffable Cabal.ForeignLibType where 138 | diff left right = 139 | if left == right then 140 | ( left, mempty, mempty ) 141 | else 142 | ( mempty, left, right ) 143 | 144 | 145 | 146 | instance Diffable Cabal.TestSuiteInterface where 147 | diff left right = 148 | if left == right then 149 | ( left, mempty, mempty ) 150 | else 151 | ( mempty, left, right ) 152 | 153 | 154 | 155 | instance Diffable Cabal.ExecutableScope where 156 | diff left right = 157 | if left == right then 158 | ( left, mempty, mempty ) 159 | else 160 | ( mempty, left, right ) 161 | 162 | 163 | instance Diffable Cabal.LibraryVisibility where 164 | diff left right = 165 | if left == right then 166 | ( left, mempty, mempty ) 167 | else 168 | ( mempty, left, right ) 169 | 170 | 171 | instance ( Diffable a ) => Diffable ( Cabal.PerCompilerFlavor a ) 172 | 173 | 174 | instance Diffable Cabal.LibraryName where 175 | diff left right = 176 | if left == right then 177 | ( left, Cabal.defaultLibName, Cabal.defaultLibName ) 178 | else 179 | ( Cabal.defaultLibName, left, right ) 180 | 181 | 182 | instance Eq a => Diffable [a] where 183 | diff a b = 184 | ( intersect a b 185 | , a \\ b 186 | , b \\ a 187 | ) 188 | 189 | 190 | 191 | instance Diffable Bool where 192 | diff left right = 193 | if left == right then 194 | ( left, True, True ) 195 | else 196 | ( True, left, right ) 197 | 198 | 199 | 200 | class GDiffable f where 201 | gdiff :: f a -> f a -> ( f a, f a, f a ) 202 | 203 | 204 | 205 | instance GDiffable f => GDiffable ( Generic.M1 i c f ) where 206 | gdiff ( Generic.M1 a ) ( Generic.M1 b ) = 207 | let 208 | ( common, left, right ) = 209 | gdiff a b 210 | 211 | in 212 | ( Generic.M1 common, Generic.M1 left, Generic.M1 right ) 213 | 214 | 215 | 216 | instance ( GDiffable f, GDiffable g ) => GDiffable ( f Generic.:*: g ) where 217 | gdiff ( a Generic.:*: x ) ( b Generic.:*: y ) = 218 | let 219 | ( common0, left0, right0 ) = 220 | gdiff a b 221 | 222 | ( common1, left1, right1 ) = 223 | gdiff x y 224 | 225 | in 226 | ( common0 Generic.:*: common1, left0 Generic.:*: left1, right0 Generic.:*: right1 ) 227 | 228 | 229 | 230 | instance Diffable a => GDiffable ( Generic.K1 i a ) where 231 | gdiff ( Generic.K1 a ) ( Generic.K1 b ) = 232 | let 233 | ( common, left, right ) = 234 | diff a b 235 | 236 | in 237 | ( Generic.K1 common, Generic.K1 left, Generic.K1 right ) 238 | -------------------------------------------------------------------------------- /lib/DhallToCabal/Util.hs: -------------------------------------------------------------------------------- 1 | {-# language ViewPatterns #-} 2 | 3 | module DhallToCabal.Util 4 | ( relativeTo 5 | ) 6 | where 7 | 8 | import System.FilePath 9 | ( dropTrailingPathSeparator, joinPath, normalise, splitDirectories, takeDirectory ) 10 | 11 | -- | Like 'System.FilePath.makeRelative', but will introduce @..@ 12 | -- segments (and hence will misbehave in the presence of symlinks). 13 | -- 14 | -- If the path being relativised is identical to the root path, then 15 | -- this will return the empty string. 16 | relativeTo 17 | :: FilePath 18 | -- ^ The path to be relative to. Note that the final file-name is 19 | -- ignored: @foo/bar@ is relative to @foo/@, even if @foo/bar@ is 20 | -- a directory. 21 | -> FilePath 22 | -- ^ The path to relativise. 23 | -> FilePath 24 | relativeTo = 25 | \ ( splitDirectories . dropTrailingPathSeparator . takeDirectory . normalise -> base ) -> 26 | \ ( splitDirectories . normalise -> path ) -> 27 | joinPath ( go base path ) 28 | where 29 | -- @normalise "."@ is @"."@, so we have to take care here with dots. 30 | go ( a : as ) ( b : bs ) 31 | | a == b = go as bs 32 | | a == "." = go as ( b : bs ) 33 | | b == "." = go (a : as) bs 34 | | otherwise = ( ".." <$ ( a : as ) ) ++ ( b : bs ) 35 | go [] bs = bs 36 | go as [] = ".." <$ as 37 | -------------------------------------------------------------------------------- /meta/Main.hs: -------------------------------------------------------------------------------- 1 | {-# language LambdaCase #-} 2 | {-# language OverloadedStrings #-} 3 | {-# language RecordWildCards #-} 4 | {-# language ViewPatterns #-} 5 | module Main 6 | ( main 7 | ) 8 | where 9 | 10 | import Control.Applicative ( (<**>) ) 11 | import Data.Foldable ( for_ ) 12 | import Data.String ( fromString ) 13 | import System.Directory ( createDirectoryIfMissing ) 14 | import System.FilePath 15 | ( (), (<.>), dropTrailingPathSeparator, normalise 16 | , splitDirectories, splitFileName, takeDirectory 17 | ) 18 | 19 | import CabalToDhall 20 | ( KnownDefault, PreludeReference (..), getDefault ) 21 | import DhallToCabal.FactorType 22 | ( KnownType (..), factored ) 23 | import DhallToCabal.Util 24 | ( relativeTo ) 25 | 26 | import qualified Data.Text.Prettyprint.Doc as Pretty 27 | import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty 28 | import qualified Dhall.Core 29 | import qualified Dhall.Core as Expr ( Expr(..) ) 30 | import qualified Dhall.Lint as Lint 31 | import qualified Dhall.Parser 32 | import qualified Options.Applicative as OptParse 33 | import qualified System.IO 34 | 35 | 36 | data MetaOptions = MetaOptions 37 | { prefix :: FilePath } 38 | 39 | 40 | metaOptionsParser :: OptParse.Parser MetaOptions 41 | metaOptionsParser = 42 | MetaOptions 43 | <$> 44 | OptParse.strOption 45 | ( mconcat 46 | [ OptParse.long "prefix" 47 | , OptParse.value "dhall/" 48 | , OptParse.metavar "PATH" 49 | ] 50 | ) 51 | 52 | 53 | defaultFile :: KnownDefault -> FilePath 54 | defaultFile typ = "./defaults" show typ <.> "dhall" 55 | 56 | 57 | typeFile :: KnownType -> FilePath 58 | typeFile = \case 59 | Library -> "types/Library.dhall" 60 | ForeignLibrary -> "types/ForeignLibrary.dhall" 61 | Benchmark -> "types/Benchmark.dhall" 62 | Executable -> "types/Executable.dhall" 63 | TestSuite -> "types/TestSuite.dhall" 64 | BuildInfo -> "types/BuildInfo.dhall" 65 | Config -> "types/Config.dhall" 66 | SourceRepo -> "types/SourceRepo.dhall" 67 | RepoType -> "types/RepoType.dhall" 68 | RepoKind -> "types/RepoKind.dhall" 69 | Compiler -> "types/Compiler.dhall" 70 | OS -> "types/OS.dhall" 71 | Extension -> "types/Extension.dhall" 72 | CompilerOptions -> "types/CompilerOptions.dhall" 73 | Arch -> "types/Arch.dhall" 74 | Language -> "types/Language.dhall" 75 | License -> "types/License.dhall" 76 | BuildType -> "types/BuildType.dhall" 77 | Package -> "types/Package.dhall" 78 | VersionRange -> "types/VersionRange.dhall" 79 | Version -> "types/Version.dhall" 80 | SPDX -> "types/SPDX.dhall" 81 | LicenseId -> "types/SPDX/LicenseId.dhall" 82 | LicenseExceptionId -> "types/SPDX/LicenseExceptionId.dhall" 83 | Scope -> "types/Scope.dhall" 84 | ModuleRenaming -> "types/ModuleRenaming.dhall" 85 | ForeignLibOption -> "types/ForeignLibOption.dhall" 86 | ForeignLibType -> "types/ForeignLibType.dhall" 87 | SetupBuildInfo -> "types/SetupBuildInfo.dhall" 88 | Dependency -> "types/Dependency.dhall" 89 | TestType -> "types/TestType.dhall" 90 | Mixin -> "types/Mixin.dhall" 91 | Flag -> "types/Flag.dhall" 92 | PkgconfigVersionRange -> "types/PkgconfigVersionRange.dhall" 93 | LibraryName -> "types/LibraryName.dhall" 94 | LibraryVisibility -> "types/LibraryVisibility.dhall" 95 | 96 | 97 | importFile :: FilePath -> Dhall.Core.Import 98 | importFile ( splitFileName -> ( directory, filename ) ) = 99 | let 100 | rawComponents = 101 | fromString <$> 102 | splitDirectories ( dropTrailingPathSeparator directory ) 103 | ( components, relativity ) = 104 | case rawComponents of 105 | ".." : rest -> ( rest, Dhall.Core.Parent ) 106 | -- `splitFileName "foo"` produces (".", "foo"). It'd be OK to 107 | -- leave the dot component in, but we might as well remove it 108 | -- for neatness. 109 | "." : rest -> ( rest, Dhall.Core.Here ) 110 | _ -> ( rawComponents, Dhall.Core.Here ) 111 | in 112 | Dhall.Core.Import 113 | { Dhall.Core.importHashed = 114 | Dhall.Core.ImportHashed 115 | { Dhall.Core.hash = 116 | Nothing 117 | , Dhall.Core.importType = 118 | Dhall.Core.Local 119 | relativity 120 | ( Dhall.Core.File 121 | ( Dhall.Core.Directory ( reverse components ) ) 122 | ( fromString filename ) 123 | ) 124 | } 125 | , Dhall.Core.importMode = 126 | Dhall.Core.Code 127 | } 128 | 129 | 130 | writeOutput :: FilePath -> Dhall.Core.Expr s Dhall.Core.Import -> IO () 131 | writeOutput dest expr = 132 | System.IO.withFile dest System.IO.WriteMode $ \ hnd -> do 133 | System.IO.hPutStrLn hnd $ 134 | "-- This file is auto-generated by dhall-to-cabal-meta. Look but" 135 | ++ " don't touch (unless you want your edits to be over-written)." 136 | Pretty.renderIO 137 | hnd 138 | ( Pretty.layoutSmart prettyOpts 139 | ( Pretty.pretty expr ) 140 | ) 141 | -- Pretty.renderIO doesn't give us a final newline, so add that ourselves. 142 | System.IO.hPutStr hnd "\n" 143 | 144 | 145 | meta :: MetaOptions -> IO () 146 | meta (MetaOptions {..}) = do 147 | putStrLn $ 148 | "Generating defaults and types underneath " ++ prefix ++ "." 149 | 150 | putStrLn "Generating types..." 151 | 152 | for_ [ minBound .. maxBound ] $ \ knownType -> do 153 | let 154 | localDest = 155 | typeFile knownType 156 | 157 | expr = 158 | importFile . relativeTo localDest . typeFile <$> factored knownType 159 | 160 | dest = 161 | prefix localDest 162 | 163 | putStrLn $ 164 | " Writing type for " ++ show knownType ++ " to " ++ dest ++ "." 165 | 166 | createDirectoryIfMissing True ( takeDirectory dest ) 167 | 168 | writeOutput dest expr 169 | 170 | putStrLn "Generating defaults..." 171 | 172 | for_ [ minBound .. maxBound ] $ \ defaultType -> do 173 | let localDest = 174 | defaultFile defaultType 175 | 176 | -- normalise for prettiness in display (otherwise we get /./ components) 177 | dest = 178 | normalise ( prefix localDest ) 179 | 180 | resolve = \case 181 | PreludeDefault typ -> 182 | Expr.Embed 183 | ( importFile ( relativeTo localDest ( defaultFile typ ) ) ) 184 | PreludeConstructorsLicense -> 185 | Expr.Var "types" `Expr.Field` "License" 186 | PreludeConstructorsRepoKind -> 187 | Expr.Var "types" `Expr.Field` "RepoKind" 188 | PreludeConstructorsScope -> 189 | Expr.Var "types" `Expr.Field` "Scope" 190 | PreludeConstructorsLibraryVisibility -> 191 | Expr.Var "types" `Expr.Field` "LibraryVisibility" 192 | PreludeV -> 193 | Expr.Embed 194 | ( importFile ( relativeTo localDest "./Version/v.dhall" ) ) 195 | 196 | expr :: Expr.Expr Dhall.Parser.Src Dhall.Core.Import 197 | expr = 198 | getDefault 199 | ( importFile ( relativeTo localDest "./types.dhall" ) ) 200 | resolve 201 | defaultType 202 | 203 | putStrLn $ 204 | " Writing default for " ++ show defaultType ++ " to " ++ dest ++ "." 205 | 206 | createDirectoryIfMissing True ( takeDirectory dest ) 207 | 208 | writeOutput dest ( Lint.lint expr ) 209 | 210 | 211 | -- Shamelessly taken from dhall-format 212 | prettyOpts :: Pretty.LayoutOptions 213 | prettyOpts = 214 | Pretty.defaultLayoutOptions 215 | { Pretty.layoutPageWidth = Pretty.AvailablePerLine 80 1.0 } 216 | 217 | 218 | main :: IO () 219 | main = do 220 | metaOpts <- 221 | OptParse.execParser opts 222 | 223 | meta metaOpts 224 | 225 | where 226 | 227 | opts = 228 | OptParse.info ( metaOptionsParser <**> OptParse.helper ) mempty 229 | -------------------------------------------------------------------------------- /overrides/Cabal.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, array, base, base-compat, base-orphans, binary 2 | , bytestring, containers, deepseq, Diff, directory, filepath 3 | , integer-logarithms, mtl, optparse-applicative, parsec, pretty 4 | , process, QuickCheck, stdenv, stm, tagged, tar, tasty 5 | , tasty-golden, tasty-hunit, tasty-quickcheck, temporary, text 6 | , time, transformers, tree-diff, unix 7 | }: 8 | mkDerivation { 9 | pname = "Cabal"; 10 | version = "3.0.0.0"; 11 | sha256 = "5143ec26d740c1a508c93a8860e64407e7546c29b9817db20ff1595c1968d287"; 12 | setupHaskellDepends = [ mtl parsec ]; 13 | libraryHaskellDepends = [ 14 | array base binary bytestring containers deepseq directory filepath 15 | mtl parsec pretty process text time transformers unix 16 | ]; 17 | testHaskellDepends = [ 18 | array base base-compat base-orphans binary bytestring containers 19 | deepseq Diff directory filepath integer-logarithms 20 | optparse-applicative pretty process QuickCheck stm tagged tar tasty 21 | tasty-golden tasty-hunit tasty-quickcheck temporary text tree-diff 22 | ]; 23 | doCheck = false; 24 | homepage = "http://www.haskell.org/cabal/"; 25 | description = "A framework for packaging Haskell software"; 26 | license = stdenv.lib.licenses.bsd3; 27 | } 28 | -------------------------------------------------------------------------------- /overrides/dhall.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, aeson, aeson-pretty, ansi-terminal, base 2 | , bytestring, case-insensitive, cborg, cborg-json, containers 3 | , contravariant, cryptonite, data-fix, deepseq, Diff, directory 4 | , doctest, dotgen, either, exceptions, filepath, foldl, gauge 5 | , generic-random, haskeline, http-client, http-client-tls 6 | , http-types, lens-family-core, megaparsec, memory, mockery, mtl 7 | , network-uri, optparse-applicative, parsers, prettyprinter 8 | , prettyprinter-ansi-terminal, profunctors, QuickCheck 9 | , quickcheck-instances, repline, scientific, semigroups, serialise 10 | , spoon, stdenv, tasty, tasty-expected-failure, tasty-hunit 11 | , tasty-quickcheck, template-haskell, text, th-lift-instances 12 | , transformers, transformers-compat, turtle, unordered-containers 13 | , uri-encode, vector 14 | }: 15 | mkDerivation { 16 | pname = "dhall"; 17 | version = "1.26.0"; 18 | sha256 = "f2d0b4a1e274fbc5684922be49c43333b063880db57458e78de2bebd9afb68ca"; 19 | isLibrary = true; 20 | isExecutable = true; 21 | libraryHaskellDepends = [ 22 | aeson aeson-pretty ansi-terminal base bytestring case-insensitive 23 | cborg cborg-json containers contravariant cryptonite data-fix 24 | deepseq Diff directory dotgen either exceptions filepath haskeline 25 | http-client http-client-tls http-types lens-family-core megaparsec 26 | memory mtl network-uri optparse-applicative parsers prettyprinter 27 | prettyprinter-ansi-terminal profunctors repline scientific 28 | serialise template-haskell text th-lift-instances transformers 29 | transformers-compat unordered-containers uri-encode vector 30 | ]; 31 | executableHaskellDepends = [ base ]; 32 | testHaskellDepends = [ 33 | base bytestring cborg containers data-fix deepseq directory doctest 34 | filepath foldl generic-random lens-family-core megaparsec mockery 35 | prettyprinter QuickCheck quickcheck-instances scientific semigroups 36 | serialise spoon tasty tasty-expected-failure tasty-hunit 37 | tasty-quickcheck text transformers turtle vector 38 | ]; 39 | benchmarkHaskellDepends = [ 40 | base bytestring containers directory gauge serialise text 41 | ]; 42 | description = "A configuration language guaranteed to terminate"; 43 | license = stdenv.lib.licenses.bsd3; 44 | } 45 | -------------------------------------------------------------------------------- /overrides/ghc-paths.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, base, Cabal, directory, stdenv }: 2 | mkDerivation { 3 | pname = "ghc-paths"; 4 | version = "0.1.0.12"; 5 | sha256 = "6ecbe676d073cb07989c61ce4c5709c4e67cbefdd2d55a4095f9388b6fe2c484"; 6 | setupHaskellDepends = [ base Cabal directory ]; 7 | libraryHaskellDepends = [ base ]; 8 | description = "Knowledge of GHC's installation directories"; 9 | license = stdenv.lib.licenses.bsd3; 10 | } 11 | -------------------------------------------------------------------------------- /release.nix: -------------------------------------------------------------------------------- 1 | let 2 | nixpkgs = builtins.fetchGit { 3 | url = "https://github.com/NixOS/nixpkgs"; 4 | rev = "ac827e0e35b8a3f7370ff0dbaea7387dbc514c6c"; 5 | }; 6 | 7 | config = { 8 | packageOverrides = pkgs: { 9 | haskellPackages = pkgs.haskellPackages.override { 10 | overrides = self: super: { 11 | # Local packages 12 | dhall-to-cabal = self.callPackage ./dhall-to-cabal.nix {}; 13 | 14 | # Things we need newer versions of. 15 | Cabal = self.callPackage ./overrides/Cabal.nix {}; 16 | 17 | dhall = pkgs.haskell.lib.dontCheck (super.callPackage ./overrides/dhall.nix {}); 18 | 19 | ghc-paths = self.callPackage ./overrides/ghc-paths.nix {}; 20 | }; 21 | }; 22 | }; 23 | }; 24 | 25 | pkgs = 26 | import nixpkgs { inherit config; }; 27 | 28 | in 29 | { inherit (pkgs.haskellPackages) dhall-to-cabal; 30 | } 31 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | (import ./release.nix).dhall-to-cabal.env 2 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | resolver: nightly-2019-09-12 2 | packages: 3 | - . 4 | extra-deps: 5 | - dhall-1.26.0@rev:0 6 | - Cabal-3.0.0.0@rev:0 7 | - lens-4.18@rev:0 8 | -------------------------------------------------------------------------------- /tests/DhallToCabal/Tests.hs: -------------------------------------------------------------------------------- 1 | {-# language OverloadedStrings #-} 2 | 3 | module DhallToCabal.Tests 4 | ( versionSpec 5 | ) 6 | where 7 | 8 | import Data.Maybe ( fromMaybe ) 9 | import Dhall.Core ( Const(..), Expr(..), Chunks(..) ) 10 | 11 | import qualified Data.Text as StrictText 12 | import qualified Dhall 13 | import qualified Dhall.Core 14 | import qualified Dhall.Parser 15 | import qualified Dhall.TypeCheck 16 | import qualified DhallToCabal 17 | import qualified Distribution.Text as Cabal ( simpleParse ) 18 | import qualified Test.Tasty 19 | import qualified Test.Tasty.HUnit 20 | 21 | 22 | versionSpec :: Test.Tasty.TestTree 23 | versionSpec = 24 | Test.Tasty.testGroup 25 | "version" 26 | [ testExtraction 27 | "version" 28 | DhallToCabal.version 29 | ( Lam 30 | "Version" 31 | ( Const Type ) 32 | ( Lam 33 | "v" 34 | ( Pi "_" ( Const Type ) ( Pi "_" Text "Version" ) ) 35 | ( App "v" ( TextLit ( Chunks [] "1.0.0" ) ) ) 36 | ) 37 | ) 38 | ( fromMaybe 39 | ( error "Could not parse version" ) 40 | ( Cabal.simpleParse ( StrictText.unpack "1.0.0" ) ) 41 | ) ] 42 | 43 | 44 | extract x y = 45 | either ( const Nothing ) Just ( Dhall.toMonadic ( Dhall.extract x y ) ) 46 | 47 | 48 | testExtraction 49 | :: ( Eq a, Show a ) 50 | => Test.Tasty.TestName 51 | -> Dhall.Type a 52 | -> Dhall.Core.Expr Dhall.Parser.Src Dhall.TypeCheck.X 53 | -> a 54 | -> Test.Tasty.TestTree 55 | testExtraction testName t expr expected = 56 | Test.Tasty.testGroup 57 | testName 58 | [ Test.Tasty.HUnit.testCase 59 | "original" 60 | ( Just expected Test.Tasty.HUnit.@=? extract t expr ) 61 | , Test.Tasty.HUnit.testCase 62 | "alphaNormalize" 63 | ( Just expected 64 | Test.Tasty.HUnit.@=? 65 | extract t ( Dhall.Core.alphaNormalize expr ) 66 | ) 67 | , Test.Tasty.HUnit.testCase 68 | "betaNormalize" 69 | ( Just expected 70 | Test.Tasty.HUnit.@=? 71 | extract t ( Dhall.Core.normalize expr ) 72 | ) 73 | ] 74 | -------------------------------------------------------------------------------- /tests/Tests.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | ( main 3 | ) 4 | where 5 | 6 | import qualified DhallToCabal.Tests 7 | import qualified Test.Tasty 8 | 9 | 10 | main :: IO () 11 | main = 12 | Test.Tasty.defaultMain DhallToCabal.Tests.versionSpec 13 | --------------------------------------------------------------------------------