diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,5 +1,62 @@
 # dhall-to-cabal change log
 
+## NEXT
+
+
+## 1.2.0.0 -- 2018-07-05
+
+### Breaking API Changes
+
+* Remove orphan `Dhall.Core.Inject` instances for `[Char]` and
+  `CompilerFlavor`.
+
+* `CabalToDhall.cabalToDhall` is now a pure function that accepts a
+  `GenericPackageDescription`. A new convenience function has been
+  added to `CabalToDhall`, `parseGenericPackageDescriptionThrows`.
+
+### Functional Changes
+
+* `os` conditions where the operating system's name was not recognised
+  (e.g., `os(multics)`) were crashing cabal-to-dhall. They now work as
+  expected.
+
+* `dhall-to-cabal` and `cabal-to-dhall` now respond to `--version`.
+
+* The `dhall` subdirectory has been reorganised so that things that
+  are not types are not in the `types` subdirectory. Specifically,
+  `dhall/types/Version/v.dhall`, all of
+  `dhall/types/VersionRange/*.dhall` and the operations (i.e., the
+  enumerations `LicenseId.dhall` and `LicenseExceptionId.dhall`) from
+  `dhall/types/SPDX/*.dhall` have been moved to, respectively,
+  `dhall/Version/v.dhall`, `dhall/VersionRange/*.dhall`, and
+  `dhall/SPDX/*.dhall`. In addition, the files have been renamed as
+  appropriate to reflect the name that they are exported from the
+  prelude as; in practice, this means that they have gone from
+  TitleCase to camelCase.
+
+  Code that only imports `prelude.dhall` and `types.dhall` is
+  unaffected by this change.
+
+* `prelude.defaults.Package.license` is now `AllRightsReserved`.
+
+* `dhall-to-cabal` now maps `AllRightsReserved` to `SPDX.NONE` when
+  `cabal-version` is at least 2.2.
+
+* `cabal-to-dhall` will now generate more compact `.dhall` files by
+  using defaults.
+
+* The default `build-type` is now omission, to use Cabal 2.2's
+  inference, and the default `cabal-version` has been bumped to 2.2.
+
+* Export `prelude.types.Scopes`.
+
+## Other Changes
+
+* Bump upper-bounds for `base`, `containers` and `contravariant`. This project
+  can build on GHC 8.6 (though will need `--allow-newer` for `Cabal` until this
+  is official released).
+
+
 ## 1.1.0.0 -- 2018-06-03
 
 ### Breaking Changes
diff --git a/cabal-to-dhall/Main.hs b/cabal-to-dhall/Main.hs
--- a/cabal-to-dhall/Main.hs
+++ b/cabal-to-dhall/Main.hs
@@ -4,24 +4,23 @@
 module Main ( main ) where
 
 import Control.Applicative ( (<**>), optional )
-import GHC.Stack
+import Data.Foldable ( asum )
+import Data.Version ( showVersion )
 
 import qualified Data.ByteString as ByteString
-import qualified Data.Text.Lazy as LazyText
-import qualified Data.Text.Lazy.IO as LazyText
 import qualified Data.Text.Prettyprint.Doc as Pretty
 import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
-import qualified Data.Text.Prettyprint.Doc.Symbols.Unicode as Pretty
-import qualified Dhall.Core
 import qualified Options.Applicative as OptParse
 import qualified System.IO
 
-import CabalToDhall ( cabalToDhall )
+import CabalToDhall ( cabalToDhall, parseGenericPackageDescriptionThrows )
 import DhallLocation ( dhallFromGitHub )
+import Paths_dhall_to_cabal ( version )
 
 
 data Command
   = RunCabalToDhall CabalToDhallOptions
+  | PrintVersion
 
 
 data CabalToDhallOptions = CabalToDhallOptions
@@ -44,19 +43,36 @@
         )
 
 
-commandLineParser =
-  RunCabalToDhall <$> ( cabalToDhallOptionsParser <**> OptParse.helper )
+printVersionParser :: OptParse.Parser ()
+printVersionParser =
+  OptParse.flag'
+    ()
+    ( mconcat
+      [ OptParse.long "version"
+      , OptParse.help "Display dhall-to-cabal's version and exit."
+      ]
+    )
 
 
+optionsParser = OptParse.info ( parser <**> OptParse.helper ) mempty
+  where
+    parser =
+      asum
+        [ RunCabalToDhall <$> cabalToDhallOptionsParser
+        , PrintVersion <$ printVersionParser
+        ]
+
+
 main :: IO ()
 main = do
   command <-
-    OptParse.execParser
-      ( OptParse.info commandLineParser mempty )
+    OptParse.execParser optionsParser
 
   case command of
     RunCabalToDhall options ->
       runCabalToDhall options
+    PrintVersion ->
+      printVersion
 
 
 runCabalToDhall :: CabalToDhallOptions -> IO ()
@@ -69,8 +85,8 @@
       Just filePath ->
         ByteString.readFile filePath
 
-  dhall <-
-    cabalToDhall dhallFromGitHub source
+  dhall <- cabalToDhall dhallFromGitHub <$>
+    parseGenericPackageDescriptionThrows source
 
   Pretty.renderIO
     System.IO.stdout
@@ -91,3 +107,8 @@
 opts =
   Pretty.defaultLayoutOptions
     { Pretty.layoutPageWidth = Pretty.AvailablePerLine 80 1.0 }
+
+
+printVersion :: IO ()
+printVersion = do
+  putStrLn ( "cabal-to-dhall version " ++ showVersion version )
diff --git a/dhall-to-cabal.cabal b/dhall-to-cabal.cabal
--- a/dhall-to-cabal.cabal
+++ b/dhall-to-cabal.cabal
@@ -1,4 +1,4 @@
-cabal-version: 2.0
+cabal-version: 2.2
 -- * * * * * * * * * * * * WARNING * * * * * * * * * * * *
 -- This file has been AUTO-GENERATED by dhall-to-cabal.
 --
@@ -9,7 +9,7 @@
 -- 'dhall-to-cabal -- dhall-to-cabal.dhall > dhall-to-cabal.cabal'.
 -- * * * * * * * * * * * * WARNING * * * * * * * * * * * *
 name: dhall-to-cabal
-version: 1.1.0.0
+version: 1.2.0.0
 license: MIT
 license-file: LICENSE
 maintainer: ollie@ocharles.org.uk
@@ -24,75 +24,78 @@
     (including conditional stanzas).
     .
 category: Distribution
-build-type: Simple
 extra-source-files:
     Changelog.md
     README.md
+    dhall/SPDX/and.dhall
+    dhall/SPDX/license.dhall
+    dhall/SPDX/licenseVersionOrLater.dhall
+    dhall/SPDX/or.dhall
+    dhall/SPDX/ref.dhall
+    dhall/SPDX/refWithFile.dhall
+    dhall/Version/v.dhall
+    dhall/VersionRange/anyVersion.dhall
+    dhall/VersionRange/differenceVersionRanges.dhall
+    dhall/VersionRange/earlierVersion.dhall
+    dhall/VersionRange/intersectVersionRanges.dhall
+    dhall/VersionRange/invertVersionRange.dhall
+    dhall/VersionRange/laterVersion.dhall
+    dhall/VersionRange/majorBoundVersion.dhall
+    dhall/VersionRange/noVersion.dhall
+    dhall/VersionRange/notThisVersion.dhall
+    dhall/VersionRange/orEarlierVersion.dhall
+    dhall/VersionRange/orLaterVersion.dhall
+    dhall/VersionRange/thisVersion.dhall
+    dhall/VersionRange/unionVersionRanges.dhall
+    dhall/VersionRange/withinVersion.dhall
+    dhall/defaults/Benchmark.dhall
     dhall/defaults/BuildInfo.dhall
-    dhall/defaults/Library.dhall
     dhall/defaults/CompilerOptions.dhall
-    dhall/defaults/SourceRepo.dhall
-    dhall/defaults/TestSuite.dhall
     dhall/defaults/Executable.dhall
+    dhall/defaults/Library.dhall
     dhall/defaults/Package.dhall
-    dhall/defaults/Benchmark.dhall
-    dhall/unconditional.dhall
-    dhall/GitHub-project.dhall
+    dhall/defaults/SourceRepo.dhall
+    dhall/defaults/TestSuite.dhall
     dhall/prelude.dhall
-    dhall/types/VersionRange.dhall
-    dhall/types/OS.dhall
-    dhall/types/Guarded.dhall
-    dhall/types/License.dhall
-    dhall/types/Library.dhall
-    dhall/types/Version.dhall
-    dhall/types/Language.dhall
-    dhall/types/Extension.dhall
-    dhall/types/CompilerOptions.dhall
-    dhall/types/SourceRepo.dhall
-    dhall/types/TestSuite.dhall
-    dhall/types/Executable.dhall
-    dhall/types/Dependency.dhall
-    dhall/types/Mixin.dhall
+    dhall/types.dhall
+    dhall/types/Arch.dhall
+    dhall/types/Benchmark.dhall
+    dhall/types/BuildType.dhall
     dhall/types/Compiler.dhall
+    dhall/types/CompilerOptions.dhall
     dhall/types/Config.dhall
-    dhall/types/Package.dhall
-    dhall/types/builtin.dhall
-    dhall/types/BuildType.dhall
-    dhall/types/RepoKind.dhall
-    dhall/types/Version/v.dhall
-    dhall/types/Arch.dhall
-    dhall/types/Scope.dhall
     dhall/types/CustomSetup.dhall
-    dhall/types/Benchmark.dhall
+    dhall/types/Dependency.dhall
+    dhall/types/Executable.dhall
+    dhall/types/Extension.dhall
     dhall/types/Flag.dhall
     dhall/types/ForeignLibrary.dhall
+    dhall/types/Guarded.dhall
+    dhall/types/Language.dhall
+    dhall/types/Library.dhall
+    dhall/types/License.dhall
+    dhall/types/Mixin.dhall
     dhall/types/ModuleRenaming.dhall
+    dhall/types/OS.dhall
+    dhall/types/Package.dhall
+    dhall/types/RepoKind.dhall
     dhall/types/RepoType.dhall
-    dhall/types/TestType.dhall
-    dhall/types/VersionRange/IntersectVersionRanges.dhall
-    dhall/types/VersionRange/WithinVersion.dhall
-    dhall/types/VersionRange/InvertVersionRange.dhall
-    dhall/types/VersionRange/EarlierVersion.dhall
-    dhall/types/VersionRange/DifferenceVersionRanges.dhall
-    dhall/types/VersionRange/ThisVersion.dhall
-    dhall/types/VersionRange/OrLaterVersion.dhall
-    dhall/types/VersionRange/OrEarlierVersion.dhall
-    dhall/types/VersionRange/AnyVersion.dhall
-    dhall/types/VersionRange/NotThisVersion.dhall
-    dhall/types/VersionRange/LaterVersion.dhall
-    dhall/types/VersionRange/NoVersion.dhall
-    dhall/types/VersionRange/MajorBoundVersion.dhall
-    dhall/types/VersionRange/UnionVersionRanges.dhall
-    dhall/types/SetupBuildInfo.dhall
     dhall/types/SPDX.dhall
-    dhall/types/SPDX/License.dhall
-    dhall/types/SPDX/LicenseVersionOrLater.dhall
-    dhall/types/SPDX/Ref.dhall
-    dhall/types/SPDX/RefWithFile.dhall
-    dhall/types/SPDX/And.dhall
-    dhall/types/SPDX/Or.dhall
     dhall/types/SPDX/LicenseExceptionId.dhall
     dhall/types/SPDX/LicenseId.dhall
+    dhall/types/Scope.dhall
+    dhall/types/SetupBuildInfo.dhall
+    dhall/types/SourceRepo.dhall
+    dhall/types/TestSuite.dhall
+    dhall/types/TestType.dhall
+    dhall/types/Version.dhall
+    dhall/types/VersionRange.dhall
+    dhall/types/builtin.dhall
+    dhall/unconditional.dhall
+    dhall/utils/GitHub-project.dhall
+    dhall/utils/majorVersions.dhall
+    dhall/utils/mapSourceRepos.dhall
+    dhall/utils/package.dhall
     golden-tests/dhall-to-cabal/*.dhall
     golden-tests/dhall-to-cabal/*.cabal
     golden-tests/cabal-to-dhall/*.dhall
@@ -118,15 +121,18 @@
     default-language: Haskell2010
     other-extensions: ApplicativeDo GADTs GeneralizedNewtypeDeriving
                       LambdaCase OverloadedStrings RecordWildCards TypeApplications
-    ghc-options: -Wall -fno-warn-name-shadowing
+    ghc-options: -Weverything -Wno-safe -Wno-unsafe
+                 -Wno-implicit-prelude -Wno-missed-specialisations
+                 -Wno-all-missed-specialisations -Wno-missing-import-lists
+                 -Wno-missing-local-signatures -Wno-monomorphism-restriction
+                 -fno-warn-name-shadowing
     build-depends:
         Cabal ^>=2.2,
-        base ^>=4.10 || ^>=4.11,
+        base ^>=4.10 || ^>=4.11 || ^>=4.12,
         bytestring ^>=0.10,
-        containers ^>=0.5,
-        contravariant ^>=1.4,
-        dhall ^>=1.14.0,
-        formatting ^>=6.3.1,
+        containers ^>=0.5 || ^>=0.6,
+        contravariant ^>=1.4 || ^>=1.5,
+        dhall ^>=1.15.0,
         hashable ^>=1.2.6.1,
         insert-ordered-containers ^>=0.2.1.0,
         text ^>=1.2,
@@ -136,12 +142,21 @@
 executable dhall-to-cabal
     main-is: Main.hs
     hs-source-dirs: exe
+    other-modules:
+        Paths_dhall_to_cabal
+    autogen-modules:
+        Paths_dhall_to_cabal
     default-language: Haskell2010
     other-extensions: NamedFieldPuns
+    ghc-options: -Weverything -Wno-safe -Wno-unsafe
+                 -Wno-implicit-prelude -Wno-missed-specialisations
+                 -Wno-all-missed-specialisations -Wno-missing-import-lists
+                 -Wno-missing-local-signatures -Wno-monomorphism-restriction
+                 -fno-warn-name-shadowing
     build-depends:
         Cabal ^>=2.2,
-        base ^>=4.10 || ^>=4.11,
-        dhall ^>=1.14.0,
+        base ^>=4.10 || ^>=4.11 || ^>=4.12,
+        dhall ^>=1.15.0,
         dhall-to-cabal -any,
         insert-ordered-containers ^>=0.2.1.0,
         optparse-applicative ^>=0.13.2 || ^>=0.14,
@@ -152,11 +167,20 @@
 executable cabal-to-dhall
     main-is: Main.hs
     hs-source-dirs: cabal-to-dhall
+    other-modules:
+        Paths_dhall_to_cabal
+    autogen-modules:
+        Paths_dhall_to_cabal
     default-language: Haskell2010
     other-extensions: NamedFieldPuns
+    ghc-options: -Weverything -Wno-safe -Wno-unsafe
+                 -Wno-implicit-prelude -Wno-missed-specialisations
+                 -Wno-all-missed-specialisations -Wno-missing-import-lists
+                 -Wno-missing-local-signatures -Wno-monomorphism-restriction
+                 -fno-warn-name-shadowing
     build-depends:
-        base ^>=4.10 || ^>=4.11,
-        dhall ^>=1.14.0,
+        base ^>=4.10 || ^>=4.11 || ^>=4.12,
+        dhall ^>=1.15.0,
         bytestring ^>=0.10,
         dhall-to-cabal -any,
         optparse-applicative ^>=0.13.2 || ^>=0.14,
@@ -168,12 +192,17 @@
     main-is: GoldenTests.hs
     hs-source-dirs: golden-tests
     default-language: Haskell2010
+    ghc-options: -Weverything -Wno-safe -Wno-unsafe
+                 -Wno-implicit-prelude -Wno-missed-specialisations
+                 -Wno-all-missed-specialisations -Wno-missing-import-lists
+                 -Wno-missing-local-signatures -Wno-monomorphism-restriction
+                 -fno-warn-name-shadowing
     build-depends:
-        base ^>=4.10 || ^>=4.11,
+        base ^>=4.10 || ^>=4.11 || ^>=4.12,
         Cabal ^>=2.2,
         Diff ^>=0.3.4,
         bytestring ^>=0.10,
-        dhall ^>=1.14.0,
+        dhall ^>=1.15.0,
         dhall-to-cabal -any,
         filepath ^>=1.4,
         prettyprinter ^>=1.2.0.1,
diff --git a/dhall/GitHub-project.dhall b/dhall/GitHub-project.dhall
deleted file mode 100644
--- a/dhall/GitHub-project.dhall
+++ /dev/null
@@ -1,26 +0,0 @@
-    let GitHubProject : Type = { owner : Text, repo : Text }
-
-in  let gitHubProject =
-            λ(github : GitHubProject)
-          →     let gitHubRoot =
-                      "https://github.com/${github.owner}/${github.repo}"
-            
-            in    ./defaults/Package.dhall 
-                ⫽ { name =
-                      github.repo
-                  , bug-reports =
-                      "${gitHubRoot}/issues"
-                  , homepage =
-                      gitHubRoot
-                  , source-repos =
-                      [   ./defaults/SourceRepo.dhall 
-                        ⫽ { location =
-                              [ gitHubRoot ] : Optional Text
-                          , type =
-                              [ (constructors ./types/RepoType.dhall ).Git {=}
-                              ] : Optional ./types/RepoType.dhall 
-                          }
-                      ]
-                  }
-
-in  gitHubProject
diff --git a/dhall/SPDX/and.dhall b/dhall/SPDX/and.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/SPDX/and.dhall
@@ -0,0 +1,30 @@
+   let LicenseId = ../types/SPDX/LicenseId.dhall
+in let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall
+in   λ(a : ../types/SPDX.dhall )
+   → λ(b : ../types/SPDX.dhall )
+   → λ(SPDX : Type)
+   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
+   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
+   → λ(and : SPDX → SPDX → SPDX)
+   → λ(or : SPDX → SPDX → SPDX)
+   → and
+     ( a
+       SPDX
+       license
+       licenseVersionOrLater
+       ref
+       refWithFile
+       and
+       or
+     )
+     ( b
+       SPDX
+       license
+       licenseVersionOrLater
+       ref
+       refWithFile
+       and
+       or
+     )
diff --git a/dhall/SPDX/license.dhall b/dhall/SPDX/license.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/SPDX/license.dhall
@@ -0,0 +1,12 @@
+   let LicenseId = ../types/SPDX/LicenseId.dhall
+in let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall
+in   λ(licenseId : LicenseId )
+   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
+   → λ(SPDX : Type)
+   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
+   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
+   → λ(and : SPDX → SPDX → SPDX)
+   → λ(or : SPDX → SPDX → SPDX)
+   → license licenseId licenseExceptionIdOpt
diff --git a/dhall/SPDX/licenseVersionOrLater.dhall b/dhall/SPDX/licenseVersionOrLater.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/SPDX/licenseVersionOrLater.dhall
@@ -0,0 +1,12 @@
+   let LicenseId = ../types/SPDX/LicenseId.dhall
+in let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall
+in   λ(licenseId : LicenseId )
+   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
+   → λ(SPDX : Type)
+   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
+   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
+   → λ(and : SPDX → SPDX → SPDX)
+   → λ(or : SPDX → SPDX → SPDX)
+   → licenseVersionOrLater licenseId licenseExceptionIdOpt
diff --git a/dhall/SPDX/or.dhall b/dhall/SPDX/or.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/SPDX/or.dhall
@@ -0,0 +1,30 @@
+   let LicenseId = ../types/SPDX/LicenseId.dhall
+in let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall
+in   λ(a : ../types/SPDX.dhall )
+   → λ(b : ../types/SPDX.dhall )
+   → λ(SPDX : Type)
+   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
+   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
+   → λ(and : SPDX → SPDX → SPDX)
+   → λ(or : SPDX → SPDX → SPDX)
+   → or
+     ( a
+       SPDX
+       license
+       licenseVersionOrLater
+       ref
+       refWithFile
+       and
+       or
+     )
+     ( b
+       SPDX
+       license
+       licenseVersionOrLater
+       ref
+       refWithFile
+       and
+       or
+     )
diff --git a/dhall/SPDX/ref.dhall b/dhall/SPDX/ref.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/SPDX/ref.dhall
@@ -0,0 +1,12 @@
+   let LicenseId = ../types/SPDX/LicenseId.dhall
+in let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall
+in   λ(refName : Text)
+   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
+   → λ(SPDX : Type)
+   → λ(version : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(versionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
+   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
+   → λ(and : SPDX → SPDX → SPDX)
+   → λ(or : SPDX → SPDX → SPDX)
+   → ref refName licenseExceptionIdOpt
diff --git a/dhall/SPDX/refWithFile.dhall b/dhall/SPDX/refWithFile.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/SPDX/refWithFile.dhall
@@ -0,0 +1,13 @@
+   let LicenseId = ../types/SPDX/LicenseId.dhall
+in let LicenseExceptionId = ../types/SPDX/LicenseExceptionId.dhall
+in   λ(refName : Text)
+   → λ(file : Text)
+   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
+   → λ(SPDX : Type)
+   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
+   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
+   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
+   → λ(and : SPDX → SPDX → SPDX)
+   → λ(or : SPDX → SPDX → SPDX)
+   → refWithFile refName file licenseExceptionIdOpt
diff --git a/dhall/Version/v.dhall b/dhall/Version/v.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/Version/v.dhall
@@ -0,0 +1,5 @@
+    let v
+        : ∀(str : Text) → ../types/Version.dhall 
+        = λ(str : Text) → λ(Version : Type) → λ(v : Text → Version) → v str
+
+in  v
diff --git a/dhall/VersionRange/anyVersion.dhall b/dhall/VersionRange/anyVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/anyVersion.dhall
@@ -0,0 +1,16 @@
+  λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ anyVersion
diff --git a/dhall/VersionRange/differenceVersionRanges.dhall b/dhall/VersionRange/differenceVersionRanges.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/differenceVersionRanges.dhall
@@ -0,0 +1,52 @@
+  λ(a : ../types/VersionRange.dhall )
+→ λ(b : ../types/VersionRange.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ DifferenceVersionRanges
+  ( a
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
+  ( b
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
diff --git a/dhall/VersionRange/earlierVersion.dhall b/dhall/VersionRange/earlierVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/earlierVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ earlierVersion v
diff --git a/dhall/VersionRange/intersectVersionRanges.dhall b/dhall/VersionRange/intersectVersionRanges.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/intersectVersionRanges.dhall
@@ -0,0 +1,52 @@
+  λ(a : ../types/VersionRange.dhall )
+→ λ(b : ../types/VersionRange.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ intersectVersionRanges
+  ( a
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
+  ( b
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
diff --git a/dhall/VersionRange/invertVersionRange.dhall b/dhall/VersionRange/invertVersionRange.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/invertVersionRange.dhall
@@ -0,0 +1,34 @@
+  λ(a : ../types/VersionRange.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ invertVersionRange
+  ( a
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
diff --git a/dhall/VersionRange/laterVersion.dhall b/dhall/VersionRange/laterVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/laterVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ laterVersion v
diff --git a/dhall/VersionRange/majorBoundVersion.dhall b/dhall/VersionRange/majorBoundVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/majorBoundVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ majorBoundVersion v
diff --git a/dhall/VersionRange/noVersion.dhall b/dhall/VersionRange/noVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/noVersion.dhall
@@ -0,0 +1,16 @@
+  λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ noVersion
diff --git a/dhall/VersionRange/notThisVersion.dhall b/dhall/VersionRange/notThisVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/notThisVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ notThisVersion v
diff --git a/dhall/VersionRange/orEarlierVersion.dhall b/dhall/VersionRange/orEarlierVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/orEarlierVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ orEarlierVersion v
diff --git a/dhall/VersionRange/orLaterVersion.dhall b/dhall/VersionRange/orLaterVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/orLaterVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ orLaterVersion v
diff --git a/dhall/VersionRange/thisVersion.dhall b/dhall/VersionRange/thisVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/thisVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ thisVersion v
diff --git a/dhall/VersionRange/unionVersionRanges.dhall b/dhall/VersionRange/unionVersionRanges.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/unionVersionRanges.dhall
@@ -0,0 +1,52 @@
+  λ(a : ../types/VersionRange.dhall )
+→ λ(b : ../types/VersionRange.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ unionVersionRanges
+  ( a
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
+  ( b
+    VersionRange
+    anyVersion
+    noVersion
+    thisVersion
+    notThisVersion
+    laterVersion
+    earlierVersion
+    orLaterVersion
+    orEarlierVersion
+    withinVersion
+    majorBoundVersion
+    unionVersionRanges
+    intersectVersionRanges
+    differenceVersionRanges
+    invertVersionRange
+  )
diff --git a/dhall/VersionRange/withinVersion.dhall b/dhall/VersionRange/withinVersion.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/VersionRange/withinVersion.dhall
@@ -0,0 +1,17 @@
+  λ(v : ../types/Version.dhall )
+→ λ(VersionRange : Type)
+→ λ(anyVersion : VersionRange)
+→ λ(noVersion : VersionRange)
+→ λ(thisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(notThisVersion : ../types/Version.dhall  → VersionRange)
+→ λ(laterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(earlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orLaterVersion : ../types/Version.dhall  → VersionRange)
+→ λ(orEarlierVersion : ../types/Version.dhall  → VersionRange)
+→ λ(withinVersion : ../types/Version.dhall  → VersionRange)
+→ λ(majorBoundVersion : ../types/Version.dhall  → VersionRange)
+→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
+→ λ(invertVersionRange : VersionRange → VersionRange)
+→ withinVersion v
diff --git a/dhall/defaults/Library.dhall b/dhall/defaults/Library.dhall
--- a/dhall/defaults/Library.dhall
+++ b/dhall/defaults/Library.dhall
@@ -1,8 +1,6 @@
   ./BuildInfo.dhall 
 ⫽ { exposed-modules =
       [] : List Text
-  , other-modules =
-      [] : List Text
   , reexported-modules =
       [] : List
            { name : Text, original : { name : Text, package : Optional Text } }
diff --git a/dhall/defaults/Package.dhall b/dhall/defaults/Package.dhall
--- a/dhall/defaults/Package.dhall
+++ b/dhall/defaults/Package.dhall
@@ -12,10 +12,9 @@
 , bug-reports =
     ""
 , build-type =
-    [ (constructors ../types/BuildType.dhall ).Simple {=}
-    ] : Optional ../types/BuildType.dhall 
+    [] : Optional ../types/BuildType.dhall
 , cabal-version =
-    ../types/Version/v.dhall  "2.0"
+    ../Version/v.dhall  "2.2"
 , category =
     ""
 , copyright =
@@ -51,7 +50,7 @@
 , library =
     [] : Optional (../types/Guarded.dhall  ../types/Library.dhall )
 , license =
-    (constructors ../types/License.dhall ).Unspecified {=}
+    (constructors ../types/License.dhall ).AllRightsReserved {=}
 , license-files =
     [] : List Text
 , maintainer =
diff --git a/dhall/prelude.dhall b/dhall/prelude.dhall
--- a/dhall/prelude.dhall
+++ b/dhall/prelude.dhall
@@ -1,14 +1,14 @@
 { types =
     { BuildTypes =
-        constructors ./types/BuildType.dhall 
+        constructors ./types/BuildType.dhall
     , OSs =
-        constructors ./types/OS.dhall 
+        constructors ./types/OS.dhall
     , Compilers =
-        constructors ./types/Compiler.dhall 
+        constructors ./types/Compiler.dhall
     , Extensions =
-        constructors ./types/Extension.dhall 
+        constructors ./types/Extension.dhall
     , Languages =
-        constructors ./types/Language.dhall 
+        constructors ./types/Language.dhall
     , Licenses =
         constructors ./types/License.dhall
     , LicenseExceptionId =
@@ -16,118 +16,73 @@
     , LicenseId =
         constructors ./types/SPDX/LicenseId.dhall
     , TestTypes =
-        constructors ./types/TestType.dhall 
+        constructors ./types/TestType.dhall
+    , RepoType =
+        constructors ./types/RepoType.dhall
+    , RepoKind =
+        constructors ./types/RepoKind.dhall
+    , Scopes =
+        constructors ./types/Scope.dhall
     }
 , defaults =
     { CompilerOptions =
-        ./defaults/CompilerOptions.dhall 
+        ./defaults/CompilerOptions.dhall
     , Library =
-        ./defaults/Library.dhall 
+        ./defaults/Library.dhall
     , Benchmark =
-        ./defaults/Benchmark.dhall 
+        ./defaults/Benchmark.dhall
     , Executable =
-        ./defaults/Executable.dhall 
+        ./defaults/Executable.dhall
     , Package =
-        ./defaults/Package.dhall 
+        ./defaults/Package.dhall
     , SourceRepo =
-        ./defaults/SourceRepo.dhall 
+        ./defaults/SourceRepo.dhall
     , TestSuite =
-        ./defaults/TestSuite.dhall 
+        ./defaults/TestSuite.dhall
     }
 , anyVersion =
-    ./types/VersionRange/AnyVersion.dhall 
+    ./VersionRange/anyVersion.dhall 
 , earlierVersion =
-    ./types/VersionRange/EarlierVersion.dhall 
+    ./VersionRange/earlierVersion.dhall 
 , orEarlierVersion =
-    ./types/VersionRange/OrEarlierVersion.dhall 
+    ./VersionRange/orEarlierVersion.dhall 
 , intersectVersionRanges =
-    ./types/VersionRange/IntersectVersionRanges.dhall 
+    ./VersionRange/intersectVersionRanges.dhall 
 , unionVersionRanges =
-    ./types/VersionRange/UnionVersionRanges.dhall 
+    ./VersionRange/unionVersionRanges.dhall 
 , majorBoundVersion =
-    ./types/VersionRange/MajorBoundVersion.dhall 
+    ./VersionRange/majorBoundVersion.dhall 
 , orLaterVersion =
-    ./types/VersionRange/OrLaterVersion.dhall 
+    ./VersionRange/orLaterVersion.dhall 
 , laterVersion =
-    ./types/VersionRange/LaterVersion.dhall 
+    ./VersionRange/laterVersion.dhall 
 , thisVersion =
-    ./types/VersionRange/ThisVersion.dhall 
+    ./VersionRange/thisVersion.dhall 
 , notThisVersion =
-    ./types/VersionRange/NotThisVersion.dhall 
+    ./VersionRange/notThisVersion.dhall 
 , withinVersion =
-    ./types/VersionRange/WithinVersion.dhall 
+    ./VersionRange/withinVersion.dhall 
 , v =
-    ./types/Version/v.dhall 
+    ./Version/v.dhall 
 , noVersion =
-    ./types/VersionRange/NoVersion.dhall 
+    ./VersionRange/noVersion.dhall 
 , utils =
-    { majorVersions =
-            let majorVersions
-                :   Text
-                  → List ./types/Version.dhall 
-                  → { package : Text, bounds : ./types/VersionRange.dhall  }
-                =   λ ( package
-                      : Text
-                      )
-                  → λ(versions : List ./types/Version.dhall )
-                  → { package =
-                        package
-                    , bounds =
-                        Optional/fold
-                        ./types/VersionRange.dhall 
-                        ( List/fold
-                          ./types/Version.dhall 
-                          versions
-                          (Optional ./types/VersionRange.dhall )
-                          (   λ ( v
-                                : ./types/Version.dhall 
-                                )
-                            → λ(r : Optional ./types/VersionRange.dhall )
-                            → Optional/fold
-                              ./types/VersionRange.dhall 
-                              r
-                              (Optional ./types/VersionRange.dhall )
-                              (   λ ( r
-                                    : ./types/VersionRange.dhall 
-                                    )
-                                → [ ./types/VersionRange/UnionVersionRanges.dhall 
-                                    ( ./types/VersionRange/MajorBoundVersion.dhall 
-                                      v
-                                    )
-                                    r
-                                  ] : Optional ./types/VersionRange.dhall 
-                              )
-                              ( [ ./types/VersionRange/MajorBoundVersion.dhall 
-                                  v
-                                ] : Optional ./types/VersionRange.dhall 
-                              )
-                          )
-                          ([] : Optional ./types/VersionRange.dhall )
-                        )
-                        ./types/VersionRange.dhall 
-                        (λ(a : ./types/VersionRange.dhall ) → a)
-                        ./types/VersionRange/NoVersion.dhall 
-                    }
-        
-        in  majorVersions
-    , GitHub-project =
-        ./GitHub-project.dhall 
-    }
+    ./utils/package.dhall
 , unconditional =
     ./unconditional.dhall
 , SPDX =
     { license =
-        ./types/SPDX/License.dhall
+        ./SPDX/license.dhall
     , licenseVersionOrLater =
-        ./types/SPDX/LicenseVersionOrLater.dhall
+        ./SPDX/licenseVersionOrLater.dhall
     , ref =
-        ./types/SPDX/Ref.dhall
+        ./SPDX/ref.dhall
     , refWithFile =
-        ./types/SPDX/RefWithFile.dhall
+        ./SPDX/refWithFile.dhall
     , and =
-        ./types/SPDX/And.dhall
+        ./SPDX/and.dhall
     , or =
-        ./types/SPDX/Or.dhall
+        ./SPDX/or.dhall
     , noException =
         [] : Optional ./types/SPDX/LicenseExceptionId.dhall
     }
diff --git a/dhall/types.dhall b/dhall/types.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/types.dhall
@@ -0,0 +1,67 @@
+{ Arch =
+    ./types/Arch.dhall
+, Benchmark =
+    ./types/Benchmark.dhall
+, BuildType =
+    ./types/BuildType.dhall
+, Compiler =
+    ./types/Compiler.dhall
+, CompilerOptions =
+    ./types/CompilerOptions.dhall
+, Config =
+    ./types/Config.dhall
+, CustomSetup =
+    ./types/CustomSetup.dhall
+, Dependency =
+    ./types/Dependency.dhall
+, Executable =
+    ./types/Executable.dhall
+, Extension =
+    ./types/Extension.dhall
+, Extensions =
+    ./types/Extension.dhall
+, Flag =
+    ./types/Flag.dhall
+, ForeignLibrary =
+    ./types/ForeignLibrary.dhall
+, Language =
+    ./types/Language.dhall
+, Languages =
+    ./types/Language.dhall
+, Library =
+    ./types/Library.dhall
+, License =
+    ./types/License.dhall
+, LicenseExceptionId =
+    ./types/SPDX/LicenseExceptionId.dhall
+, LicenseId =
+    ./types/SPDX/LicenseId.dhall
+, Mixin =
+    ./types/Mixin.dhall
+, ModuleRenaming =
+    ./types/ModuleRenaming.dhall
+, OS =
+    ./types/OS.dhall
+, Package =
+    ./types/Package.dhall
+, RepoKind =
+    ./types/RepoKind.dhall
+, RepoType =
+    ./types/RepoType.dhall
+, Scope =
+    ./types/Scope.dhall
+, SetupBuildInfo =
+    ./types/SetupBuildInfo.dhall
+, SPDX =
+    ./types/SPDX.dhall
+, SourceRepo =
+    ./types/SourceRepo.dhall
+, TestSuite =
+    ./types/TestSuite.dhall
+, TestType =
+    ./types/TestType.dhall
+, Version =
+    ./types/Version.dhall
+, VersionRange =
+    ./types/VersionRange.dhall
+}
diff --git a/dhall/types/SPDX/And.dhall b/dhall/types/SPDX/And.dhall
deleted file mode 100644
--- a/dhall/types/SPDX/And.dhall
+++ /dev/null
@@ -1,30 +0,0 @@
-   let LicenseId = ./LicenseId.dhall
-in let LicenseExceptionId = ./LicenseExceptionId.dhall
-in   λ(a : ../SPDX.dhall )
-   → λ(b : ../SPDX.dhall )
-   → λ(SPDX : Type)
-   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
-   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
-   → λ(and : SPDX → SPDX → SPDX)
-   → λ(or : SPDX → SPDX → SPDX)
-   → and
-     ( a
-       SPDX
-       license
-       licenseVersionOrLater
-       ref
-       refWithFile
-       and
-       or
-     )
-     ( b
-       SPDX
-       license
-       licenseVersionOrLater
-       ref
-       refWithFile
-       and
-       or
-     )
diff --git a/dhall/types/SPDX/License.dhall b/dhall/types/SPDX/License.dhall
deleted file mode 100644
--- a/dhall/types/SPDX/License.dhall
+++ /dev/null
@@ -1,12 +0,0 @@
-   let LicenseId = ./LicenseId.dhall
-in let LicenseExceptionId = ./LicenseExceptionId.dhall
-in   λ(licenseId : LicenseId )
-   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
-   → λ(SPDX : Type)
-   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
-   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
-   → λ(and : SPDX → SPDX → SPDX)
-   → λ(or : SPDX → SPDX → SPDX)
-   → license licenseId licenseExceptionIdOpt
diff --git a/dhall/types/SPDX/LicenseVersionOrLater.dhall b/dhall/types/SPDX/LicenseVersionOrLater.dhall
deleted file mode 100644
--- a/dhall/types/SPDX/LicenseVersionOrLater.dhall
+++ /dev/null
@@ -1,12 +0,0 @@
-   let LicenseId = ./LicenseId.dhall
-in let LicenseExceptionId = ./LicenseExceptionId.dhall
-in   λ(licenseId : LicenseId )
-   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
-   → λ(SPDX : Type)
-   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
-   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
-   → λ(and : SPDX → SPDX → SPDX)
-   → λ(or : SPDX → SPDX → SPDX)
-   → licenseVersionOrLater licenseId licenseExceptionIdOpt
diff --git a/dhall/types/SPDX/Or.dhall b/dhall/types/SPDX/Or.dhall
deleted file mode 100644
--- a/dhall/types/SPDX/Or.dhall
+++ /dev/null
@@ -1,30 +0,0 @@
-   let LicenseId = ./LicenseId.dhall
-in let LicenseExceptionId = ./LicenseExceptionId.dhall
-in   λ(a : ../SPDX.dhall )
-   → λ(b : ../SPDX.dhall )
-   → λ(SPDX : Type)
-   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
-   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
-   → λ(and : SPDX → SPDX → SPDX)
-   → λ(or : SPDX → SPDX → SPDX)
-   → or
-     ( a
-       SPDX
-       license
-       licenseVersionOrLater
-       ref
-       refWithFile
-       and
-       or
-     )
-     ( b
-       SPDX
-       license
-       licenseVersionOrLater
-       ref
-       refWithFile
-       and
-       or
-     )
diff --git a/dhall/types/SPDX/Ref.dhall b/dhall/types/SPDX/Ref.dhall
deleted file mode 100644
--- a/dhall/types/SPDX/Ref.dhall
+++ /dev/null
@@ -1,12 +0,0 @@
-   let LicenseId = ./LicenseId.dhall
-in let LicenseExceptionId = ./LicenseExceptionId.dhall
-in   λ(refName : Text)
-   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
-   → λ(SPDX : Type)
-   → λ(version : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(versionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
-   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
-   → λ(and : SPDX → SPDX → SPDX)
-   → λ(or : SPDX → SPDX → SPDX)
-   → ref refName licenseExceptionIdOpt
diff --git a/dhall/types/SPDX/RefWithFile.dhall b/dhall/types/SPDX/RefWithFile.dhall
deleted file mode 100644
--- a/dhall/types/SPDX/RefWithFile.dhall
+++ /dev/null
@@ -1,13 +0,0 @@
-   let LicenseId = ./LicenseId.dhall
-in let LicenseExceptionId = ./LicenseExceptionId.dhall
-in   λ(refName : Text)
-   → λ(file : Text)
-   → λ(licenseExceptionIdOpt : Optional LicenseExceptionId )
-   → λ(SPDX : Type)
-   → λ(license : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(licenseVersionOrLater : LicenseId → Optional LicenseExceptionId → SPDX)
-   → λ(ref : Text → Optional LicenseExceptionId → SPDX)
-   → λ(refWithFile : Text → Text → Optional LicenseExceptionId → SPDX)
-   → λ(and : SPDX → SPDX → SPDX)
-   → λ(or : SPDX → SPDX → SPDX)
-   → refWithFile refName file licenseExceptionIdOpt
diff --git a/dhall/types/Version/v.dhall b/dhall/types/Version/v.dhall
deleted file mode 100644
--- a/dhall/types/Version/v.dhall
+++ /dev/null
@@ -1,5 +0,0 @@
-    let v
-        : ∀(str : Text) → ../Version.dhall 
-        = λ(str : Text) → λ(Version : Type) → λ(v : Text → Version) → v str
-
-in  v
diff --git a/dhall/types/VersionRange/AnyVersion.dhall b/dhall/types/VersionRange/AnyVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/AnyVersion.dhall
+++ /dev/null
@@ -1,16 +0,0 @@
-  λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ anyVersion
diff --git a/dhall/types/VersionRange/DifferenceVersionRanges.dhall b/dhall/types/VersionRange/DifferenceVersionRanges.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/DifferenceVersionRanges.dhall
+++ /dev/null
@@ -1,52 +0,0 @@
-  λ(a : ../VersionRange.dhall )
-→ λ(b : ../VersionRange.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ DifferenceVersionRanges
-  ( a
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
-  ( b
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
diff --git a/dhall/types/VersionRange/EarlierVersion.dhall b/dhall/types/VersionRange/EarlierVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/EarlierVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ earlierVersion v
diff --git a/dhall/types/VersionRange/IntersectVersionRanges.dhall b/dhall/types/VersionRange/IntersectVersionRanges.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/IntersectVersionRanges.dhall
+++ /dev/null
@@ -1,52 +0,0 @@
-  λ(a : ../VersionRange.dhall )
-→ λ(b : ../VersionRange.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ intersectVersionRanges
-  ( a
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
-  ( b
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
diff --git a/dhall/types/VersionRange/InvertVersionRange.dhall b/dhall/types/VersionRange/InvertVersionRange.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/InvertVersionRange.dhall
+++ /dev/null
@@ -1,34 +0,0 @@
-  λ(a : ../VersionRange.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ invertVersionRange
-  ( a
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
diff --git a/dhall/types/VersionRange/LaterVersion.dhall b/dhall/types/VersionRange/LaterVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/LaterVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ laterVersion v
diff --git a/dhall/types/VersionRange/MajorBoundVersion.dhall b/dhall/types/VersionRange/MajorBoundVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/MajorBoundVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ majorBoundVersion v
diff --git a/dhall/types/VersionRange/NoVersion.dhall b/dhall/types/VersionRange/NoVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/NoVersion.dhall
+++ /dev/null
@@ -1,16 +0,0 @@
-  λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ noVersion
diff --git a/dhall/types/VersionRange/NotThisVersion.dhall b/dhall/types/VersionRange/NotThisVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/NotThisVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ notThisVersion v
diff --git a/dhall/types/VersionRange/OrEarlierVersion.dhall b/dhall/types/VersionRange/OrEarlierVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/OrEarlierVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ orEarlierVersion v
diff --git a/dhall/types/VersionRange/OrLaterVersion.dhall b/dhall/types/VersionRange/OrLaterVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/OrLaterVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ orLaterVersion v
diff --git a/dhall/types/VersionRange/ThisVersion.dhall b/dhall/types/VersionRange/ThisVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/ThisVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ thisVersion v
diff --git a/dhall/types/VersionRange/UnionVersionRanges.dhall b/dhall/types/VersionRange/UnionVersionRanges.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/UnionVersionRanges.dhall
+++ /dev/null
@@ -1,52 +0,0 @@
-  λ(a : ../VersionRange.dhall )
-→ λ(b : ../VersionRange.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ unionVersionRanges
-  ( a
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
-  ( b
-    VersionRange
-    anyVersion
-    noVersion
-    thisVersion
-    notThisVersion
-    laterVersion
-    earlierVersion
-    orLaterVersion
-    orEarlierVersion
-    withinVersion
-    majorBoundVersion
-    unionVersionRanges
-    intersectVersionRanges
-    differenceVersionRanges
-    invertVersionRange
-  )
diff --git a/dhall/types/VersionRange/WithinVersion.dhall b/dhall/types/VersionRange/WithinVersion.dhall
deleted file mode 100644
--- a/dhall/types/VersionRange/WithinVersion.dhall
+++ /dev/null
@@ -1,17 +0,0 @@
-  λ(v : ../Version.dhall )
-→ λ(VersionRange : Type)
-→ λ(anyVersion : VersionRange)
-→ λ(noVersion : VersionRange)
-→ λ(thisVersion : ../Version.dhall  → VersionRange)
-→ λ(notThisVersion : ../Version.dhall  → VersionRange)
-→ λ(laterVersion : ../Version.dhall  → VersionRange)
-→ λ(earlierVersion : ../Version.dhall  → VersionRange)
-→ λ(orLaterVersion : ../Version.dhall  → VersionRange)
-→ λ(orEarlierVersion : ../Version.dhall  → VersionRange)
-→ λ(withinVersion : ../Version.dhall  → VersionRange)
-→ λ(majorBoundVersion : ../Version.dhall  → VersionRange)
-→ λ(unionVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(intersectVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(differenceVersionRanges : VersionRange → VersionRange → VersionRange)
-→ λ(invertVersionRange : VersionRange → VersionRange)
-→ withinVersion v
diff --git a/dhall/utils/GitHub-project.dhall b/dhall/utils/GitHub-project.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/utils/GitHub-project.dhall
@@ -0,0 +1,26 @@
+    let GitHubProject : Type = { owner : Text, repo : Text }
+
+in  let gitHubProject =
+            λ(github : GitHubProject)
+          →     let gitHubRoot =
+                      "https://github.com/${github.owner}/${github.repo}"
+            
+            in    ../defaults/Package.dhall 
+                ⫽ { name =
+                      github.repo
+                  , bug-reports =
+                      "${gitHubRoot}/issues"
+                  , homepage =
+                      gitHubRoot
+                  , source-repos =
+                      [   ../defaults/SourceRepo.dhall 
+                        ⫽ { location =
+                              [ gitHubRoot ] : Optional Text
+                          , type =
+                              [ (constructors ../types/RepoType.dhall ).Git {=}
+                              ] : Optional ../types/RepoType.dhall 
+                          }
+                      ]
+                  }
+
+in  gitHubProject
diff --git a/dhall/utils/majorVersions.dhall b/dhall/utils/majorVersions.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/utils/majorVersions.dhall
@@ -0,0 +1,52 @@
+   let Version =
+        ../types/Version.dhall
+in let VersionRange =
+        ../types/VersionRange.dhall
+in let Versions =  
+        { unionVersionRanges =
+            ../VersionRange/unionVersionRanges.dhall
+        , majorBoundVersion =
+            ../VersionRange/majorBoundVersion.dhall
+        , noVersion =
+            ../VersionRange/noVersion.dhall
+        }
+
+in let majorVersions
+        :   Text
+          → List Version 
+          → { package : Text, bounds : VersionRange  }
+        =   λ(package : Text)
+          → λ(versions : List Version )
+          → { package =
+                package
+            , bounds =
+                Optional/fold
+                VersionRange 
+                ( List/fold
+                  Version 
+                  versions
+                  (Optional VersionRange )
+                  (   λ(v : Version )
+                    → λ(r : Optional VersionRange )
+                    → Optional/fold
+                      VersionRange 
+                      r
+                      (Optional VersionRange )
+                      (   λ(r : VersionRange )
+                        → [ Versions.unionVersionRanges 
+                            ( Versions.majorBoundVersion  v )
+                            r
+                          ] : Optional VersionRange 
+                      )
+                      ( [ Versions.majorBoundVersion  v
+                        ] : Optional VersionRange 
+                      )
+                  )
+                  ([] : Optional VersionRange )
+                )
+                VersionRange 
+                (λ(a : VersionRange ) → a)
+                Versions.noVersion 
+            }
+
+in  majorVersions
diff --git a/dhall/utils/mapSourceRepos.dhall b/dhall/utils/mapSourceRepos.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/utils/mapSourceRepos.dhall
@@ -0,0 +1,23 @@
+    let SourceRepo = ../types/SourceRepo.dhall
+
+in  let Package = ../types/Package.dhall
+
+in  let mapSourceRepos
+        : (SourceRepo → SourceRepo) → Package → Package
+        =   λ(f : SourceRepo → SourceRepo)
+          → λ(pkg : Package)
+          →   pkg
+            ⫽ { source-repos =
+                  List/build
+                  SourceRepo
+                  (   λ(list : Type)
+                    → λ(cons : SourceRepo → list → list)
+                    → List/fold
+                      SourceRepo
+                      pkg.source-repos
+                      list
+                      (λ(x : SourceRepo) → cons (f x))
+                  )
+              }
+
+in  mapSourceRepos
diff --git a/dhall/utils/package.dhall b/dhall/utils/package.dhall
new file mode 100644
--- /dev/null
+++ b/dhall/utils/package.dhall
@@ -0,0 +1,7 @@
+{ GitHub-project =
+    ./GitHub-project.dhall
+, majorVersions =
+    ./majorVersions.dhall
+, mapSourceRepos =
+    ./mapSourceRepos.dhall
+}
diff --git a/exe/Main.hs b/exe/Main.hs
--- a/exe/Main.hs
+++ b/exe/Main.hs
@@ -7,39 +7,37 @@
 
 module Main ( main ) where
 
-import Control.Applicative ( (<**>), (<|>), Const(..), optional )
+import Control.Applicative ( (<**>), Const(..), optional )
 import Control.Monad ( guard )
 import Data.Char ( isAlphaNum )
 import Control.Monad.Trans.Class ( lift )
 import Control.Monad.Trans.State ( State, execState, get, modify, put )
 import Control.Monad.Trans.Writer ( WriterT, execWriterT, tell )
-import Data.Foldable ( asum, foldl', traverse_ )
+import Data.Foldable ( asum, traverse_ )
 import Data.Functor.Product ( Product(..) )
 import Data.Functor.Identity ( Identity(..) )
-import Data.Monoid ( Any(..), (<>) )
+import Data.Monoid ( Any(..) )
 import Data.Function ( (&) )
 import Data.Maybe ( fromMaybe )
-import Data.Text.Lazy (Text)
-import System.Environment ( getArgs )
+import Data.Text (Text)
 import Data.String ( fromString )
+import Data.Version ( showVersion )
 
 import DhallLocation ( typesLocation, dhallFromGitHub )
 import DhallToCabal
+import qualified Paths_dhall_to_cabal as Paths
 
 import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
-import qualified Data.Text.Lazy.IO as LazyText
+import qualified Data.Text.IO as StrictText
 import qualified Data.Text.Prettyprint.Doc as Pretty
 import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
-import qualified Data.Text.Prettyprint.Doc.Symbols.Unicode as Pretty
 import qualified Dhall
-import qualified Dhall.Context
 import qualified Dhall.Core as Dhall
 import qualified Dhall.Core as Expr ( Expr(..), Var(..), shift )
 import qualified Distribution.PackageDescription as Cabal
 import qualified Dhall.Parser
 import qualified Dhall.TypeCheck as Dhall
 import qualified Distribution.PackageDescription.PrettyPrint as Cabal
-import qualified Distribution.Types.GenericPackageDescription as Cabal
 import qualified Distribution.Types.PackageId as Cabal
 import qualified Distribution.Types.PackageName as Cabal
 import qualified Options.Applicative as OptParse
@@ -49,6 +47,7 @@
 data Command
   = RunDhallToCabal DhallToCabalOptions
   | PrintType PrintTypeOptions
+  | PrintVersion
 
 
 
@@ -160,15 +159,26 @@
 
 
 
+printVersionParser :: OptParse.Parser ()
+printVersionParser =
+  OptParse.flag'
+    ()
+    ( mconcat
+      [ OptParse.long "version"
+      , OptParse.help "Display dhall-to-cabal's version and exit."
+      ]
+    )
+
+
 runDhallToCabal :: DhallToCabalOptions -> IO ()
 runDhallToCabal DhallToCabalOptions { dhallFilePath, explain } = do
   source <-
     case dhallFilePath of
       Nothing ->
-        LazyText.getContents
+        StrictText.getContents
 
       Just filePath ->
-        LazyText.readFile filePath
+        StrictText.readFile filePath
 
   let
     fileName = fromMaybe "(STDIN)" dhallFilePath
@@ -244,12 +254,16 @@
     PrintType options ->
       printType options
 
+    PrintVersion ->
+      printVersion
+
   where
 
   parser =
     asum
       [ RunDhallToCabal <$> dhallToCabalOptionsParser
       , PrintType <$> printTypeOptionsParser
+      , PrintVersion <$ printVersionParser
       ]
 
   opts =
@@ -272,9 +286,9 @@
 
 
 data CSEState a = CSEState
-  { factoredOutTypes :: [ ( KnownType, Expr.Expr Dhall.Parser.Src a ) ]
+  { _factoredOutTypes :: [ ( KnownType, Expr.Expr Dhall.Parser.Src a ) ]
     -- ^ Things we've already factored out (which may undergo further factoring themselves).
-  , rootType :: Expr.Expr Dhall.Parser.Src a
+  , _rootType :: Expr.Expr Dhall.Parser.Src a
     -- ^ The original type, which we started factoring things from.
   }
 
@@ -660,3 +674,8 @@
 
         Expr.OptionalBuild ->
           pure e
+
+
+printVersion :: IO ()
+printVersion = do
+  putStrLn ( "dhall-to-cabal version " ++ showVersion Paths.version )
diff --git a/golden-tests/GoldenTests.hs b/golden-tests/GoldenTests.hs
--- a/golden-tests/GoldenTests.hs
+++ b/golden-tests/GoldenTests.hs
@@ -1,29 +1,26 @@
 {-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ViewPatterns #-}
 module Main ( main ) where
 
 import Data.Algorithm.Diff
 import Data.Algorithm.DiffOutput
-import Data.Function ( on, (&) )
+import Data.Function ( (&) )
 import System.FilePath ( takeBaseName, replaceExtension )
 import Test.Tasty ( defaultMain, TestTree, testGroup )
 import Test.Tasty.Golden ( findByExtension, goldenVsStringDiff )
 import Test.Tasty.Golden.Advanced ( goldenTest )
 
 import qualified Data.ByteString as BS
-import qualified Data.ByteString.Lazy as LBS
-import qualified Data.Text.Lazy as LazyText
+import qualified Data.Text.IO as StrictText
 import qualified Data.Text.Lazy.Encoding as LazyText
-import qualified Data.Text.Lazy.IO as LazyText
 import qualified Data.Text.Prettyprint.Doc as Pretty
 import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
 import qualified Dhall.Core
-import qualified Distribution.PackageDescription.Configuration as Cabal
 import qualified Distribution.PackageDescription.Parsec as Cabal
 import qualified Distribution.PackageDescription.PrettyPrint as Cabal
-import qualified Distribution.PackageDescription as Cabal
 import qualified Distribution.Verbosity as Cabal
 
-import CabalToDhall ( cabalToDhall )
+import CabalToDhall ( cabalToDhall, parseGenericPackageDescriptionThrows )
 import DhallLocation ( DhallLocation ( DhallLocation ) )
 import DhallToCabal ( dhallToCabal )
 
@@ -43,9 +40,9 @@
               Nothing
           , Dhall.Core.importType =
               Dhall.Core.Local
-                Dhall.Core.Parent
+                Dhall.Core.Here
                 ( Dhall.Core.File
-                   ( Dhall.Core.Directory [ "dhall", ".." ] )
+                   ( Dhall.Core.Directory [ "dhall", "..", ".." ] )
                    "prelude.dhall"
                 )
           }
@@ -63,9 +60,9 @@
               Nothing
           , Dhall.Core.importType =
               Dhall.Core.Local
-                Dhall.Core.Parent
+                Dhall.Core.Here
                 ( Dhall.Core.File
-                   ( Dhall.Core.Directory [ "dhall", ".." ] )
+                   ( Dhall.Core.Directory [ "dhall", "..", ".." ] )
                    "types.dhall"
                 )
           }
@@ -94,10 +91,8 @@
           [ goldenTest
               ( takeBaseName dhallFile )
               ( Cabal.readGenericPackageDescription Cabal.normal cabalFile )
-              ( LazyText.readFile dhallFile >>= dhallToCabal dhallFile  )
-              ( \expected actual -> do
-                  let [exp,act] = map Cabal.showGenericPackageDescription
-                                  [expected, actual]
+              ( StrictText.readFile dhallFile >>= dhallToCabal dhallFile  )
+              ( \ ( Cabal.showGenericPackageDescription -> exp ) ( Cabal.showGenericPackageDescription -> act ) -> do
                   if exp == act then
                       return Nothing
                   else do
@@ -116,15 +111,13 @@
              ( takeBaseName cabalFile )
              ( \ ref new -> [ "diff", "-u", ref, new ] )
              dhallFile
-             ( BS.readFile cabalFile >>= cabalToDhall dhallLocation
+             ( BS.readFile cabalFile >>= parseGenericPackageDescriptionThrows
                  & fmap ( LazyText.encodeUtf8 . Pretty.renderLazy
                         . Pretty.layoutSmart layoutOpts . Pretty.pretty
+                        . cabalToDhall dhallLocation
                         )
              )
          | cabalFile <- cabalFiles
          , let dhallFile = replaceExtension cabalFile ".dhall"
          ]
     ]
-
-reverseArtifacts pkg =
-  pkg { Cabal.executables = reverse (Cabal.executables pkg) }
diff --git a/golden-tests/cabal-to-dhall/SPDX.cabal b/golden-tests/cabal-to-dhall/SPDX.cabal
--- a/golden-tests/cabal-to-dhall/SPDX.cabal
+++ b/golden-tests/cabal-to-dhall/SPDX.cabal
@@ -2,5 +2,4 @@
 name: foo
 version: 0
 license: (AGPL-3.0-or-later WITH Classpath-exception-2.0 OR Apache-2.0+) AND (LicenseRef-MyFancyLicense OR DocumentRef-LICENSE.txt:LicenseRef-MyFancierLicense)
-build-type: Simple
 
diff --git a/golden-tests/cabal-to-dhall/SPDX.dhall b/golden-tests/cabal-to-dhall/SPDX.dhall
--- a/golden-tests/cabal-to-dhall/SPDX.dhall
+++ b/golden-tests/cabal-to-dhall/SPDX.dhall
@@ -1,50 +1,15 @@
-    let prelude = ../../dhall/prelude.dhall 
+    let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ../../dhall/types.dhall 
+in  let types = ./../../dhall/types.dhall
 
-in  { author =
-        ""
-    , benchmarks =
-        [] : List { benchmark : types.Config → types.Benchmark, name : Text }
-    , bug-reports =
-        ""
-    , build-type =
-        [ prelude.types.BuildTypes.Simple {=} ] : Optional types.BuildType
-    , cabal-version =
-        prelude.v "2.2"
-    , category =
-        ""
-    , copyright =
-        ""
-    , custom-setup =
-        [] : Optional types.CustomSetup
-    , data-dir =
-        ""
-    , data-files =
-        [] : List Text
-    , description =
-        ""
-    , executables =
-        [] : List { executable : types.Config → types.Executable, name : Text }
-    , extra-doc-files =
-        [] : List Text
-    , extra-source-files =
-        [] : List Text
-    , extra-tmp-files =
-        [] : List Text
-    , flags =
-        [] : List
-             { default : Bool, description : Text, manual : Bool, name : Text }
-    , foreign-libraries =
-        [] : List
-             { foreign-lib : types.Config → types.ForeignLibrary, name : Text }
-    , homepage =
-        ""
-    , library =
-        [] : Optional (types.Config → types.Library)
-    , license =
-        < SPDX =
-            prelude.SPDX.and
+in    prelude.defaults.Package
+    ⫽ { name =
+          "foo"
+      , version =
+          prelude.v "0"
+      , license =
+          prelude.types.Licenses.SPDX
+          ( prelude.SPDX.and
             ( prelude.SPDX.or
               ( prelude.SPDX.license
                 (prelude.types.LicenseId.AGPL_3_0_or_later {=})
@@ -68,72 +33,5 @@
                 ([] : Optional types.LicenseExceptionId)
               )
             )
-        | GPL :
-            Optional types.Version
-        | AGPL :
-            Optional types.Version
-        | LGPL :
-            Optional types.Version
-        | BSD2 :
-            {}
-        | BSD3 :
-            {}
-        | BSD4 :
-            {}
-        | MIT :
-            {}
-        | ISC :
-            {}
-        | MPL :
-            types.Version
-        | Apache :
-            Optional types.Version
-        | PublicDomain :
-            {}
-        | AllRightsReserved :
-            {}
-        | Unspecified :
-            {}
-        | Other :
-            {}
-        >
-    , license-files =
-        [] : List Text
-    , maintainer =
-        ""
-    , name =
-        "foo"
-    , package-url =
-        ""
-    , source-repos =
-        [] : List
-             { branch :
-                 Optional Text
-             , kind :
-                 types.RepoKind
-             , location :
-                 Optional Text
-             , module :
-                 Optional Text
-             , subdir :
-                 Optional Text
-             , tag :
-                 Optional Text
-             , type :
-                 Optional types.RepoType
-             }
-    , stability =
-        ""
-    , sub-libraries =
-        [] : List { library : types.Config → types.Library, name : Text }
-    , synopsis =
-        ""
-    , test-suites =
-        [] : List { name : Text, test-suite : types.Config → types.TestSuite }
-    , tested-with =
-        [] : List { compiler : types.Compiler, version : types.VersionRange }
-    , version =
-        prelude.v "0"
-    , x-fields =
-        [] : List { _1 : Text, _2 : Text }
-    }
+          )
+      }
diff --git a/golden-tests/cabal-to-dhall/benchmark.cabal b/golden-tests/cabal-to-dhall/benchmark.cabal
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/benchmark.cabal
@@ -0,0 +1,8 @@
+cabal-version: 2.0
+name: blah
+version: 1
+
+benchmark fancy-benchmark
+  type: exitcode-stdio-1.0
+  main-is: Main.hs
+  ghc-options: -O2
diff --git a/golden-tests/cabal-to-dhall/benchmark.dhall b/golden-tests/cabal-to-dhall/benchmark.dhall
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/benchmark.dhall
@@ -0,0 +1,26 @@
+    let prelude = ./../../dhall/prelude.dhall
+
+in  let types = ./../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "blah"
+      , version =
+          prelude.v "1"
+      , benchmarks =
+          [ { benchmark =
+                  λ(config : types.Config)
+                →   prelude.defaults.Benchmark
+                  ⫽ { main-is =
+                        "Main.hs"
+                    , compiler-options =
+                          prelude.defaults.CompilerOptions
+                        ⫽ { GHC = [ "-O2" ] : List Text }
+                    }
+            , name =
+                "fancy-benchmark"
+            }
+          ]
+      , cabal-version =
+          prelude.v "2.0"
+      }
diff --git a/golden-tests/cabal-to-dhall/conditional-dependencies.cabal b/golden-tests/cabal-to-dhall/conditional-dependencies.cabal
--- a/golden-tests/cabal-to-dhall/conditional-dependencies.cabal
+++ b/golden-tests/cabal-to-dhall/conditional-dependencies.cabal
@@ -1,7 +1,6 @@
 name: Name
 version: 1
 cabal-version: 2.0
-build-type: Simple
 license: UnspecifiedLicense
 
 library
diff --git a/golden-tests/cabal-to-dhall/conditional-dependencies.dhall b/golden-tests/cabal-to-dhall/conditional-dependencies.dhall
--- a/golden-tests/cabal-to-dhall/conditional-dependencies.dhall
+++ b/golden-tests/cabal-to-dhall/conditional-dependencies.dhall
@@ -1,583 +1,64 @@
-    let prelude = ../../dhall/prelude.dhall 
+    let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ../../dhall/types.dhall 
+in  let types = ./../../dhall/types.dhall
 
-in  { author =
-        ""
-    , benchmarks =
-        [] : List { benchmark : types.Config → types.Benchmark, name : Text }
-    , bug-reports =
-        ""
-    , build-type =
-        [ prelude.types.BuildTypes.Simple {=} ] : Optional types.BuildType
-    , cabal-version =
-        prelude.v "2.0"
-    , category =
-        ""
-    , copyright =
-        ""
-    , custom-setup =
-        [] : Optional types.CustomSetup
-    , data-dir =
-        ""
-    , data-files =
-        [] : List Text
-    , description =
-        ""
-    , executables =
-        [] : List { executable : types.Config → types.Executable, name : Text }
-    , extra-doc-files =
-        [] : List Text
-    , extra-source-files =
-        [] : List Text
-    , extra-tmp-files =
-        [] : List Text
-    , flags =
-        [] : List
-             { default : Bool, description : Text, manual : Bool, name : Text }
-    , foreign-libraries =
-        [] : List
-             { foreign-lib : types.Config → types.ForeignLibrary, name : Text }
-    , homepage =
-        ""
-    , library =
-        [   λ(config : types.Config)
-          →       if    config.impl
-                        (prelude.types.Compilers.GHC {=})
-                        ( prelude.unionVersionRanges
-                          (prelude.thisVersion (prelude.v "8.2"))
-                          (prelude.laterVersion (prelude.v "8.2"))
-                        )
-                  then        if    config.impl
-                                    (prelude.types.Compilers.GHC {=})
-                                    ( prelude.unionVersionRanges
-                                      (prelude.thisVersion (prelude.v "8.4"))
-                                      (prelude.laterVersion (prelude.v "8.4"))
-                                    )
-                              then  { asm-options =
-                                        [] : List Text
-                                    , asm-sources =
-                                        [] : List Text
-                                    , autogen-modules =
-                                        [] : List Text
-                                    , build-depends =
-                                        [ { bounds =
-                                              prelude.anyVersion
-                                          , package =
-                                              "A"
-                                          }
-                                        , { bounds =
-                                              prelude.anyVersion
-                                          , package =
-                                              "B"
-                                          }
-                                        , { bounds =
-                                              prelude.anyVersion
-                                          , package =
-                                              "C"
-                                          }
-                                        ]
-                                    , build-tool-depends =
-                                        [] : List
-                                             { component :
-                                                 Text
-                                             , package :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , build-tools =
-                                        [] : List
-                                             { exe :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , buildable =
-                                        True
-                                    , c-sources =
-                                        [] : List Text
-                                    , cc-options =
-                                        [] : List Text
-                                    , cmm-options =
-                                        [] : List Text
-                                    , cmm-sources =
-                                        [] : List Text
-                                    , compiler-options =
-                                        prelude.defaults.CompilerOptions
-                                    , cpp-options =
-                                        [] : List Text
-                                    , cxx-options =
-                                        [] : List Text
-                                    , cxx-sources =
-                                        [] : List Text
-                                    , default-extensions =
-                                        [] : List types.Extension
-                                    , default-language =
-                                        [] : Optional types.Language
-                                    , exposed-modules =
-                                        [] : List Text
-                                    , extra-bundled-libs =
-                                        [] : List Text
-                                    , extra-framework-dirs =
-                                        [] : List Text
-                                    , extra-ghci-libraries =
-                                        [] : List Text
-                                    , extra-lib-dirs =
-                                        [] : List Text
-                                    , extra-lib-flavours =
-                                        [] : List Text
-                                    , extra-libraries =
-                                        [] : List Text
-                                    , frameworks =
-                                        [] : List Text
-                                    , hs-source-dirs =
-                                        [] : List Text
-                                    , include-dirs =
-                                        [] : List Text
-                                    , includes =
-                                        [] : List Text
-                                    , install-includes =
-                                        [] : List Text
-                                    , js-sources =
-                                        [] : List Text
-                                    , ld-options =
-                                        [] : List Text
-                                    , mixins =
-                                        [] : List types.Mixin
-                                    , other-extensions =
-                                        [] : List types.Extension
-                                    , other-languages =
-                                        [] : List types.Language
-                                    , other-modules =
-                                        [] : List Text
-                                    , pkgconfig-depends =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , profiling-options =
-                                        prelude.defaults.CompilerOptions
-                                    , reexported-modules =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , original :
-                                                 { name :
-                                                     Text
-                                                 , package :
-                                                     Optional Text
-                                                 }
-                                             }
-                                    , shared-options =
-                                        prelude.defaults.CompilerOptions
-                                    , signatures =
-                                        [] : List Text
-                                    , static-options =
-                                        prelude.defaults.CompilerOptions
-                                    , virtual-modules =
-                                        [] : List Text
-                                    }
-                        
-                        else  { asm-options =
-                                  [] : List Text
-                              , asm-sources =
-                                  [] : List Text
-                              , autogen-modules =
-                                  [] : List Text
-                              , build-depends =
-                                  [ { bounds =
-                                        prelude.anyVersion
-                                    , package =
-                                        "A"
-                                    }
-                                  , { bounds =
-                                        prelude.anyVersion
-                                    , package =
-                                        "B"
-                                    }
-                                  ]
-                              , build-tool-depends =
-                                  [] : List
-                                       { component :
-                                           Text
-                                       , package :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , build-tools =
-                                  [] : List
-                                       { exe :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , buildable =
-                                  True
-                              , c-sources =
-                                  [] : List Text
-                              , cc-options =
-                                  [] : List Text
-                              , cmm-options =
-                                  [] : List Text
-                              , cmm-sources =
-                                  [] : List Text
-                              , compiler-options =
-                                  prelude.defaults.CompilerOptions
-                              , cpp-options =
-                                  [] : List Text
-                              , cxx-options =
-                                  [] : List Text
-                              , cxx-sources =
-                                  [] : List Text
-                              , default-extensions =
-                                  [] : List types.Extension
-                              , default-language =
-                                  [] : Optional types.Language
-                              , exposed-modules =
-                                  [] : List Text
-                              , extra-bundled-libs =
-                                  [] : List Text
-                              , extra-framework-dirs =
-                                  [] : List Text
-                              , extra-ghci-libraries =
-                                  [] : List Text
-                              , extra-lib-dirs =
-                                  [] : List Text
-                              , extra-lib-flavours =
-                                  [] : List Text
-                              , extra-libraries =
-                                  [] : List Text
-                              , frameworks =
-                                  [] : List Text
-                              , hs-source-dirs =
-                                  [] : List Text
-                              , include-dirs =
-                                  [] : List Text
-                              , includes =
-                                  [] : List Text
-                              , install-includes =
-                                  [] : List Text
-                              , js-sources =
-                                  [] : List Text
-                              , ld-options =
-                                  [] : List Text
-                              , mixins =
-                                  [] : List types.Mixin
-                              , other-extensions =
-                                  [] : List types.Extension
-                              , other-languages =
-                                  [] : List types.Language
-                              , other-modules =
-                                  [] : List Text
-                              , pkgconfig-depends =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , profiling-options =
-                                  prelude.defaults.CompilerOptions
-                              , reexported-modules =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , original :
-                                           { name :
-                                               Text
-                                           , package :
-                                               Optional Text
-                                           }
-                                       }
-                              , shared-options =
-                                  prelude.defaults.CompilerOptions
-                              , signatures =
-                                  [] : List Text
-                              , static-options =
-                                  prelude.defaults.CompilerOptions
-                              , virtual-modules =
-                                  [] : List Text
-                              }
-            
-            else  if    config.impl
-                        (prelude.types.Compilers.GHC {=})
-                        ( prelude.unionVersionRanges
-                          (prelude.thisVersion (prelude.v "8.4"))
-                          (prelude.laterVersion (prelude.v "8.4"))
-                        )
-                  then  { asm-options =
-                            [] : List Text
-                        , asm-sources =
-                            [] : List Text
-                        , autogen-modules =
-                            [] : List Text
-                        , build-depends =
-                            [ { bounds = prelude.anyVersion, package = "A" }
-                            , { bounds = prelude.anyVersion, package = "C" }
-                            ]
-                        , build-tool-depends =
-                            [] : List
-                                 { component :
-                                     Text
-                                 , package :
-                                     Text
-                                 , version :
-                                     types.VersionRange
-                                 }
-                        , build-tools =
-                            [] : List
-                                 { exe : Text, version : types.VersionRange }
-                        , buildable =
-                            True
-                        , c-sources =
-                            [] : List Text
-                        , cc-options =
-                            [] : List Text
-                        , cmm-options =
-                            [] : List Text
-                        , cmm-sources =
-                            [] : List Text
-                        , compiler-options =
-                            prelude.defaults.CompilerOptions
-                        , cpp-options =
-                            [] : List Text
-                        , cxx-options =
-                            [] : List Text
-                        , cxx-sources =
-                            [] : List Text
-                        , default-extensions =
-                            [] : List types.Extension
-                        , default-language =
-                            [] : Optional types.Language
-                        , exposed-modules =
-                            [] : List Text
-                        , extra-bundled-libs =
-                            [] : List Text
-                        , extra-framework-dirs =
-                            [] : List Text
-                        , extra-ghci-libraries =
-                            [] : List Text
-                        , extra-lib-dirs =
-                            [] : List Text
-                        , extra-lib-flavours =
-                            [] : List Text
-                        , extra-libraries =
-                            [] : List Text
-                        , frameworks =
-                            [] : List Text
-                        , hs-source-dirs =
-                            [] : List Text
-                        , include-dirs =
-                            [] : List Text
-                        , includes =
-                            [] : List Text
-                        , install-includes =
-                            [] : List Text
-                        , js-sources =
-                            [] : List Text
-                        , ld-options =
-                            [] : List Text
-                        , mixins =
-                            [] : List types.Mixin
-                        , other-extensions =
-                            [] : List types.Extension
-                        , other-languages =
-                            [] : List types.Language
-                        , other-modules =
-                            [] : List Text
-                        , pkgconfig-depends =
-                            [] : List
-                                 { name : Text, version : types.VersionRange }
-                        , profiling-options =
-                            prelude.defaults.CompilerOptions
-                        , reexported-modules =
-                            [] : List
-                                 { name :
-                                     Text
-                                 , original :
-                                     { name : Text, package : Optional Text }
-                                 }
-                        , shared-options =
-                            prelude.defaults.CompilerOptions
-                        , signatures =
-                            [] : List Text
-                        , static-options =
-                            prelude.defaults.CompilerOptions
-                        , virtual-modules =
-                            [] : List Text
-                        }
-            
-            else  { asm-options =
-                      [] : List Text
-                  , asm-sources =
-                      [] : List Text
-                  , autogen-modules =
-                      [] : List Text
-                  , build-depends =
-                      [ { bounds = prelude.anyVersion, package = "A" } ]
-                  , build-tool-depends =
-                      [] : List
-                           { component :
-                               Text
-                           , package :
-                               Text
-                           , version :
-                               types.VersionRange
-                           }
-                  , build-tools =
-                      [] : List { exe : Text, version : types.VersionRange }
-                  , buildable =
-                      True
-                  , c-sources =
-                      [] : List Text
-                  , cc-options =
-                      [] : List Text
-                  , cmm-options =
-                      [] : List Text
-                  , cmm-sources =
-                      [] : List Text
-                  , compiler-options =
-                      prelude.defaults.CompilerOptions
-                  , cpp-options =
-                      [] : List Text
-                  , cxx-options =
-                      [] : List Text
-                  , cxx-sources =
-                      [] : List Text
-                  , default-extensions =
-                      [] : List types.Extension
-                  , default-language =
-                      [] : Optional types.Language
-                  , exposed-modules =
-                      [] : List Text
-                  , extra-bundled-libs =
-                      [] : List Text
-                  , extra-framework-dirs =
-                      [] : List Text
-                  , extra-ghci-libraries =
-                      [] : List Text
-                  , extra-lib-dirs =
-                      [] : List Text
-                  , extra-lib-flavours =
-                      [] : List Text
-                  , extra-libraries =
-                      [] : List Text
-                  , frameworks =
-                      [] : List Text
-                  , hs-source-dirs =
-                      [] : List Text
-                  , include-dirs =
-                      [] : List Text
-                  , includes =
-                      [] : List Text
-                  , install-includes =
-                      [] : List Text
-                  , js-sources =
-                      [] : List Text
-                  , ld-options =
-                      [] : List Text
-                  , mixins =
-                      [] : List types.Mixin
-                  , other-extensions =
-                      [] : List types.Extension
-                  , other-languages =
-                      [] : List types.Language
-                  , other-modules =
-                      [] : List Text
-                  , pkgconfig-depends =
-                      [] : List { name : Text, version : types.VersionRange }
-                  , profiling-options =
-                      prelude.defaults.CompilerOptions
-                  , reexported-modules =
-                      [] : List
-                           { name :
-                               Text
-                           , original :
-                               { name : Text, package : Optional Text }
-                           }
-                  , shared-options =
-                      prelude.defaults.CompilerOptions
-                  , signatures =
-                      [] : List Text
-                  , static-options =
-                      prelude.defaults.CompilerOptions
-                  , virtual-modules =
-                      [] : List Text
-                  }
-        ] : Optional (types.Config → types.Library)
-    , license =
-        < Unspecified =
-            {=}
-        | GPL :
-            Optional types.Version
-        | AGPL :
-            Optional types.Version
-        | LGPL :
-            Optional types.Version
-        | BSD2 :
-            {}
-        | BSD3 :
-            {}
-        | BSD4 :
-            {}
-        | MIT :
-            {}
-        | ISC :
-            {}
-        | MPL :
-            types.Version
-        | Apache :
-            Optional types.Version
-        | PublicDomain :
-            {}
-        | AllRightsReserved :
-            {}
-        | Other :
-            {}
-        | SPDX :
-            types.SPDX
-        >
-    , license-files =
-        [] : List Text
-    , maintainer =
-        ""
-    , name =
-        "Name"
-    , package-url =
-        ""
-    , source-repos =
-        [] : List
-             { branch :
-                 Optional Text
-             , kind :
-                 types.RepoKind
-             , location :
-                 Optional Text
-             , module :
-                 Optional Text
-             , subdir :
-                 Optional Text
-             , tag :
-                 Optional Text
-             , type :
-                 Optional types.RepoType
-             }
-    , stability =
-        ""
-    , sub-libraries =
-        [] : List { library : types.Config → types.Library, name : Text }
-    , synopsis =
-        ""
-    , test-suites =
-        [] : List { name : Text, test-suite : types.Config → types.TestSuite }
-    , tested-with =
-        [] : List { compiler : types.Compiler, version : types.VersionRange }
-    , version =
-        prelude.v "1"
-    , x-fields =
-        [] : List { _1 : Text, _2 : Text }
-    }
+in    prelude.defaults.Package
+    ⫽ { name =
+          "Name"
+      , version =
+          prelude.v "1"
+      , cabal-version =
+          prelude.v "2.0"
+      , library =
+          [   λ(config : types.Config)
+            →       if config.impl
+                       (prelude.types.Compilers.GHC {=})
+                       ( prelude.unionVersionRanges
+                         (prelude.thisVersion (prelude.v "8.2"))
+                         (prelude.laterVersion (prelude.v "8.2"))
+                       )
+              
+              then        if config.impl
+                             (prelude.types.Compilers.GHC {=})
+                             ( prelude.unionVersionRanges
+                               (prelude.thisVersion (prelude.v "8.4"))
+                               (prelude.laterVersion (prelude.v "8.4"))
+                             )
+                    
+                    then    prelude.defaults.Library
+                          ⫽ { build-depends =
+                                [ { bounds = prelude.anyVersion, package = "A" }
+                                , { bounds = prelude.anyVersion, package = "B" }
+                                , { bounds = prelude.anyVersion, package = "C" }
+                                ]
+                            }
+                    
+                    else    prelude.defaults.Library
+                          ⫽ { build-depends =
+                                [ { bounds = prelude.anyVersion, package = "A" }
+                                , { bounds = prelude.anyVersion, package = "B" }
+                                ]
+                            }
+              
+              else  if config.impl
+                       (prelude.types.Compilers.GHC {=})
+                       ( prelude.unionVersionRanges
+                         (prelude.thisVersion (prelude.v "8.4"))
+                         (prelude.laterVersion (prelude.v "8.4"))
+                       )
+              
+              then    prelude.defaults.Library
+                    ⫽ { build-depends =
+                          [ { bounds = prelude.anyVersion, package = "A" }
+                          , { bounds = prelude.anyVersion, package = "C" }
+                          ]
+                      }
+              
+              else    prelude.defaults.Library
+                    ⫽ { build-depends =
+                          [ { bounds = prelude.anyVersion, package = "A" } ]
+                      }
+          ] : Optional (types.Config → types.Library)
+      , license =
+          prelude.types.Licenses.Unspecified {=}
+      }
diff --git a/golden-tests/cabal-to-dhall/executable.cabal b/golden-tests/cabal-to-dhall/executable.cabal
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/executable.cabal
@@ -0,0 +1,6 @@
+cabal-version: 2.0
+name: blah
+version: 1
+
+executable hello
+  main-is: Main.hs
diff --git a/golden-tests/cabal-to-dhall/executable.dhall b/golden-tests/cabal-to-dhall/executable.dhall
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/executable.dhall
@@ -0,0 +1,20 @@
+    let prelude = ./../../dhall/prelude.dhall
+
+in  let types = ./../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "blah"
+      , version =
+          prelude.v "1"
+      , cabal-version =
+          prelude.v "2.0"
+      , executables =
+          [ { executable =
+                  λ(config : types.Config)
+                → prelude.defaults.Executable ⫽ { main-is = "Main.hs" }
+            , name =
+                "hello"
+            }
+          ]
+      }
diff --git a/golden-tests/cabal-to-dhall/gh-36.dhall b/golden-tests/cabal-to-dhall/gh-36.dhall
--- a/golden-tests/cabal-to-dhall/gh-36.dhall
+++ b/golden-tests/cabal-to-dhall/gh-36.dhall
@@ -1,2047 +1,175 @@
-    let prelude = ../../dhall/prelude.dhall 
-
-in  let types = ../../dhall/types.dhall 
-
-in  { author =
-        ""
-    , benchmarks =
-        [] : List { benchmark : types.Config → types.Benchmark, name : Text }
-    , bug-reports =
-        ""
-    , build-type =
-        [] : Optional types.BuildType
-    , cabal-version =
-        prelude.v "2.0"
-    , category =
-        ""
-    , copyright =
-        ""
-    , custom-setup =
-        [] : Optional types.CustomSetup
-    , data-dir =
-        ""
-    , data-files =
-        [] : List Text
-    , description =
-        ""
-    , executables =
-        [] : List { executable : types.Config → types.Executable, name : Text }
-    , extra-doc-files =
-        [] : List Text
-    , extra-source-files =
-        [] : List Text
-    , extra-tmp-files =
-        [] : List Text
-    , flags =
-        [ { default =
-              False
-          , description =
-              "print debug output. not suitable for production"
-          , manual =
-              False
-          , name =
-              "wai-servlet-debug"
-          }
-        ]
-    , foreign-libraries =
-        [] : List
-             { foreign-lib : types.Config → types.ForeignLibrary, name : Text }
-    , homepage =
-        ""
-    , library =
-        [   λ ( config
-              : types.Config
-              )
-          →       if    config.impl
-                        (prelude.types.Compilers.GHC {=})
-                        ( prelude.unionVersionRanges
-                          (prelude.thisVersion (prelude.v "0.0.9.7"))
-                          (prelude.laterVersion (prelude.v "0.0.9.7"))
-                        )
-                  then        if    config.impl
-                                    (prelude.types.Compilers.GHC {=})
-                                    ( prelude.earlierVersion
-                                      (prelude.v "0.7.0.2")
-                                    )
-                              then        if    config.impl
-                                                ( prelude.types.Compilers.GHC
-                                                  {=}
-                                                )
-                                                ( prelude.unionVersionRanges
-                                                  ( prelude.thisVersion
-                                                    (prelude.v "0.0.9")
-                                                  )
-                                                  ( prelude.laterVersion
-                                                    (prelude.v "0.0.9")
-                                                  )
-                                                )
-                                          then        if    config.flag
-                                                            "wai-servlet-debug"
-                                                      then  { asm-options =
-                                                                [] : List Text
-                                                            , asm-sources =
-                                                                [] : List Text
-                                                            , autogen-modules =
-                                                                [] : List Text
-                                                            , build-depends =
-                                                                [] : List
-                                                                     { bounds :
-                                                                         types.VersionRange
-                                                                     , package :
-                                                                         Text
-                                                                     }
-                                                            , build-tool-depends =
-                                                                [] : List
-                                                                     { component :
-                                                                         Text
-                                                                     , package :
-                                                                         Text
-                                                                     , version :
-                                                                         types.VersionRange
-                                                                     }
-                                                            , build-tools =
-                                                                [] : List
-                                                                     { exe :
-                                                                         Text
-                                                                     , version :
-                                                                         types.VersionRange
-                                                                     }
-                                                            , buildable =
-                                                                True
-                                                            , c-sources =
-                                                                [ "java/Utils.java"
-                                                                ]
-                                                            , cc-options =
-                                                                [] : List Text
-                                                            , cmm-options =
-                                                                [] : List Text
-                                                            , cmm-sources =
-                                                                [] : List Text
-                                                            , compiler-options =
-                                                                prelude.defaults.CompilerOptions
-                                                            , cpp-options =
-                                                                [ "-DINTEROP"
-                                                                , "-DPURE_JAVA_WITH"
-                                                                , "-DWAI_SERVLET_DEBUG"
-                                                                ]
-                                                            , cxx-options =
-                                                                [] : List Text
-                                                            , cxx-sources =
-                                                                [] : List Text
-                                                            , default-extensions =
-                                                                [] : List
-                                                                     types.Extension
-                                                            , default-language =
-                                                                [] : Optional
-                                                                     types.Language
-                                                            , exposed-modules =
-                                                                [] : List Text
-                                                            , extra-bundled-libs =
-                                                                [] : List Text
-                                                            , extra-framework-dirs =
-                                                                [] : List Text
-                                                            , extra-ghci-libraries =
-                                                                [] : List Text
-                                                            , extra-lib-dirs =
-                                                                [] : List Text
-                                                            , extra-lib-flavours =
-                                                                [] : List Text
-                                                            , extra-libraries =
-                                                                [] : List Text
-                                                            , frameworks =
-                                                                [] : List Text
-                                                            , hs-source-dirs =
-                                                                [] : List Text
-                                                            , include-dirs =
-                                                                [] : List Text
-                                                            , includes =
-                                                                [] : List Text
-                                                            , install-includes =
-                                                                [] : List Text
-                                                            , js-sources =
-                                                                [] : List Text
-                                                            , ld-options =
-                                                                [] : List Text
-                                                            , mixins =
-                                                                [] : List
-                                                                     types.Mixin
-                                                            , other-extensions =
-                                                                [] : List
-                                                                     types.Extension
-                                                            , other-languages =
-                                                                [] : List
-                                                                     types.Language
-                                                            , other-modules =
-                                                                [] : List Text
-                                                            , pkgconfig-depends =
-                                                                [] : List
-                                                                     { name :
-                                                                         Text
-                                                                     , version :
-                                                                         types.VersionRange
-                                                                     }
-                                                            , profiling-options =
-                                                                prelude.defaults.CompilerOptions
-                                                            , reexported-modules =
-                                                                [] : List
-                                                                     { name :
-                                                                         Text
-                                                                     , original :
-                                                                         { name :
-                                                                             Text
-                                                                         , package :
-                                                                             Optional
-                                                                             Text
-                                                                         }
-                                                                     }
-                                                            , shared-options =
-                                                                prelude.defaults.CompilerOptions
-                                                            , signatures =
-                                                                [] : List Text
-                                                            , static-options =
-                                                                prelude.defaults.CompilerOptions
-                                                            , virtual-modules =
-                                                                [] : List Text
-                                                            }
-                                                
-                                                else  { asm-options =
-                                                          [] : List Text
-                                                      , asm-sources =
-                                                          [] : List Text
-                                                      , autogen-modules =
-                                                          [] : List Text
-                                                      , build-depends =
-                                                          [] : List
-                                                               { bounds :
-                                                                   types.VersionRange
-                                                               , package :
-                                                                   Text
-                                                               }
-                                                      , build-tool-depends =
-                                                          [] : List
-                                                               { component :
-                                                                   Text
-                                                               , package :
-                                                                   Text
-                                                               , version :
-                                                                   types.VersionRange
-                                                               }
-                                                      , build-tools =
-                                                          [] : List
-                                                               { exe :
-                                                                   Text
-                                                               , version :
-                                                                   types.VersionRange
-                                                               }
-                                                      , buildable =
-                                                          True
-                                                      , c-sources =
-                                                          [ "java/Utils.java" ]
-                                                      , cc-options =
-                                                          [] : List Text
-                                                      , cmm-options =
-                                                          [] : List Text
-                                                      , cmm-sources =
-                                                          [] : List Text
-                                                      , compiler-options =
-                                                          prelude.defaults.CompilerOptions
-                                                      , cpp-options =
-                                                          [ "-DINTEROP"
-                                                          , "-DPURE_JAVA_WITH"
-                                                          ]
-                                                      , cxx-options =
-                                                          [] : List Text
-                                                      , cxx-sources =
-                                                          [] : List Text
-                                                      , default-extensions =
-                                                          [] : List
-                                                               types.Extension
-                                                      , default-language =
-                                                          [] : Optional
-                                                               types.Language
-                                                      , exposed-modules =
-                                                          [] : List Text
-                                                      , extra-bundled-libs =
-                                                          [] : List Text
-                                                      , extra-framework-dirs =
-                                                          [] : List Text
-                                                      , extra-ghci-libraries =
-                                                          [] : List Text
-                                                      , extra-lib-dirs =
-                                                          [] : List Text
-                                                      , extra-lib-flavours =
-                                                          [] : List Text
-                                                      , extra-libraries =
-                                                          [] : List Text
-                                                      , frameworks =
-                                                          [] : List Text
-                                                      , hs-source-dirs =
-                                                          [] : List Text
-                                                      , include-dirs =
-                                                          [] : List Text
-                                                      , includes =
-                                                          [] : List Text
-                                                      , install-includes =
-                                                          [] : List Text
-                                                      , js-sources =
-                                                          [] : List Text
-                                                      , ld-options =
-                                                          [] : List Text
-                                                      , mixins =
-                                                          [] : List types.Mixin
-                                                      , other-extensions =
-                                                          [] : List
-                                                               types.Extension
-                                                      , other-languages =
-                                                          [] : List
-                                                               types.Language
-                                                      , other-modules =
-                                                          [] : List Text
-                                                      , pkgconfig-depends =
-                                                          [] : List
-                                                               { name :
-                                                                   Text
-                                                               , version :
-                                                                   types.VersionRange
-                                                               }
-                                                      , profiling-options =
-                                                          prelude.defaults.CompilerOptions
-                                                      , reexported-modules =
-                                                          [] : List
-                                                               { name :
-                                                                   Text
-                                                               , original :
-                                                                   { name :
-                                                                       Text
-                                                                   , package :
-                                                                       Optional
-                                                                       Text
-                                                                   }
-                                                               }
-                                                      , shared-options =
-                                                          prelude.defaults.CompilerOptions
-                                                      , signatures =
-                                                          [] : List Text
-                                                      , static-options =
-                                                          prelude.defaults.CompilerOptions
-                                                      , virtual-modules =
-                                                          [] : List Text
-                                                      }
-                                    
-                                    else  if    config.flag
-                                                "wai-servlet-debug"
-                                          then  { asm-options =
-                                                    [] : List Text
-                                                , asm-sources =
-                                                    [] : List Text
-                                                , autogen-modules =
-                                                    [] : List Text
-                                                , build-depends =
-                                                    [] : List
-                                                         { bounds :
-                                                             types.VersionRange
-                                                         , package :
-                                                             Text
-                                                         }
-                                                , build-tool-depends =
-                                                    [] : List
-                                                         { component :
-                                                             Text
-                                                         , package :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , build-tools =
-                                                    [] : List
-                                                         { exe :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , buildable =
-                                                    True
-                                                , c-sources =
-                                                    [] : List Text
-                                                , cc-options =
-                                                    [] : List Text
-                                                , cmm-options =
-                                                    [] : List Text
-                                                , cmm-sources =
-                                                    [] : List Text
-                                                , compiler-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , cpp-options =
-                                                    [ "-DINTEROP"
-                                                    , "-DPURE_JAVA_WITH"
-                                                    , "-DWAI_SERVLET_DEBUG"
-                                                    ]
-                                                , cxx-options =
-                                                    [] : List Text
-                                                , cxx-sources =
-                                                    [] : List Text
-                                                , default-extensions =
-                                                    [] : List types.Extension
-                                                , default-language =
-                                                    [] : Optional types.Language
-                                                , exposed-modules =
-                                                    [] : List Text
-                                                , extra-bundled-libs =
-                                                    [] : List Text
-                                                , extra-framework-dirs =
-                                                    [] : List Text
-                                                , extra-ghci-libraries =
-                                                    [] : List Text
-                                                , extra-lib-dirs =
-                                                    [] : List Text
-                                                , extra-lib-flavours =
-                                                    [] : List Text
-                                                , extra-libraries =
-                                                    [] : List Text
-                                                , frameworks =
-                                                    [] : List Text
-                                                , hs-source-dirs =
-                                                    [] : List Text
-                                                , include-dirs =
-                                                    [] : List Text
-                                                , includes =
-                                                    [] : List Text
-                                                , install-includes =
-                                                    [] : List Text
-                                                , js-sources =
-                                                    [] : List Text
-                                                , ld-options =
-                                                    [] : List Text
-                                                , mixins =
-                                                    [] : List types.Mixin
-                                                , other-extensions =
-                                                    [] : List types.Extension
-                                                , other-languages =
-                                                    [] : List types.Language
-                                                , other-modules =
-                                                    [] : List Text
-                                                , pkgconfig-depends =
-                                                    [] : List
-                                                         { name :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , profiling-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , reexported-modules =
-                                                    [] : List
-                                                         { name :
-                                                             Text
-                                                         , original :
-                                                             { name :
-                                                                 Text
-                                                             , package :
-                                                                 Optional Text
-                                                             }
-                                                         }
-                                                , shared-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , signatures =
-                                                    [] : List Text
-                                                , static-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , virtual-modules =
-                                                    [] : List Text
-                                                }
-                                    
-                                    else  { asm-options =
-                                              [] : List Text
-                                          , asm-sources =
-                                              [] : List Text
-                                          , autogen-modules =
-                                              [] : List Text
-                                          , build-depends =
-                                              [] : List
-                                                   { bounds :
-                                                       types.VersionRange
-                                                   , package :
-                                                       Text
-                                                   }
-                                          , build-tool-depends =
-                                              [] : List
-                                                   { component :
-                                                       Text
-                                                   , package :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , build-tools =
-                                              [] : List
-                                                   { exe :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , buildable =
-                                              True
-                                          , c-sources =
-                                              [] : List Text
-                                          , cc-options =
-                                              [] : List Text
-                                          , cmm-options =
-                                              [] : List Text
-                                          , cmm-sources =
-                                              [] : List Text
-                                          , compiler-options =
-                                              prelude.defaults.CompilerOptions
-                                          , cpp-options =
-                                              [ "-DINTEROP"
-                                              , "-DPURE_JAVA_WITH"
-                                              ]
-                                          , cxx-options =
-                                              [] : List Text
-                                          , cxx-sources =
-                                              [] : List Text
-                                          , default-extensions =
-                                              [] : List types.Extension
-                                          , default-language =
-                                              [] : Optional types.Language
-                                          , exposed-modules =
-                                              [] : List Text
-                                          , extra-bundled-libs =
-                                              [] : List Text
-                                          , extra-framework-dirs =
-                                              [] : List Text
-                                          , extra-ghci-libraries =
-                                              [] : List Text
-                                          , extra-lib-dirs =
-                                              [] : List Text
-                                          , extra-lib-flavours =
-                                              [] : List Text
-                                          , extra-libraries =
-                                              [] : List Text
-                                          , frameworks =
-                                              [] : List Text
-                                          , hs-source-dirs =
-                                              [] : List Text
-                                          , include-dirs =
-                                              [] : List Text
-                                          , includes =
-                                              [] : List Text
-                                          , install-includes =
-                                              [] : List Text
-                                          , js-sources =
-                                              [] : List Text
-                                          , ld-options =
-                                              [] : List Text
-                                          , mixins =
-                                              [] : List types.Mixin
-                                          , other-extensions =
-                                              [] : List types.Extension
-                                          , other-languages =
-                                              [] : List types.Language
-                                          , other-modules =
-                                              [] : List Text
-                                          , pkgconfig-depends =
-                                              [] : List
-                                                   { name :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , profiling-options =
-                                              prelude.defaults.CompilerOptions
-                                          , reexported-modules =
-                                              [] : List
-                                                   { name :
-                                                       Text
-                                                   , original :
-                                                       { name :
-                                                           Text
-                                                       , package :
-                                                           Optional Text
-                                                       }
-                                                   }
-                                          , shared-options =
-                                              prelude.defaults.CompilerOptions
-                                          , signatures =
-                                              [] : List Text
-                                          , static-options =
-                                              prelude.defaults.CompilerOptions
-                                          , virtual-modules =
-                                              [] : List Text
-                                          }
-                        
-                        else  if    config.impl
-                                    (prelude.types.Compilers.GHC {=})
-                                    ( prelude.unionVersionRanges
-                                      (prelude.thisVersion (prelude.v "0.0.9"))
-                                      (prelude.laterVersion (prelude.v "0.0.9"))
-                                    )
-                              then        if    config.flag
-                                                "wai-servlet-debug"
-                                          then  { asm-options =
-                                                    [] : List Text
-                                                , asm-sources =
-                                                    [] : List Text
-                                                , autogen-modules =
-                                                    [] : List Text
-                                                , build-depends =
-                                                    [] : List
-                                                         { bounds :
-                                                             types.VersionRange
-                                                         , package :
-                                                             Text
-                                                         }
-                                                , build-tool-depends =
-                                                    [] : List
-                                                         { component :
-                                                             Text
-                                                         , package :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , build-tools =
-                                                    [] : List
-                                                         { exe :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , buildable =
-                                                    True
-                                                , c-sources =
-                                                    [ "java/Utils.java" ]
-                                                , cc-options =
-                                                    [] : List Text
-                                                , cmm-options =
-                                                    [] : List Text
-                                                , cmm-sources =
-                                                    [] : List Text
-                                                , compiler-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , cpp-options =
-                                                    [ "-DINTEROP"
-                                                    , "-DWAI_SERVLET_DEBUG"
-                                                    ]
-                                                , cxx-options =
-                                                    [] : List Text
-                                                , cxx-sources =
-                                                    [] : List Text
-                                                , default-extensions =
-                                                    [] : List types.Extension
-                                                , default-language =
-                                                    [] : Optional types.Language
-                                                , exposed-modules =
-                                                    [] : List Text
-                                                , extra-bundled-libs =
-                                                    [] : List Text
-                                                , extra-framework-dirs =
-                                                    [] : List Text
-                                                , extra-ghci-libraries =
-                                                    [] : List Text
-                                                , extra-lib-dirs =
-                                                    [] : List Text
-                                                , extra-lib-flavours =
-                                                    [] : List Text
-                                                , extra-libraries =
-                                                    [] : List Text
-                                                , frameworks =
-                                                    [] : List Text
-                                                , hs-source-dirs =
-                                                    [] : List Text
-                                                , include-dirs =
-                                                    [] : List Text
-                                                , includes =
-                                                    [] : List Text
-                                                , install-includes =
-                                                    [] : List Text
-                                                , js-sources =
-                                                    [] : List Text
-                                                , ld-options =
-                                                    [] : List Text
-                                                , mixins =
-                                                    [] : List types.Mixin
-                                                , other-extensions =
-                                                    [] : List types.Extension
-                                                , other-languages =
-                                                    [] : List types.Language
-                                                , other-modules =
-                                                    [] : List Text
-                                                , pkgconfig-depends =
-                                                    [] : List
-                                                         { name :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , profiling-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , reexported-modules =
-                                                    [] : List
-                                                         { name :
-                                                             Text
-                                                         , original :
-                                                             { name :
-                                                                 Text
-                                                             , package :
-                                                                 Optional Text
-                                                             }
-                                                         }
-                                                , shared-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , signatures =
-                                                    [] : List Text
-                                                , static-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , virtual-modules =
-                                                    [] : List Text
-                                                }
-                                    
-                                    else  { asm-options =
-                                              [] : List Text
-                                          , asm-sources =
-                                              [] : List Text
-                                          , autogen-modules =
-                                              [] : List Text
-                                          , build-depends =
-                                              [] : List
-                                                   { bounds :
-                                                       types.VersionRange
-                                                   , package :
-                                                       Text
-                                                   }
-                                          , build-tool-depends =
-                                              [] : List
-                                                   { component :
-                                                       Text
-                                                   , package :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , build-tools =
-                                              [] : List
-                                                   { exe :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , buildable =
-                                              True
-                                          , c-sources =
-                                              [ "java/Utils.java" ]
-                                          , cc-options =
-                                              [] : List Text
-                                          , cmm-options =
-                                              [] : List Text
-                                          , cmm-sources =
-                                              [] : List Text
-                                          , compiler-options =
-                                              prelude.defaults.CompilerOptions
-                                          , cpp-options =
-                                              [ "-DINTEROP" ]
-                                          , cxx-options =
-                                              [] : List Text
-                                          , cxx-sources =
-                                              [] : List Text
-                                          , default-extensions =
-                                              [] : List types.Extension
-                                          , default-language =
-                                              [] : Optional types.Language
-                                          , exposed-modules =
-                                              [] : List Text
-                                          , extra-bundled-libs =
-                                              [] : List Text
-                                          , extra-framework-dirs =
-                                              [] : List Text
-                                          , extra-ghci-libraries =
-                                              [] : List Text
-                                          , extra-lib-dirs =
-                                              [] : List Text
-                                          , extra-lib-flavours =
-                                              [] : List Text
-                                          , extra-libraries =
-                                              [] : List Text
-                                          , frameworks =
-                                              [] : List Text
-                                          , hs-source-dirs =
-                                              [] : List Text
-                                          , include-dirs =
-                                              [] : List Text
-                                          , includes =
-                                              [] : List Text
-                                          , install-includes =
-                                              [] : List Text
-                                          , js-sources =
-                                              [] : List Text
-                                          , ld-options =
-                                              [] : List Text
-                                          , mixins =
-                                              [] : List types.Mixin
-                                          , other-extensions =
-                                              [] : List types.Extension
-                                          , other-languages =
-                                              [] : List types.Language
-                                          , other-modules =
-                                              [] : List Text
-                                          , pkgconfig-depends =
-                                              [] : List
-                                                   { name :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , profiling-options =
-                                              prelude.defaults.CompilerOptions
-                                          , reexported-modules =
-                                              [] : List
-                                                   { name :
-                                                       Text
-                                                   , original :
-                                                       { name :
-                                                           Text
-                                                       , package :
-                                                           Optional Text
-                                                       }
-                                                   }
-                                          , shared-options =
-                                              prelude.defaults.CompilerOptions
-                                          , signatures =
-                                              [] : List Text
-                                          , static-options =
-                                              prelude.defaults.CompilerOptions
-                                          , virtual-modules =
-                                              [] : List Text
-                                          }
-                        
-                        else  if    config.flag "wai-servlet-debug"
-                              then  { asm-options =
-                                        [] : List Text
-                                    , asm-sources =
-                                        [] : List Text
-                                    , autogen-modules =
-                                        [] : List Text
-                                    , build-depends =
-                                        [] : List
-                                             { bounds :
-                                                 types.VersionRange
-                                             , package :
-                                                 Text
-                                             }
-                                    , build-tool-depends =
-                                        [] : List
-                                             { component :
-                                                 Text
-                                             , package :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , build-tools =
-                                        [] : List
-                                             { exe :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , buildable =
-                                        True
-                                    , c-sources =
-                                        [] : List Text
-                                    , cc-options =
-                                        [] : List Text
-                                    , cmm-options =
-                                        [] : List Text
-                                    , cmm-sources =
-                                        [] : List Text
-                                    , compiler-options =
-                                        prelude.defaults.CompilerOptions
-                                    , cpp-options =
-                                        [ "-DINTEROP", "-DWAI_SERVLET_DEBUG" ]
-                                    , cxx-options =
-                                        [] : List Text
-                                    , cxx-sources =
-                                        [] : List Text
-                                    , default-extensions =
-                                        [] : List types.Extension
-                                    , default-language =
-                                        [] : Optional types.Language
-                                    , exposed-modules =
-                                        [] : List Text
-                                    , extra-bundled-libs =
-                                        [] : List Text
-                                    , extra-framework-dirs =
-                                        [] : List Text
-                                    , extra-ghci-libraries =
-                                        [] : List Text
-                                    , extra-lib-dirs =
-                                        [] : List Text
-                                    , extra-lib-flavours =
-                                        [] : List Text
-                                    , extra-libraries =
-                                        [] : List Text
-                                    , frameworks =
-                                        [] : List Text
-                                    , hs-source-dirs =
-                                        [] : List Text
-                                    , include-dirs =
-                                        [] : List Text
-                                    , includes =
-                                        [] : List Text
-                                    , install-includes =
-                                        [] : List Text
-                                    , js-sources =
-                                        [] : List Text
-                                    , ld-options =
-                                        [] : List Text
-                                    , mixins =
-                                        [] : List types.Mixin
-                                    , other-extensions =
-                                        [] : List types.Extension
-                                    , other-languages =
-                                        [] : List types.Language
-                                    , other-modules =
-                                        [] : List Text
-                                    , pkgconfig-depends =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , profiling-options =
-                                        prelude.defaults.CompilerOptions
-                                    , reexported-modules =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , original :
-                                                 { name :
-                                                     Text
-                                                 , package :
-                                                     Optional Text
-                                                 }
-                                             }
-                                    , shared-options =
-                                        prelude.defaults.CompilerOptions
-                                    , signatures =
-                                        [] : List Text
-                                    , static-options =
-                                        prelude.defaults.CompilerOptions
-                                    , virtual-modules =
-                                        [] : List Text
-                                    }
-                        
-                        else  { asm-options =
-                                  [] : List Text
-                              , asm-sources =
-                                  [] : List Text
-                              , autogen-modules =
-                                  [] : List Text
-                              , build-depends =
-                                  [] : List
-                                       { bounds :
-                                           types.VersionRange
-                                       , package :
-                                           Text
-                                       }
-                              , build-tool-depends =
-                                  [] : List
-                                       { component :
-                                           Text
-                                       , package :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , build-tools =
-                                  [] : List
-                                       { exe :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , buildable =
-                                  True
-                              , c-sources =
-                                  [] : List Text
-                              , cc-options =
-                                  [] : List Text
-                              , cmm-options =
-                                  [] : List Text
-                              , cmm-sources =
-                                  [] : List Text
-                              , compiler-options =
-                                  prelude.defaults.CompilerOptions
-                              , cpp-options =
-                                  [ "-DINTEROP" ]
-                              , cxx-options =
-                                  [] : List Text
-                              , cxx-sources =
-                                  [] : List Text
-                              , default-extensions =
-                                  [] : List types.Extension
-                              , default-language =
-                                  [] : Optional types.Language
-                              , exposed-modules =
-                                  [] : List Text
-                              , extra-bundled-libs =
-                                  [] : List Text
-                              , extra-framework-dirs =
-                                  [] : List Text
-                              , extra-ghci-libraries =
-                                  [] : List Text
-                              , extra-lib-dirs =
-                                  [] : List Text
-                              , extra-lib-flavours =
-                                  [] : List Text
-                              , extra-libraries =
-                                  [] : List Text
-                              , frameworks =
-                                  [] : List Text
-                              , hs-source-dirs =
-                                  [] : List Text
-                              , include-dirs =
-                                  [] : List Text
-                              , includes =
-                                  [] : List Text
-                              , install-includes =
-                                  [] : List Text
-                              , js-sources =
-                                  [] : List Text
-                              , ld-options =
-                                  [] : List Text
-                              , mixins =
-                                  [] : List types.Mixin
-                              , other-extensions =
-                                  [] : List types.Extension
-                              , other-languages =
-                                  [] : List types.Language
-                              , other-modules =
-                                  [] : List Text
-                              , pkgconfig-depends =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , profiling-options =
-                                  prelude.defaults.CompilerOptions
-                              , reexported-modules =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , original :
-                                           { name :
-                                               Text
-                                           , package :
-                                               Optional Text
-                                           }
-                                       }
-                              , shared-options =
-                                  prelude.defaults.CompilerOptions
-                              , signatures =
-                                  [] : List Text
-                              , static-options =
-                                  prelude.defaults.CompilerOptions
-                              , virtual-modules =
-                                  [] : List Text
-                              }
-            
-            else  if    config.impl
-                        (prelude.types.Compilers.GHC {=})
-                        (prelude.earlierVersion (prelude.v "0.7.0.2"))
-                  then        if    config.impl
-                                    (prelude.types.Compilers.GHC {=})
-                                    ( prelude.unionVersionRanges
-                                      (prelude.thisVersion (prelude.v "0.0.9"))
-                                      (prelude.laterVersion (prelude.v "0.0.9"))
-                                    )
-                              then        if    config.flag
-                                                "wai-servlet-debug"
-                                          then  { asm-options =
-                                                    [] : List Text
-                                                , asm-sources =
-                                                    [] : List Text
-                                                , autogen-modules =
-                                                    [] : List Text
-                                                , build-depends =
-                                                    [] : List
-                                                         { bounds :
-                                                             types.VersionRange
-                                                         , package :
-                                                             Text
-                                                         }
-                                                , build-tool-depends =
-                                                    [] : List
-                                                         { component :
-                                                             Text
-                                                         , package :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , build-tools =
-                                                    [] : List
-                                                         { exe :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , buildable =
-                                                    True
-                                                , c-sources =
-                                                    [ "java/Utils.java" ]
-                                                , cc-options =
-                                                    [] : List Text
-                                                , cmm-options =
-                                                    [] : List Text
-                                                , cmm-sources =
-                                                    [] : List Text
-                                                , compiler-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , cpp-options =
-                                                    [ "-DPURE_JAVA_WITH"
-                                                    , "-DWAI_SERVLET_DEBUG"
-                                                    ]
-                                                , cxx-options =
-                                                    [] : List Text
-                                                , cxx-sources =
-                                                    [] : List Text
-                                                , default-extensions =
-                                                    [] : List types.Extension
-                                                , default-language =
-                                                    [] : Optional types.Language
-                                                , exposed-modules =
-                                                    [] : List Text
-                                                , extra-bundled-libs =
-                                                    [] : List Text
-                                                , extra-framework-dirs =
-                                                    [] : List Text
-                                                , extra-ghci-libraries =
-                                                    [] : List Text
-                                                , extra-lib-dirs =
-                                                    [] : List Text
-                                                , extra-lib-flavours =
-                                                    [] : List Text
-                                                , extra-libraries =
-                                                    [] : List Text
-                                                , frameworks =
-                                                    [] : List Text
-                                                , hs-source-dirs =
-                                                    [] : List Text
-                                                , include-dirs =
-                                                    [] : List Text
-                                                , includes =
-                                                    [] : List Text
-                                                , install-includes =
-                                                    [] : List Text
-                                                , js-sources =
-                                                    [] : List Text
-                                                , ld-options =
-                                                    [] : List Text
-                                                , mixins =
-                                                    [] : List types.Mixin
-                                                , other-extensions =
-                                                    [] : List types.Extension
-                                                , other-languages =
-                                                    [] : List types.Language
-                                                , other-modules =
-                                                    [] : List Text
-                                                , pkgconfig-depends =
-                                                    [] : List
-                                                         { name :
-                                                             Text
-                                                         , version :
-                                                             types.VersionRange
-                                                         }
-                                                , profiling-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , reexported-modules =
-                                                    [] : List
-                                                         { name :
-                                                             Text
-                                                         , original :
-                                                             { name :
-                                                                 Text
-                                                             , package :
-                                                                 Optional Text
-                                                             }
-                                                         }
-                                                , shared-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , signatures =
-                                                    [] : List Text
-                                                , static-options =
-                                                    prelude.defaults.CompilerOptions
-                                                , virtual-modules =
-                                                    [] : List Text
-                                                }
-                                    
-                                    else  { asm-options =
-                                              [] : List Text
-                                          , asm-sources =
-                                              [] : List Text
-                                          , autogen-modules =
-                                              [] : List Text
-                                          , build-depends =
-                                              [] : List
-                                                   { bounds :
-                                                       types.VersionRange
-                                                   , package :
-                                                       Text
-                                                   }
-                                          , build-tool-depends =
-                                              [] : List
-                                                   { component :
-                                                       Text
-                                                   , package :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , build-tools =
-                                              [] : List
-                                                   { exe :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , buildable =
-                                              True
-                                          , c-sources =
-                                              [ "java/Utils.java" ]
-                                          , cc-options =
-                                              [] : List Text
-                                          , cmm-options =
-                                              [] : List Text
-                                          , cmm-sources =
-                                              [] : List Text
-                                          , compiler-options =
-                                              prelude.defaults.CompilerOptions
-                                          , cpp-options =
-                                              [ "-DPURE_JAVA_WITH" ]
-                                          , cxx-options =
-                                              [] : List Text
-                                          , cxx-sources =
-                                              [] : List Text
-                                          , default-extensions =
-                                              [] : List types.Extension
-                                          , default-language =
-                                              [] : Optional types.Language
-                                          , exposed-modules =
-                                              [] : List Text
-                                          , extra-bundled-libs =
-                                              [] : List Text
-                                          , extra-framework-dirs =
-                                              [] : List Text
-                                          , extra-ghci-libraries =
-                                              [] : List Text
-                                          , extra-lib-dirs =
-                                              [] : List Text
-                                          , extra-lib-flavours =
-                                              [] : List Text
-                                          , extra-libraries =
-                                              [] : List Text
-                                          , frameworks =
-                                              [] : List Text
-                                          , hs-source-dirs =
-                                              [] : List Text
-                                          , include-dirs =
-                                              [] : List Text
-                                          , includes =
-                                              [] : List Text
-                                          , install-includes =
-                                              [] : List Text
-                                          , js-sources =
-                                              [] : List Text
-                                          , ld-options =
-                                              [] : List Text
-                                          , mixins =
-                                              [] : List types.Mixin
-                                          , other-extensions =
-                                              [] : List types.Extension
-                                          , other-languages =
-                                              [] : List types.Language
-                                          , other-modules =
-                                              [] : List Text
-                                          , pkgconfig-depends =
-                                              [] : List
-                                                   { name :
-                                                       Text
-                                                   , version :
-                                                       types.VersionRange
-                                                   }
-                                          , profiling-options =
-                                              prelude.defaults.CompilerOptions
-                                          , reexported-modules =
-                                              [] : List
-                                                   { name :
-                                                       Text
-                                                   , original :
-                                                       { name :
-                                                           Text
-                                                       , package :
-                                                           Optional Text
-                                                       }
-                                                   }
-                                          , shared-options =
-                                              prelude.defaults.CompilerOptions
-                                          , signatures =
-                                              [] : List Text
-                                          , static-options =
-                                              prelude.defaults.CompilerOptions
-                                          , virtual-modules =
-                                              [] : List Text
-                                          }
-                        
-                        else  if    config.flag "wai-servlet-debug"
-                              then  { asm-options =
-                                        [] : List Text
-                                    , asm-sources =
-                                        [] : List Text
-                                    , autogen-modules =
-                                        [] : List Text
-                                    , build-depends =
-                                        [] : List
-                                             { bounds :
-                                                 types.VersionRange
-                                             , package :
-                                                 Text
-                                             }
-                                    , build-tool-depends =
-                                        [] : List
-                                             { component :
-                                                 Text
-                                             , package :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , build-tools =
-                                        [] : List
-                                             { exe :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , buildable =
-                                        True
-                                    , c-sources =
-                                        [] : List Text
-                                    , cc-options =
-                                        [] : List Text
-                                    , cmm-options =
-                                        [] : List Text
-                                    , cmm-sources =
-                                        [] : List Text
-                                    , compiler-options =
-                                        prelude.defaults.CompilerOptions
-                                    , cpp-options =
-                                        [ "-DPURE_JAVA_WITH"
-                                        , "-DWAI_SERVLET_DEBUG"
-                                        ]
-                                    , cxx-options =
-                                        [] : List Text
-                                    , cxx-sources =
-                                        [] : List Text
-                                    , default-extensions =
-                                        [] : List types.Extension
-                                    , default-language =
-                                        [] : Optional types.Language
-                                    , exposed-modules =
-                                        [] : List Text
-                                    , extra-bundled-libs =
-                                        [] : List Text
-                                    , extra-framework-dirs =
-                                        [] : List Text
-                                    , extra-ghci-libraries =
-                                        [] : List Text
-                                    , extra-lib-dirs =
-                                        [] : List Text
-                                    , extra-lib-flavours =
-                                        [] : List Text
-                                    , extra-libraries =
-                                        [] : List Text
-                                    , frameworks =
-                                        [] : List Text
-                                    , hs-source-dirs =
-                                        [] : List Text
-                                    , include-dirs =
-                                        [] : List Text
-                                    , includes =
-                                        [] : List Text
-                                    , install-includes =
-                                        [] : List Text
-                                    , js-sources =
-                                        [] : List Text
-                                    , ld-options =
-                                        [] : List Text
-                                    , mixins =
-                                        [] : List types.Mixin
-                                    , other-extensions =
-                                        [] : List types.Extension
-                                    , other-languages =
-                                        [] : List types.Language
-                                    , other-modules =
-                                        [] : List Text
-                                    , pkgconfig-depends =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , profiling-options =
-                                        prelude.defaults.CompilerOptions
-                                    , reexported-modules =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , original :
-                                                 { name :
-                                                     Text
-                                                 , package :
-                                                     Optional Text
-                                                 }
-                                             }
-                                    , shared-options =
-                                        prelude.defaults.CompilerOptions
-                                    , signatures =
-                                        [] : List Text
-                                    , static-options =
-                                        prelude.defaults.CompilerOptions
-                                    , virtual-modules =
-                                        [] : List Text
-                                    }
-                        
-                        else  { asm-options =
-                                  [] : List Text
-                              , asm-sources =
-                                  [] : List Text
-                              , autogen-modules =
-                                  [] : List Text
-                              , build-depends =
-                                  [] : List
-                                       { bounds :
-                                           types.VersionRange
-                                       , package :
-                                           Text
-                                       }
-                              , build-tool-depends =
-                                  [] : List
-                                       { component :
-                                           Text
-                                       , package :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , build-tools =
-                                  [] : List
-                                       { exe :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , buildable =
-                                  True
-                              , c-sources =
-                                  [] : List Text
-                              , cc-options =
-                                  [] : List Text
-                              , cmm-options =
-                                  [] : List Text
-                              , cmm-sources =
-                                  [] : List Text
-                              , compiler-options =
-                                  prelude.defaults.CompilerOptions
-                              , cpp-options =
-                                  [ "-DPURE_JAVA_WITH" ]
-                              , cxx-options =
-                                  [] : List Text
-                              , cxx-sources =
-                                  [] : List Text
-                              , default-extensions =
-                                  [] : List types.Extension
-                              , default-language =
-                                  [] : Optional types.Language
-                              , exposed-modules =
-                                  [] : List Text
-                              , extra-bundled-libs =
-                                  [] : List Text
-                              , extra-framework-dirs =
-                                  [] : List Text
-                              , extra-ghci-libraries =
-                                  [] : List Text
-                              , extra-lib-dirs =
-                                  [] : List Text
-                              , extra-lib-flavours =
-                                  [] : List Text
-                              , extra-libraries =
-                                  [] : List Text
-                              , frameworks =
-                                  [] : List Text
-                              , hs-source-dirs =
-                                  [] : List Text
-                              , include-dirs =
-                                  [] : List Text
-                              , includes =
-                                  [] : List Text
-                              , install-includes =
-                                  [] : List Text
-                              , js-sources =
-                                  [] : List Text
-                              , ld-options =
-                                  [] : List Text
-                              , mixins =
-                                  [] : List types.Mixin
-                              , other-extensions =
-                                  [] : List types.Extension
-                              , other-languages =
-                                  [] : List types.Language
-                              , other-modules =
-                                  [] : List Text
-                              , pkgconfig-depends =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , profiling-options =
-                                  prelude.defaults.CompilerOptions
-                              , reexported-modules =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , original :
-                                           { name :
-                                               Text
-                                           , package :
-                                               Optional Text
-                                           }
-                                       }
-                              , shared-options =
-                                  prelude.defaults.CompilerOptions
-                              , signatures =
-                                  [] : List Text
-                              , static-options =
-                                  prelude.defaults.CompilerOptions
-                              , virtual-modules =
-                                  [] : List Text
-                              }
-            
-            else  if    config.impl
-                        (prelude.types.Compilers.GHC {=})
-                        ( prelude.unionVersionRanges
-                          (prelude.thisVersion (prelude.v "0.0.9"))
-                          (prelude.laterVersion (prelude.v "0.0.9"))
-                        )
-                  then        if    config.flag "wai-servlet-debug"
-                              then  { asm-options =
-                                        [] : List Text
-                                    , asm-sources =
-                                        [] : List Text
-                                    , autogen-modules =
-                                        [] : List Text
-                                    , build-depends =
-                                        [] : List
-                                             { bounds :
-                                                 types.VersionRange
-                                             , package :
-                                                 Text
-                                             }
-                                    , build-tool-depends =
-                                        [] : List
-                                             { component :
-                                                 Text
-                                             , package :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , build-tools =
-                                        [] : List
-                                             { exe :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , buildable =
-                                        True
-                                    , c-sources =
-                                        [ "java/Utils.java" ]
-                                    , cc-options =
-                                        [] : List Text
-                                    , cmm-options =
-                                        [] : List Text
-                                    , cmm-sources =
-                                        [] : List Text
-                                    , compiler-options =
-                                        prelude.defaults.CompilerOptions
-                                    , cpp-options =
-                                        [ "-DWAI_SERVLET_DEBUG" ]
-                                    , cxx-options =
-                                        [] : List Text
-                                    , cxx-sources =
-                                        [] : List Text
-                                    , default-extensions =
-                                        [] : List types.Extension
-                                    , default-language =
-                                        [] : Optional types.Language
-                                    , exposed-modules =
-                                        [] : List Text
-                                    , extra-bundled-libs =
-                                        [] : List Text
-                                    , extra-framework-dirs =
-                                        [] : List Text
-                                    , extra-ghci-libraries =
-                                        [] : List Text
-                                    , extra-lib-dirs =
-                                        [] : List Text
-                                    , extra-lib-flavours =
-                                        [] : List Text
-                                    , extra-libraries =
-                                        [] : List Text
-                                    , frameworks =
-                                        [] : List Text
-                                    , hs-source-dirs =
-                                        [] : List Text
-                                    , include-dirs =
-                                        [] : List Text
-                                    , includes =
-                                        [] : List Text
-                                    , install-includes =
-                                        [] : List Text
-                                    , js-sources =
-                                        [] : List Text
-                                    , ld-options =
-                                        [] : List Text
-                                    , mixins =
-                                        [] : List types.Mixin
-                                    , other-extensions =
-                                        [] : List types.Extension
-                                    , other-languages =
-                                        [] : List types.Language
-                                    , other-modules =
-                                        [] : List Text
-                                    , pkgconfig-depends =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , version :
-                                                 types.VersionRange
-                                             }
-                                    , profiling-options =
-                                        prelude.defaults.CompilerOptions
-                                    , reexported-modules =
-                                        [] : List
-                                             { name :
-                                                 Text
-                                             , original :
-                                                 { name :
-                                                     Text
-                                                 , package :
-                                                     Optional Text
-                                                 }
-                                             }
-                                    , shared-options =
-                                        prelude.defaults.CompilerOptions
-                                    , signatures =
-                                        [] : List Text
-                                    , static-options =
-                                        prelude.defaults.CompilerOptions
-                                    , virtual-modules =
-                                        [] : List Text
-                                    }
-                        
-                        else  { asm-options =
-                                  [] : List Text
-                              , asm-sources =
-                                  [] : List Text
-                              , autogen-modules =
-                                  [] : List Text
-                              , build-depends =
-                                  [] : List
-                                       { bounds :
-                                           types.VersionRange
-                                       , package :
-                                           Text
-                                       }
-                              , build-tool-depends =
-                                  [] : List
-                                       { component :
-                                           Text
-                                       , package :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , build-tools =
-                                  [] : List
-                                       { exe :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , buildable =
-                                  True
-                              , c-sources =
-                                  [ "java/Utils.java" ]
-                              , cc-options =
-                                  [] : List Text
-                              , cmm-options =
-                                  [] : List Text
-                              , cmm-sources =
-                                  [] : List Text
-                              , compiler-options =
-                                  prelude.defaults.CompilerOptions
-                              , cpp-options =
-                                  [] : List Text
-                              , cxx-options =
-                                  [] : List Text
-                              , cxx-sources =
-                                  [] : List Text
-                              , default-extensions =
-                                  [] : List types.Extension
-                              , default-language =
-                                  [] : Optional types.Language
-                              , exposed-modules =
-                                  [] : List Text
-                              , extra-bundled-libs =
-                                  [] : List Text
-                              , extra-framework-dirs =
-                                  [] : List Text
-                              , extra-ghci-libraries =
-                                  [] : List Text
-                              , extra-lib-dirs =
-                                  [] : List Text
-                              , extra-lib-flavours =
-                                  [] : List Text
-                              , extra-libraries =
-                                  [] : List Text
-                              , frameworks =
-                                  [] : List Text
-                              , hs-source-dirs =
-                                  [] : List Text
-                              , include-dirs =
-                                  [] : List Text
-                              , includes =
-                                  [] : List Text
-                              , install-includes =
-                                  [] : List Text
-                              , js-sources =
-                                  [] : List Text
-                              , ld-options =
-                                  [] : List Text
-                              , mixins =
-                                  [] : List types.Mixin
-                              , other-extensions =
-                                  [] : List types.Extension
-                              , other-languages =
-                                  [] : List types.Language
-                              , other-modules =
-                                  [] : List Text
-                              , pkgconfig-depends =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , version :
-                                           types.VersionRange
-                                       }
-                              , profiling-options =
-                                  prelude.defaults.CompilerOptions
-                              , reexported-modules =
-                                  [] : List
-                                       { name :
-                                           Text
-                                       , original :
-                                           { name :
-                                               Text
-                                           , package :
-                                               Optional Text
-                                           }
-                                       }
-                              , shared-options =
-                                  prelude.defaults.CompilerOptions
-                              , signatures =
-                                  [] : List Text
-                              , static-options =
-                                  prelude.defaults.CompilerOptions
-                              , virtual-modules =
-                                  [] : List Text
-                              }
-            
-            else  if    config.flag "wai-servlet-debug"
-                  then  { asm-options =
-                            [] : List Text
-                        , asm-sources =
-                            [] : List Text
-                        , autogen-modules =
-                            [] : List Text
-                        , build-depends =
-                            [] : List
-                                 { bounds : types.VersionRange, package : Text }
-                        , build-tool-depends =
-                            [] : List
-                                 { component :
-                                     Text
-                                 , package :
-                                     Text
-                                 , version :
-                                     types.VersionRange
-                                 }
-                        , build-tools =
-                            [] : List
-                                 { exe : Text, version : types.VersionRange }
-                        , buildable =
-                            True
-                        , c-sources =
-                            [] : List Text
-                        , cc-options =
-                            [] : List Text
-                        , cmm-options =
-                            [] : List Text
-                        , cmm-sources =
-                            [] : List Text
-                        , compiler-options =
-                            prelude.defaults.CompilerOptions
-                        , cpp-options =
-                            [ "-DWAI_SERVLET_DEBUG" ]
-                        , cxx-options =
-                            [] : List Text
-                        , cxx-sources =
-                            [] : List Text
-                        , default-extensions =
-                            [] : List types.Extension
-                        , default-language =
-                            [] : Optional types.Language
-                        , exposed-modules =
-                            [] : List Text
-                        , extra-bundled-libs =
-                            [] : List Text
-                        , extra-framework-dirs =
-                            [] : List Text
-                        , extra-ghci-libraries =
-                            [] : List Text
-                        , extra-lib-dirs =
-                            [] : List Text
-                        , extra-lib-flavours =
-                            [] : List Text
-                        , extra-libraries =
-                            [] : List Text
-                        , frameworks =
-                            [] : List Text
-                        , hs-source-dirs =
-                            [] : List Text
-                        , include-dirs =
-                            [] : List Text
-                        , includes =
-                            [] : List Text
-                        , install-includes =
-                            [] : List Text
-                        , js-sources =
-                            [] : List Text
-                        , ld-options =
-                            [] : List Text
-                        , mixins =
-                            [] : List types.Mixin
-                        , other-extensions =
-                            [] : List types.Extension
-                        , other-languages =
-                            [] : List types.Language
-                        , other-modules =
-                            [] : List Text
-                        , pkgconfig-depends =
-                            [] : List
-                                 { name : Text, version : types.VersionRange }
-                        , profiling-options =
-                            prelude.defaults.CompilerOptions
-                        , reexported-modules =
-                            [] : List
-                                 { name :
-                                     Text
-                                 , original :
-                                     { name : Text, package : Optional Text }
-                                 }
-                        , shared-options =
-                            prelude.defaults.CompilerOptions
-                        , signatures =
-                            [] : List Text
-                        , static-options =
-                            prelude.defaults.CompilerOptions
-                        , virtual-modules =
-                            [] : List Text
-                        }
-            
-            else  { asm-options =
-                      [] : List Text
-                  , asm-sources =
-                      [] : List Text
-                  , autogen-modules =
-                      [] : List Text
-                  , build-depends =
-                      [] : List { bounds : types.VersionRange, package : Text }
-                  , build-tool-depends =
-                      [] : List
-                           { component :
-                               Text
-                           , package :
-                               Text
-                           , version :
-                               types.VersionRange
-                           }
-                  , build-tools =
-                      [] : List { exe : Text, version : types.VersionRange }
-                  , buildable =
-                      True
-                  , c-sources =
-                      [] : List Text
-                  , cc-options =
-                      [] : List Text
-                  , cmm-options =
-                      [] : List Text
-                  , cmm-sources =
-                      [] : List Text
-                  , compiler-options =
-                      prelude.defaults.CompilerOptions
-                  , cpp-options =
-                      [] : List Text
-                  , cxx-options =
-                      [] : List Text
-                  , cxx-sources =
-                      [] : List Text
-                  , default-extensions =
-                      [] : List types.Extension
-                  , default-language =
-                      [] : Optional types.Language
-                  , exposed-modules =
-                      [] : List Text
-                  , extra-bundled-libs =
-                      [] : List Text
-                  , extra-framework-dirs =
-                      [] : List Text
-                  , extra-ghci-libraries =
-                      [] : List Text
-                  , extra-lib-dirs =
-                      [] : List Text
-                  , extra-lib-flavours =
-                      [] : List Text
-                  , extra-libraries =
-                      [] : List Text
-                  , frameworks =
-                      [] : List Text
-                  , hs-source-dirs =
-                      [] : List Text
-                  , include-dirs =
-                      [] : List Text
-                  , includes =
-                      [] : List Text
-                  , install-includes =
-                      [] : List Text
-                  , js-sources =
-                      [] : List Text
-                  , ld-options =
-                      [] : List Text
-                  , mixins =
-                      [] : List types.Mixin
-                  , other-extensions =
-                      [] : List types.Extension
-                  , other-languages =
-                      [] : List types.Language
-                  , other-modules =
-                      [] : List Text
-                  , pkgconfig-depends =
-                      [] : List { name : Text, version : types.VersionRange }
-                  , profiling-options =
-                      prelude.defaults.CompilerOptions
-                  , reexported-modules =
-                      [] : List
-                           { name :
-                               Text
-                           , original :
-                               { name : Text, package : Optional Text }
-                           }
-                  , shared-options =
-                      prelude.defaults.CompilerOptions
-                  , signatures =
-                      [] : List Text
-                  , static-options =
-                      prelude.defaults.CompilerOptions
-                  , virtual-modules =
-                      [] : List Text
-                  }
-        ] : Optional (types.Config → types.Library)
-    , license =
-        < AllRightsReserved =
-            {=}
-        | GPL :
-            Optional types.Version
-        | AGPL :
-            Optional types.Version
-        | LGPL :
-            Optional types.Version
-        | BSD2 :
-            {}
-        | BSD3 :
-            {}
-        | BSD4 :
-            {}
-        | MIT :
-            {}
-        | ISC :
-            {}
-        | MPL :
-            types.Version
-        | Apache :
-            Optional types.Version
-        | PublicDomain :
-            {}
-        | Unspecified :
-            {}
-        | Other :
-            {}
-        | SPDX :
-            types.SPDX
-        >
-    , license-files =
-        [] : List Text
-    , maintainer =
-        ""
-    , name =
-        "wai-servlet"
-    , package-url =
-        ""
-    , source-repos =
-        [] : List
-             { branch :
-                 Optional Text
-             , kind :
-                 types.RepoKind
-             , location :
-                 Optional Text
-             , module :
-                 Optional Text
-             , subdir :
-                 Optional Text
-             , tag :
-                 Optional Text
-             , type :
-                 Optional types.RepoType
-             }
-    , stability =
-        ""
-    , sub-libraries =
-        [] : List { library : types.Config → types.Library, name : Text }
-    , synopsis =
-        ""
-    , test-suites =
-        [] : List { name : Text, test-suite : types.Config → types.TestSuite }
-    , tested-with =
-        [] : List { compiler : types.Compiler, version : types.VersionRange }
-    , version =
-        prelude.v "0.1.5.0"
-    , x-fields =
-        [] : List { _1 : Text, _2 : Text }
-    }
+    let prelude = ./../../dhall/prelude.dhall
+
+in  let types = ./../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "wai-servlet"
+      , version =
+          prelude.v "0.1.5.0"
+      , flags =
+          [ { default =
+                False
+            , description =
+                "print debug output. not suitable for production"
+            , manual =
+                False
+            , name =
+                "wai-servlet-debug"
+            }
+          ]
+      , cabal-version =
+          prelude.v "2.0"
+      , library =
+          [   λ(config : types.Config)
+            →       if config.impl
+                       (prelude.types.Compilers.GHC {=})
+                       ( prelude.unionVersionRanges
+                         (prelude.thisVersion (prelude.v "0.0.9.7"))
+                         (prelude.laterVersion (prelude.v "0.0.9.7"))
+                       )
+              
+              then        if config.impl
+                             (prelude.types.Compilers.GHC {=})
+                             (prelude.earlierVersion (prelude.v "0.7.0.2"))
+                    
+                    then        if config.impl
+                                   (prelude.types.Compilers.GHC {=})
+                                   ( prelude.unionVersionRanges
+                                     (prelude.thisVersion (prelude.v "0.0.9"))
+                                     (prelude.laterVersion (prelude.v "0.0.9"))
+                                   )
+                          
+                          then        if config.flag "wai-servlet-debug"
+                                
+                                then    prelude.defaults.Library
+                                      ⫽ { c-sources =
+                                            [ "java/Utils.java" ]
+                                        , cpp-options =
+                                            [ "-DINTEROP"
+                                            , "-DPURE_JAVA_WITH"
+                                            , "-DWAI_SERVLET_DEBUG"
+                                            ]
+                                        }
+                                
+                                else    prelude.defaults.Library
+                                      ⫽ { c-sources =
+                                            [ "java/Utils.java" ]
+                                        , cpp-options =
+                                            [ "-DINTEROP", "-DPURE_JAVA_WITH" ]
+                                        }
+                          
+                          else  if config.flag "wai-servlet-debug"
+                          
+                          then    prelude.defaults.Library
+                                ⫽ { cpp-options =
+                                      [ "-DINTEROP"
+                                      , "-DPURE_JAVA_WITH"
+                                      , "-DWAI_SERVLET_DEBUG"
+                                      ]
+                                  }
+                          
+                          else    prelude.defaults.Library
+                                ⫽ { cpp-options =
+                                      [ "-DINTEROP", "-DPURE_JAVA_WITH" ]
+                                  }
+                    
+                    else  if config.impl
+                             (prelude.types.Compilers.GHC {=})
+                             ( prelude.unionVersionRanges
+                               (prelude.thisVersion (prelude.v "0.0.9"))
+                               (prelude.laterVersion (prelude.v "0.0.9"))
+                             )
+                    
+                    then        if config.flag "wai-servlet-debug"
+                          
+                          then    prelude.defaults.Library
+                                ⫽ { c-sources =
+                                      [ "java/Utils.java" ]
+                                  , cpp-options =
+                                      [ "-DINTEROP", "-DWAI_SERVLET_DEBUG" ]
+                                  }
+                          
+                          else    prelude.defaults.Library
+                                ⫽ { c-sources =
+                                      [ "java/Utils.java" ]
+                                  , cpp-options =
+                                      [ "-DINTEROP" ]
+                                  }
+                    
+                    else  if config.flag "wai-servlet-debug"
+                    
+                    then    prelude.defaults.Library
+                          ⫽ { cpp-options =
+                                [ "-DINTEROP", "-DWAI_SERVLET_DEBUG" ]
+                            }
+                    
+                    else    prelude.defaults.Library
+                          ⫽ { cpp-options = [ "-DINTEROP" ] }
+              
+              else  if config.impl
+                       (prelude.types.Compilers.GHC {=})
+                       (prelude.earlierVersion (prelude.v "0.7.0.2"))
+              
+              then        if config.impl
+                             (prelude.types.Compilers.GHC {=})
+                             ( prelude.unionVersionRanges
+                               (prelude.thisVersion (prelude.v "0.0.9"))
+                               (prelude.laterVersion (prelude.v "0.0.9"))
+                             )
+                    
+                    then        if config.flag "wai-servlet-debug"
+                          
+                          then    prelude.defaults.Library
+                                ⫽ { c-sources =
+                                      [ "java/Utils.java" ]
+                                  , cpp-options =
+                                      [ "-DPURE_JAVA_WITH"
+                                      , "-DWAI_SERVLET_DEBUG"
+                                      ]
+                                  }
+                          
+                          else    prelude.defaults.Library
+                                ⫽ { c-sources =
+                                      [ "java/Utils.java" ]
+                                  , cpp-options =
+                                      [ "-DPURE_JAVA_WITH" ]
+                                  }
+                    
+                    else  if config.flag "wai-servlet-debug"
+                    
+                    then    prelude.defaults.Library
+                          ⫽ { cpp-options =
+                                [ "-DPURE_JAVA_WITH", "-DWAI_SERVLET_DEBUG" ]
+                            }
+                    
+                    else    prelude.defaults.Library
+                          ⫽ { cpp-options = [ "-DPURE_JAVA_WITH" ] }
+              
+              else  if config.impl
+                       (prelude.types.Compilers.GHC {=})
+                       ( prelude.unionVersionRanges
+                         (prelude.thisVersion (prelude.v "0.0.9"))
+                         (prelude.laterVersion (prelude.v "0.0.9"))
+                       )
+              
+              then        if config.flag "wai-servlet-debug"
+                    
+                    then    prelude.defaults.Library
+                          ⫽ { c-sources =
+                                [ "java/Utils.java" ]
+                            , cpp-options =
+                                [ "-DWAI_SERVLET_DEBUG" ]
+                            }
+                    
+                    else    prelude.defaults.Library
+                          ⫽ { c-sources = [ "java/Utils.java" ] }
+              
+              else  if config.flag "wai-servlet-debug"
+              
+              then    prelude.defaults.Library
+                    ⫽ { cpp-options = [ "-DWAI_SERVLET_DEBUG" ] }
+              
+              else  prelude.defaults.Library
+          ] : Optional (types.Config → types.Library)
+      }
diff --git a/golden-tests/cabal-to-dhall/otheros.cabal b/golden-tests/cabal-to-dhall/otheros.cabal
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/otheros.cabal
@@ -0,0 +1,10 @@
+cabal-version: 2.0
+name: test
+version: 0
+
+library
+  exposed-modules:
+    A
+  if os(multics)
+    exposed-modules:
+      B
diff --git a/golden-tests/cabal-to-dhall/otheros.dhall b/golden-tests/cabal-to-dhall/otheros.dhall
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/otheros.dhall
@@ -0,0 +1,21 @@
+    let prelude = ./../../dhall/prelude.dhall
+
+in  let types = ./../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "test"
+      , version =
+          prelude.v "0"
+      , cabal-version =
+          prelude.v "2.0"
+      , library =
+          [   λ(config : types.Config)
+            →       if config.os (prelude.types.OSs.OtherOS { _1 = "multics" })
+              
+              then    prelude.defaults.Library
+                    ⫽ { exposed-modules = [ "A", "B" ] }
+              
+              else  prelude.defaults.Library ⫽ { exposed-modules = [ "A" ] }
+          ] : Optional (types.Config → types.Library)
+      }
diff --git a/golden-tests/cabal-to-dhall/simple.dhall b/golden-tests/cabal-to-dhall/simple.dhall
--- a/golden-tests/cabal-to-dhall/simple.dhall
+++ b/golden-tests/cabal-to-dhall/simple.dhall
@@ -1,116 +1,12 @@
-    let prelude = ../../dhall/prelude.dhall 
+    let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ../../dhall/types.dhall 
+in  let types = ./../../dhall/types.dhall
 
-in  { author =
-        ""
-    , benchmarks =
-        [] : List { benchmark : types.Config → types.Benchmark, name : Text }
-    , bug-reports =
-        ""
-    , build-type =
-        [] : Optional types.BuildType
-    , cabal-version =
-        prelude.v "2.0"
-    , category =
-        ""
-    , copyright =
-        ""
-    , custom-setup =
-        [] : Optional types.CustomSetup
-    , data-dir =
-        ""
-    , data-files =
-        [] : List Text
-    , description =
-        ""
-    , executables =
-        [] : List { executable : types.Config → types.Executable, name : Text }
-    , extra-doc-files =
-        [] : List Text
-    , extra-source-files =
-        [] : List Text
-    , extra-tmp-files =
-        [] : List Text
-    , flags =
-        [] : List
-             { default : Bool, description : Text, manual : Bool, name : Text }
-    , foreign-libraries =
-        [] : List
-             { foreign-lib : types.Config → types.ForeignLibrary, name : Text }
-    , homepage =
-        ""
-    , library =
-        [] : Optional (types.Config → types.Library)
-    , license =
-        < AllRightsReserved =
-            {=}
-        | GPL :
-            Optional types.Version
-        | AGPL :
-            Optional types.Version
-        | LGPL :
-            Optional types.Version
-        | BSD2 :
-            {}
-        | BSD3 :
-            {}
-        | BSD4 :
-            {}
-        | MIT :
-            {}
-        | ISC :
-            {}
-        | MPL :
-            types.Version
-        | Apache :
-            Optional types.Version
-        | PublicDomain :
-            {}
-        | Unspecified :
-            {}
-        | Other :
-            {}
-        | SPDX :
-            types.SPDX
-        >
-    , license-files =
-        [] : List Text
-    , maintainer =
-        ""
-    , name =
-        "test"
-    , package-url =
-        ""
-    , source-repos =
-        [] : List
-             { branch :
-                 Optional Text
-             , kind :
-                 types.RepoKind
-             , location :
-                 Optional Text
-             , module :
-                 Optional Text
-             , subdir :
-                 Optional Text
-             , tag :
-                 Optional Text
-             , type :
-                 Optional types.RepoType
-             }
-    , stability =
-        ""
-    , sub-libraries =
-        [] : List { library : types.Config → types.Library, name : Text }
-    , synopsis =
-        ""
-    , test-suites =
-        [] : List { name : Text, test-suite : types.Config → types.TestSuite }
-    , tested-with =
-        [] : List { compiler : types.Compiler, version : types.VersionRange }
-    , version =
-        prelude.v "1.0"
-    , x-fields =
-        [] : List { _1 : Text, _2 : Text }
-    }
+in    prelude.defaults.Package
+    ⫽ { name =
+          "test"
+      , version =
+          prelude.v "1.0"
+      , cabal-version =
+          prelude.v "2.0"
+      }
diff --git a/golden-tests/cabal-to-dhall/sourcerepo-defaults.cabal b/golden-tests/cabal-to-dhall/sourcerepo-defaults.cabal
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/sourcerepo-defaults.cabal
@@ -0,0 +1,11 @@
+cabal-version: 2.2
+name: test
+version: 0
+
+source-repository head
+  type: git
+  location: example.com
+
+source-repository this
+  type: darcs
+  location: example.org
diff --git a/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall b/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall
new file mode 100644
--- /dev/null
+++ b/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall
@@ -0,0 +1,26 @@
+    let prelude = ./../../dhall/prelude.dhall
+
+in  let types = ./../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "test"
+      , version =
+          prelude.v "0"
+      , source-repos =
+          [   prelude.defaults.SourceRepo
+            ⫽ { type =
+                  [ prelude.types.RepoType.Git {=} ] : Optional types.RepoType
+              , location =
+                  [ "example.com" ] : Optional Text
+              }
+          ,   prelude.defaults.SourceRepo
+            ⫽ { type =
+                  [ prelude.types.RepoType.Darcs {=} ] : Optional types.RepoType
+              , location =
+                  [ "example.org" ] : Optional Text
+              , kind =
+                  prelude.types.RepoKind.RepoThis {=}
+              }
+          ]
+      }
diff --git a/golden-tests/dhall-to-cabal/SPDX.cabal b/golden-tests/dhall-to-cabal/SPDX.cabal
--- a/golden-tests/dhall-to-cabal/SPDX.cabal
+++ b/golden-tests/dhall-to-cabal/SPDX.cabal
@@ -2,6 +2,5 @@
 name: foo
 version: 0
 license: (AGPL-3.0-or-later OR Apache-2.0+ WITH Classpath-exception-2.0) AND (LicenseRef-MyFancyLicense OR DocumentRef-LICENSE.txt:LicenseRef-MyFancierLicense)
-build-type: Simple
 
 library
diff --git a/golden-tests/dhall-to-cabal/compiler-options-order.cabal b/golden-tests/dhall-to-cabal/compiler-options-order.cabal
--- a/golden-tests/dhall-to-cabal/compiler-options-order.cabal
+++ b/golden-tests/dhall-to-cabal/compiler-options-order.cabal
@@ -1,10 +1,12 @@
+cabal-version: 2.2
 name: Name
 version: 1
-cabal-version: 2.0
-build-type: Simple
-license: UnspecifiedLicense
+license: NONE
 
 library
+    exposed-modules:
+        Foo
+        Bar
     
     if impl(ghc >=8.2)
         
@@ -18,8 +20,3 @@
             ghc-options: A C E F
         else
             ghc-options: A F
-    exposed-modules:
-        Foo
-        Bar
-
-
diff --git a/golden-tests/dhall-to-cabal/compiler-options-order.dhall b/golden-tests/dhall-to-cabal/compiler-options-order.dhall
--- a/golden-tests/dhall-to-cabal/compiler-options-order.dhall
+++ b/golden-tests/dhall-to-cabal/compiler-options-order.dhall
@@ -12,7 +12,7 @@
 // { name =
        "Name"
    , version =
-       ./dhall/types/Version/v.dhall  "1"
+       ./dhall/Version/v.dhall  "1"
    , library =
         [ \ ( config : types.Config )
          -> prelude.defaults.Library
diff --git a/golden-tests/dhall-to-cabal/conditional-dependencies.cabal b/golden-tests/dhall-to-cabal/conditional-dependencies.cabal
--- a/golden-tests/dhall-to-cabal/conditional-dependencies.cabal
+++ b/golden-tests/dhall-to-cabal/conditional-dependencies.cabal
@@ -1,10 +1,11 @@
+cabal-version: 2.2
 name: Name
 version: 1
-cabal-version: 2.0
-build-type: Simple
-license: UnspecifiedLicense
+license: NONE
 
 library
+    build-depends:
+        A -any
     
     if impl(ghc >=8.2)
         build-depends:
@@ -15,7 +16,3 @@
         build-depends:
             C -any
     else
-    build-depends:
-        A -any
-
-
diff --git a/golden-tests/dhall-to-cabal/conditional-dependencies.dhall b/golden-tests/dhall-to-cabal/conditional-dependencies.dhall
--- a/golden-tests/dhall-to-cabal/conditional-dependencies.dhall
+++ b/golden-tests/dhall-to-cabal/conditional-dependencies.dhall
@@ -12,7 +12,7 @@
 // { name =
        "Name"
    , version =
-       ./dhall/types/Version/v.dhall  "1"
+       ./dhall/Version/v.dhall  "1"
    , library =
         [ \ ( config : types.Config )
          -> prelude.defaults.Library
diff --git a/golden-tests/dhall-to-cabal/dhall-to-cabal.cabal b/golden-tests/dhall-to-cabal/dhall-to-cabal.cabal
--- a/golden-tests/dhall-to-cabal/dhall-to-cabal.cabal
+++ b/golden-tests/dhall-to-cabal/dhall-to-cabal.cabal
@@ -1,7 +1,6 @@
+cabal-version: 2.2
 name: dhall-to-cabal
 version: 1.0.0
-cabal-version: 2.0
-build-type: Simple
 license: MIT
 license-file: LICENSE
 maintainer: ollie@ocharles.org.uk
@@ -9,9 +8,9 @@
 bug-reports: https://github.com/ocharles/dhall-to-cabal/issues
 synopsis: Compile Dhall expressions to Cabal files
 description:
-    dhall-to-cabal takes Dhall expressions and compiles them into Cabal 
+    dhall-to-cabal takes Dhall expressions and compiles them into Cabal
     files. All of the features of Dhall are supported, such as let
-    bindings and imports, and all features of Cabal are supported 
+    bindings and imports, and all features of Cabal are supported
     (including conditional stanzas).
     .
 category: Distribution
@@ -81,6 +80,15 @@
 library
     exposed-modules:
         DhallToCabal
+    hs-source-dirs: lib
+    other-modules:
+        DhallToCabal.ConfigTree
+        DhallToCabal.Diff
+        Dhall.Extra
+    default-language: Haskell2010
+    other-extensions: ApplicativeDo GADTs GeneralizedNewtypeDeriving
+                      LambdaCase OverloadedStrings RecordWildCards TypeApplications
+    ghc-options: -Wall -fno-warn-name-shadowing
     build-depends:
         Cabal ^>=2.0,
         base ^>=4.10,
@@ -94,19 +102,12 @@
         transformers ^>=0.5.2,
         trifecta ^>=1.7,
         vector ^>=0.12
-    default-language: Haskell2010
-    other-extensions: ApplicativeDo GADTs GeneralizedNewtypeDeriving
-                      LambdaCase OverloadedStrings RecordWildCards TypeApplications
-    hs-source-dirs: lib
-    other-modules:
-        DhallToCabal.ConfigTree
-        DhallToCabal.Diff
-        Dhall.Extra
-    ghc-options: -Wall -fno-warn-name-shadowing
 
-executable  dhall-to-cabal
+executable dhall-to-cabal
     main-is: Main.hs
-    scope: public
+    hs-source-dirs: exe
+    default-language: Haskell2010
+    other-extensions: NamedFieldPuns
     build-depends:
         Cabal ^>=2.0,
         base ^>=4.10,
@@ -115,13 +116,12 @@
         optparse-applicative ^>=0.13.2 || ^>=0.14,
         prettyprinter ^>=1.2.0.1,
         text ^>=1.2
-    default-language: Haskell2010
-    other-extensions: NamedFieldPuns
-    hs-source-dirs: exe
 
-executable  cabal-to-dhall
+executable cabal-to-dhall
     main-is: Main.hs
-    scope: public
+    hs-source-dirs: cabal-to-dhall
+    default-language: Haskell2010
+    other-extensions: NamedFieldPuns
     build-depends:
         Cabal ^>=2.0,
         base ^>=4.10,
@@ -133,13 +133,12 @@
         optparse-applicative ^>=0.13.2 || ^>=0.14,
         prettyprinter ^>=1.2.0.1,
         text ^>=1.2
-    default-language: Haskell2010
-    other-extensions: NamedFieldPuns
-    hs-source-dirs: cabal-to-dhall
 
-test-suite  golden-tests
+test-suite golden-tests
     type: exitcode-stdio-1.0
     main-is: GoldenTests.hs
+    hs-source-dirs: golden-tests
+    default-language: Haskell2010
     build-depends:
         base ^>=4.10,
         Cabal ^>=2.0,
@@ -150,6 +149,3 @@
         tasty ^>=0.11,
         tasty-golden ^>=2.3,
         text ^>=1.2
-    default-language: Haskell2010
-    hs-source-dirs: golden-tests
-
diff --git a/golden-tests/dhall-to-cabal/empty-package.cabal b/golden-tests/dhall-to-cabal/empty-package.cabal
--- a/golden-tests/dhall-to-cabal/empty-package.cabal
+++ b/golden-tests/dhall-to-cabal/empty-package.cabal
@@ -1,10 +1,7 @@
+cabal-version: 2.2
 name: Name
 version: 1
-cabal-version: 2.0
-build-type: Simple
-license: UnspecifiedLicense
+license: NONE
 
-executable  foo
+executable foo
     main-is: Main.hs
-    scope: public
-
diff --git a/golden-tests/dhall-to-cabal/empty-package.dhall b/golden-tests/dhall-to-cabal/empty-package.dhall
--- a/golden-tests/dhall-to-cabal/empty-package.dhall
+++ b/golden-tests/dhall-to-cabal/empty-package.dhall
@@ -2,7 +2,7 @@
 ⫽ { name =
       "Name"
   , version =
-      ./dhall/types/Version/v.dhall  "1"
+      ./dhall/Version/v.dhall  "1"
   , executables =
       [ { name =
             "foo"
diff --git a/golden-tests/dhall-to-cabal/gh-53.cabal b/golden-tests/dhall-to-cabal/gh-53.cabal
--- a/golden-tests/dhall-to-cabal/gh-53.cabal
+++ b/golden-tests/dhall-to-cabal/gh-53.cabal
@@ -1,8 +1,7 @@
+cabal-version: 2.0
 name: wai-servlet
 version: 0.1.5.0
-cabal-version: 2.0
-build-type: Simple
-license: UnspecifiedLicense
+license: AllRightsReserved
 
 flag wai-servlet-debug
     description:
@@ -19,5 +18,3 @@
     if flag(wai-servlet-debug)
         cpp-options: -DWAI_SERVLET_DEBUG
     else
-
-
diff --git a/golden-tests/dhall-to-cabal/gh-55.cabal b/golden-tests/dhall-to-cabal/gh-55.cabal
--- a/golden-tests/dhall-to-cabal/gh-55.cabal
+++ b/golden-tests/dhall-to-cabal/gh-55.cabal
@@ -1,10 +1,11 @@
+cabal-version: 2.2
 name: Name
 version: 1
-cabal-version: 2.0
-build-type: Simple
-license: UnspecifiedLicense
+license: NONE
 
 library
+    exposed-modules:
+        Module1
     
     if impl(ghc >=7.1.3)
         exposed-modules:
@@ -13,7 +14,3 @@
         other-modules:
             OtherModule
     else
-    exposed-modules:
-        Module1
-
-
diff --git a/golden-tests/dhall-to-cabal/gh-55.dhall b/golden-tests/dhall-to-cabal/gh-55.dhall
--- a/golden-tests/dhall-to-cabal/gh-55.dhall
+++ b/golden-tests/dhall-to-cabal/gh-55.dhall
@@ -12,7 +12,7 @@
 // { name =
        "Name"
    , version =
-       ./dhall/types/Version/v.dhall  "1"
+       ./dhall/Version/v.dhall  "1"
    , library =
         [ \ ( config : types.Config )
          -> prelude.defaults.Library
diff --git a/golden-tests/dhall-to-cabal/map-source-repo.cabal b/golden-tests/dhall-to-cabal/map-source-repo.cabal
new file mode 100644
--- /dev/null
+++ b/golden-tests/dhall-to-cabal/map-source-repo.cabal
@@ -0,0 +1,14 @@
+cabal-version: 2.2
+name: repo
+version: 1.0.0
+license: NONE
+homepage: https://github.com/owner/repo
+bug-reports: https://github.com/owner/repo/issues
+
+source-repository this
+    type: git
+    location: https://github.com/owner/repo
+    tag: 1.0.0
+
+executable foo
+    main-is: Main.hs
diff --git a/golden-tests/dhall-to-cabal/map-source-repo.dhall b/golden-tests/dhall-to-cabal/map-source-repo.dhall
new file mode 100644
--- /dev/null
+++ b/golden-tests/dhall-to-cabal/map-source-repo.dhall
@@ -0,0 +1,33 @@
+    let prelude = ./dhall/prelude.dhall
+
+in  let types = ./dhall/types.dhall
+
+in  let updateRepo =
+          prelude.utils.mapSourceRepos
+          (   λ(srcRepo : types.SourceRepo)
+            →   srcRepo
+              ⫽ { tag =
+                    [ "1.0.0" ] : Optional Text
+                , kind =
+                    prelude.types.RepoKind.RepoThis {=}
+                }
+          )
+
+in  let project =
+          prelude.utils.GitHub-project { owner = "owner", repo = "repo" }
+
+in  updateRepo
+    (   project
+      ⫽ { version =
+            prelude.v "1.0.0"
+        , executables =
+            [ { name =
+                  "foo"
+              , executable =
+                    λ(config : ./dhall/types/Config.dhall)
+                  → ./dhall/defaults/Executable.dhall
+				  ⫽ { main-is = "Main.hs" }
+              }
+            ]
+        }
+    )
diff --git a/golden-tests/dhall-to-cabal/nested-conditions.cabal b/golden-tests/dhall-to-cabal/nested-conditions.cabal
--- a/golden-tests/dhall-to-cabal/nested-conditions.cabal
+++ b/golden-tests/dhall-to-cabal/nested-conditions.cabal
@@ -1,15 +1,15 @@
+cabal-version: 2.2
 name: foo
 version: 0
-cabal-version: 2.0
-build-type: Simple
-license: UnspecifiedLicense
+license: NONE
 
 library
     
     if impl(ghc >=8.2)
         
         if impl(ghc >=8.4)
-            ghc-options: -Weverything -Wno-redundant-constraints -Wno-missing-export-lists
+            ghc-options: -Weverything -Wno-redundant-constraints
+                         -Wno-missing-export-lists
         else
             ghc-options: -Weverything -Wno-redundant-constraints
     else
@@ -18,5 +18,3 @@
             ghc-options: -Weverything -Wno-missing-export-lists
         else
             ghc-options: -Weverything
-
-
diff --git a/lib/CabalToDhall.hs b/lib/CabalToDhall.hs
--- a/lib/CabalToDhall.hs
+++ b/lib/CabalToDhall.hs
@@ -7,22 +7,23 @@
 
 module CabalToDhall
   ( cabalToDhall
+  , parseGenericPackageDescriptionThrows
   ) where
 
-import Control.Monad ( join )
 import Data.Foldable ( foldMap )
 import Data.Functor.Contravariant ( (>$<), Contravariant( contramap ) )
 import Data.Monoid ( First(..) )
-import Data.Semigroup ( Semigroup )
+import Data.Semigroup ( Semigroup, (<>) )
 import GHC.Stack
 import Numeric.Natural ( Natural )
 
 import qualified Data.ByteString as ByteString
 import qualified Data.HashMap.Strict.InsOrd as Map
-import qualified Data.Text.Lazy as LazyText
+import qualified Data.Sequence as Seq
+import qualified Data.Text as StrictText
 import qualified Dhall
 import qualified Dhall.Core
-import qualified Dhall.Core as Expr ( Expr(..) )
+import qualified Dhall.Core as Expr ( Expr(..), Var(..) )
 import qualified Dhall.Parser
 import qualified Dhall.TypeCheck
 import qualified Distribution.Compiler as Cabal
@@ -74,30 +75,303 @@
   Dhall.Core.Expr Dhall.Parser.Src Dhall.TypeCheck.X
 
 
-cabalToDhall :: DhallLocation -> ByteString.ByteString -> IO ( Expr.Expr Dhall.Parser.Src Dhall.Core.Import )
-cabalToDhall dhallLocation source =
+dhallString :: String -> Expr.Expr s a
+dhallString = Expr.TextLit . Dhall.Core.Chunks [] . StrictText.pack
+
+
+parseGenericPackageDescriptionThrows
+  :: ByteString.ByteString
+  -> IO Cabal.GenericPackageDescription
+parseGenericPackageDescriptionThrows source =
   case Cabal.runParseResult ( Cabal.parseGenericPackageDescription source ) of
     (_warnings, Left e) -> do
       putStrLn "Could not parse Cabal file: "
 
       error ( show e )
 
-    (_warnings, Right genericPackageDescription) -> do
-      let
-        dhall =
-          Expr.Let "prelude" Nothing ( Expr.Embed ( preludeLocation dhallLocation ) )
-          $ Expr.Let "types" Nothing ( Expr.Embed ( typesLocation dhallLocation ) )
-          $ Dhall.TypeCheck.absurd <$>
-              Dhall.embed
-                genericPackageDescriptionToDhall
-                genericPackageDescription
+    (_warnings, Right genericPackageDescription) ->
+      return genericPackageDescription
 
-      return dhall
 
+cabalToDhall
+  :: DhallLocation
+  -> Cabal.GenericPackageDescription
+  -> Expr.Expr Dhall.Parser.Src Dhall.Core.Import
+cabalToDhall dhallLocation genericPackageDescription =
+  Expr.Let "prelude" Nothing ( Expr.Embed ( preludeLocation dhallLocation ) )
+    $ Expr.Let "types" Nothing ( Expr.Embed ( typesLocation dhallLocation ) )
+    $ Dhall.TypeCheck.absurd <$>
+        Dhall.embed
+          genericPackageDescriptionToDhall
+          genericPackageDescription
 
+
+type Default s a = Map.InsOrdHashMap StrictText.Text ( Expr.Expr s a )
+
+
+emptyListDefault
+  :: StrictText.Text
+  -> Expr.Expr s a
+  -> ( StrictText.Text, Expr.Expr s a )
+emptyListDefault name ty =
+  ( name, Expr.ListLit ( Just ty ) mempty )
+
+
+emptyOptionalDefault
+  :: StrictText.Text
+  -> Expr.Expr s a
+  -> ( StrictText.Text, Expr.Expr s a )
+emptyOptionalDefault name ty =
+  ( name, Expr.OptionalLit ty Nothing )
+
+
+textFieldDefault
+  :: StrictText.Text
+  -> StrictText.Text
+  -> ( StrictText.Text, Expr.Expr s a )
+textFieldDefault name def =
+  ( name
+  , Expr.TextLit ( Dhall.Core.Chunks [] def )
+  )
+
+
+compilerOptionsDefault :: Default s a
+compilerOptionsDefault =
+  ( Map.fromList
+    [ emptyListDefault "GHC" Expr.Text
+    , emptyListDefault "GHCJS" Expr.Text
+    , emptyListDefault "HBC" Expr.Text
+    , emptyListDefault "Helium" Expr.Text
+    , emptyListDefault "Hugs" Expr.Text
+    , emptyListDefault "JHC" Expr.Text
+    , emptyListDefault "LHC" Expr.Text
+    , emptyListDefault "NHC" Expr.Text
+    , emptyListDefault "UHC" Expr.Text
+    , emptyListDefault "YHC" Expr.Text
+    ]
+  )
+
+
+buildInfoDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+buildInfoDefault = Map.fromList
+  [ emptyListDefault "autogen-modules" Expr.Text
+  , emptyListDefault "build-depends" ( Dhall.declared dependency )
+  , emptyListDefault "build-tool-depends" ( Dhall.declared exeDependency )
+  , emptyListDefault "build-tools" ( Dhall.declared legacyExeDependency )
+  , ( "buildable", Expr.BoolLit True )
+  , emptyListDefault "c-sources" Expr.Text
+  , emptyListDefault "cc-options" Expr.Text
+  , ( "compiler-options", Expr.Var "prelude" `Expr.Field` "defaults" `Expr.Field` "CompilerOptions" )
+  , emptyListDefault "cpp-options" Expr.Text
+  , emptyListDefault "default-extensions" ( Dhall.declared extension )
+  , emptyOptionalDefault "default-language" ( Dhall.declared language )
+  , emptyListDefault "extra-framework-dirs" Expr.Text
+  , emptyListDefault "extra-ghci-libraries" Expr.Text
+  , emptyListDefault "extra-lib-dirs" Expr.Text
+  , emptyListDefault "extra-libraries" Expr.Text
+  , emptyListDefault "frameworks" Expr.Text
+  , emptyListDefault "hs-source-dirs" Expr.Text
+  , emptyListDefault "includes" Expr.Text
+  , emptyListDefault "include-dirs" Expr.Text
+  , emptyListDefault "install-includes" Expr.Text
+  , emptyListDefault "js-sources" Expr.Text
+  , emptyListDefault "ld-options" Expr.Text
+  , emptyListDefault "other-extensions" ( Dhall.declared extension )
+  , emptyListDefault "other-languages" ( Dhall.declared language )
+  , emptyListDefault "other-modules" Expr.Text
+  , emptyListDefault "pkgconfig-depends" ( Dhall.declared pkgconfigDependency )
+  , ( "profiling-options", Expr.Var "prelude" `Expr.Field` "defaults" `Expr.Field` "CompilerOptions" )
+  , ( "shared-options", Expr.Var "prelude" `Expr.Field` "defaults" `Expr.Field` "CompilerOptions" )
+  , ( "static-options", Expr.Var "prelude" `Expr.Field` "defaults" `Expr.Field` "CompilerOptions" )
+  , emptyListDefault "mixins" ( Dhall.declared mixin )
+  , emptyListDefault "asm-options" Expr.Text
+  , emptyListDefault "asm-sources" Expr.Text
+  , emptyListDefault "cmm-options" Expr.Text
+  , emptyListDefault "cmm-sources" Expr.Text
+  , emptyListDefault "cxx-options" Expr.Text
+  , emptyListDefault "cxx-sources" Expr.Text
+  , emptyListDefault "virtual-modules" Expr.Text
+  , emptyListDefault "extra-lib-flavours" Expr.Text
+  , emptyListDefault "extra-bundled-libs" Expr.Text
+  ]
+
+
+libraryDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+libraryDefault = buildInfoDefault <> specificFields
+  where
+    specificFields = Map.fromList
+      [ emptyListDefault "exposed-modules" Expr.Text
+      , emptyListDefault "other-modules" Expr.Text
+      , emptyListDefault "reexported-modules" ( Dhall.declared moduleReexport )
+      , emptyListDefault "signatures" Expr.Text
+      ]
+
+
+benchmarkDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+benchmarkDefault = buildInfoDefault
+
+
+testSuiteDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+testSuiteDefault = buildInfoDefault
+
+
+executableDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+executableDefault = buildInfoDefault <> specificFields
+  where
+    specificFields =
+      Map.singleton "scope"
+        ( Expr.UnionLit "Public" ( Expr.RecordLit mempty )
+            ( Map.singleton "Private" ( Expr.Record mempty ) )
+        )
+
+
+packageDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+packageDefault = fields
+  where
+    named name typ = Expr.Record
+      ( Map.fromList
+          [ ( "name"
+            , Expr.Text
+            )
+          , ( name
+            , Expr.Pi
+                "config"
+                ( Expr.Var "types" `Expr.Field` "Config" )
+                ( Dhall.declared typ )
+            )
+          ]
+      )
+
+    fields = Map.fromList
+      [ textFieldDefault "author" ""
+      , emptyListDefault "flags" ( Dhall.declared flag )
+      , emptyListDefault "benchmarks" ( named "benchmark" benchmark )
+      , textFieldDefault "bug-reports" ""
+      , emptyOptionalDefault "build-type" ( Dhall.declared buildType )
+      , ( "cabal-version"
+        , Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "v" )
+            ( Expr.TextLit ( Dhall.Core.Chunks [] "2.2" ) )
+        )
+      , textFieldDefault "category" ""
+      , textFieldDefault "copyright" ""
+      , textFieldDefault "data-dir" ""
+      , emptyListDefault "data-files" Expr.Text
+      , textFieldDefault "description" ""
+      , emptyListDefault "executables" ( named "executable" executable )
+      , emptyListDefault "extra-doc-files" Expr.Text
+      , emptyListDefault "extra-source-files" Expr.Text
+      , emptyListDefault "extra-tmp-files" Expr.Text
+      , emptyListDefault "foreign-libraries" ( named "foreign-lib" foreignLibrary )
+      , textFieldDefault "homepage" ""
+      , emptyOptionalDefault "library"
+          ( Expr.Pi
+              "config"
+              ( Expr.Var "types" `Expr.Field` "Config" )
+              ( Dhall.declared library )
+          )
+      , ( "license"
+        , Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Licenses" `Expr.Field` "AllRightsReserved" )
+            ( Expr.RecordLit mempty )
+        )
+      , emptyListDefault "license-files" Expr.Text
+      , textFieldDefault "maintainer" ""
+      , textFieldDefault "package-url" ""
+      , emptyListDefault "source-repos" ( Dhall.declared sourceRepo )
+      , textFieldDefault "stability" ""
+      , emptyListDefault "sub-libraries" ( named "library" library )
+      , textFieldDefault "synopsis" ""
+      , emptyListDefault "test-suites" ( named "test-suite" testSuite )
+      , emptyListDefault "tested-with"
+          ( Expr.Record
+              ( Map.fromList
+                  [ ( "compiler", Dhall.declared compilerFlavor )
+                  , ( "version", Dhall.declared versionRange )
+                  ]
+              )
+          )
+      , emptyListDefault "x-fields"
+          ( Expr.Record
+              ( Map.fromList
+                  [ ( "_1", Expr.Text ), ( "_2", Expr.Text ) ]
+              )
+          )
+      , emptyOptionalDefault "custom-setup" ( Dhall.declared setupBuildInfo )
+      ]
+
+
+sourceRepoDefault :: Default Dhall.Parser.Src Dhall.TypeCheck.X
+sourceRepoDefault = fields
+  where
+    fields = Map.fromList
+      [ emptyOptionalDefault "type" ( Dhall.declared repoType )
+      , emptyOptionalDefault "location" Expr.Text
+      , emptyOptionalDefault "module" Expr.Text
+      , emptyOptionalDefault "branch" Expr.Text
+      , emptyOptionalDefault "tag" Expr.Text
+      , emptyOptionalDefault "subdir" Expr.Text
+      , ( "kind"
+        , Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoKind" `Expr.Field` "RepoHead" )
+            ( Expr.RecordLit mempty )
+        )
+      ]
+
+
+data DefaultComparison s a
+  = DefaultComparisonMatch
+  | DefaultComparisonReplace ( Expr.Expr s a )
+  deriving ( Show )
+
+
+extractDefaultComparisonReplace
+  :: DefaultComparison s a
+  -> Maybe ( Expr.Expr s a )
+extractDefaultComparisonReplace DefaultComparisonMatch =
+  Nothing
+extractDefaultComparisonReplace ( DefaultComparisonReplace expr ) =
+  Just expr
+
+
+nonDefaultFields
+  :: ( Eq a )
+  => Map.InsOrdHashMap StrictText.Text ( Expr.Expr s a )
+  -> Map.InsOrdHashMap StrictText.Text ( Expr.Expr s a )
+  -> Map.InsOrdHashMap StrictText.Text ( Expr.Expr s a )
+nonDefaultFields defs fields =
+  let
+    withoutDefaults = Map.difference fields defs
+    compared = Map.intersectionWith compareToDefault defs fields
+    changed = Map.mapMaybe extractDefaultComparisonReplace compared
+  in
+    withoutDefaults <> changed
+
+
+compareToDefault :: ( Eq a ) => Expr.Expr s a -> Expr.Expr s a -> DefaultComparison s a
+compareToDefault def expr | Dhall.Core.judgmentallyEqual def expr =
+  DefaultComparisonMatch
+compareToDefault _ expr =
+  DefaultComparisonReplace expr
+
+
+withDefault :: ( Eq a ) => StrictText.Text -> Default s a -> Expr.Expr s a -> Expr.Expr s a
+withDefault name defs ( Expr.RecordLit fields ) =
+  let
+    nonDefaults = nonDefaultFields defs fields
+  in
+    if null nonDefaults
+    then Expr.Var ( Expr.V "prelude" 0 ) `Expr.Field` "defaults" `Expr.Field` name
+    else Expr.Prefer
+           ( Expr.Var ( Expr.V "prelude" 0 ) `Expr.Field` "defaults" `Expr.Field` name )
+           ( Expr.RecordLit nonDefaults )
+withDefault _ _ expr =
+  expr
+
+
 newtype RecordInputType a =
   RecordInputType
-    { unRecordInputType ::
+    { _unRecordInputType ::
         Map.InsOrdHashMap Dhall.Text ( Dhall.InputType a )
     }
   deriving ( Semigroup, Monoid )
@@ -122,6 +396,14 @@
     }
 
 
+runRecordInputTypeWithDefault :: StrictText.Text -> Default Dhall.Parser.Src Dhall.TypeCheck.X -> RecordInputType a -> Dhall.InputType a
+runRecordInputTypeWithDefault defName def m =
+  let
+    Dhall.InputType embed declared = runRecordInputType m
+  in
+    Dhall.InputType ( withDefault defName def . embed ) declared
+
+
 genericPackageDescriptionToDhall
   :: Dhall.InputType Cabal.GenericPackageDescription
 genericPackageDescriptionToDhall =
@@ -137,7 +419,7 @@
         )
 
   in
-  runRecordInputType
+  runRecordInputTypeWithDefault "Package" packageDefault
     ( mconcat
         [ Cabal.packageDescription >$< packageDescriptionToRecord
         , recordField "flags" ( Cabal.genPackageFlags >$< ( listOf flag ) )
@@ -223,98 +505,56 @@
 
 stringToDhall :: Dhall.InputType String
 stringToDhall =
-  contramap LazyText.pack Dhall.inject
-
+  contramap StrictText.pack Dhall.inject
 
 licenseToDhall :: Dhall.InputType (Either SPDX.License Cabal.License)
 licenseToDhall =
-  ( runUnion
-      ( mconcat
-          [ gpl
-          , agpl
-          , lgpl
-          , bsd2
-          , bsd3
-          , bsd4
-          , mit
-          , isc
-          , mpl
-          , apache
-          , publicDomain
-          , allRightsReserved
-          , unspecified
-          , other
-          , spdxLicense
-          -- , unknown
-          ]
-      )
-  )
-    { Dhall.declared =
+  Dhall.InputType
+    { Dhall.embed = \l ->
+        case l of
+          Right ( Cabal.GPL v ) ->
+            license "GPL" ( Dhall.embed ( maybeToDhall versionToDhall ) v )
+          Right ( Cabal.AGPL v ) ->
+            license "AGPL" ( Dhall.embed ( maybeToDhall versionToDhall ) v )
+          Right ( Cabal.LGPL v ) ->
+            license "LGPL" ( Dhall.embed ( maybeToDhall versionToDhall ) v )
+          Right Cabal.BSD2 ->
+            license "BSD2" ( Expr.RecordLit mempty )
+          Right Cabal.BSD3 ->
+            license "BSD3" ( Expr.RecordLit mempty )
+          Right Cabal.BSD4 ->
+            license "BSD4" ( Expr.RecordLit mempty )
+          Right Cabal.MIT ->
+            license "MIT" ( Expr.RecordLit mempty )
+          Right Cabal.ISC ->
+            license "ISC" ( Expr.RecordLit mempty )
+          Right ( Cabal.MPL v ) ->
+            license "MPL" ( Dhall.embed versionToDhall v )
+          Right ( Cabal.Apache v ) ->
+            license "Apache" ( Dhall.embed ( maybeToDhall versionToDhall ) v )
+          Right Cabal.PublicDomain ->
+            license "PublicDomain" ( Expr.RecordLit mempty )
+          Right Cabal.AllRightsReserved ->
+            license "AllRightsReserved" ( Expr.RecordLit mempty )
+          -- Note: SPDX.NONE is what Cabal reports for a file without
+          -- a 'license' field, even for pre-2.2 spec versions.
+          Left SPDX.NONE ->
+            license "AllRightsReserved" ( Expr.RecordLit mempty )
+          Right Cabal.UnspecifiedLicense ->
+            license "Unspecified" ( Expr.RecordLit mempty )
+          Right ( Cabal.UnknownLicense "UnspecifiedLicense" ) ->
+            license "Unspecified" ( Expr.RecordLit mempty )
+          Right Cabal.OtherLicense ->
+            license "Other" ( Expr.RecordLit mempty )
+          Left ( SPDX.License x ) ->
+            license "SPDX" ( Dhall.embed spdxLicenseExpressionToDhall x )
+    , Dhall.declared =
         Expr.Var "types" `Expr.Field` "License"
     }
-
   where
-
-    gpl =
-      unionAlt "GPL" ( \l -> case l of Right ( Cabal.GPL v ) -> Just v; _ -> Nothing ) ( maybeToDhall versionToDhall )
-
-    agpl =
-      unionAlt "AGPL" ( \l -> case l of Right ( Cabal.AGPL v ) -> Just v ; _ -> Nothing ) ( maybeToDhall versionToDhall )
-
-    lgpl =
-      unionAlt "LGPL" ( \l -> case l of Right ( Cabal.LGPL v ) -> Just v ; _ -> Nothing ) ( maybeToDhall versionToDhall )
-
-    bsd2 =
-      unionAlt "BSD2" ( \l -> case l of Right Cabal.BSD2 -> Just () ; _ -> Nothing ) Dhall.inject
-
-    bsd3 =
-      unionAlt "BSD3" ( \l -> case l of Right Cabal.BSD3 -> Just () ; _ -> Nothing ) Dhall.inject
-
-    bsd4 =
-      unionAlt "BSD4" ( \l -> case l of Right Cabal.BSD4 -> Just () ; _ -> Nothing ) Dhall.inject
-
-    mit =
-      unionAlt "MIT" ( \l -> case l of Right Cabal.MIT -> Just () ; _ -> Nothing ) Dhall.inject
-
-    isc =
-      unionAlt "ISC" ( \l -> case l of Right Cabal.ISC -> Just () ; _ -> Nothing ) Dhall.inject
-
-    mpl =
-      unionAlt "MPL" ( \l -> case l of Right ( Cabal.MPL v ) -> Just v ; _ -> Nothing ) versionToDhall
-
-    apache =
-      unionAlt "Apache" ( \l -> case l of Right ( Cabal.Apache v ) -> Just v ; _ -> Nothing ) ( maybeToDhall versionToDhall )
-
-    publicDomain =
-      unionAlt "PublicDomain" ( \l -> case l of Right Cabal.PublicDomain -> Just () ; _ -> Nothing ) Dhall.inject
-
-    allRightsReserved =
-      unionAlt "AllRightsReserved" ( \l -> case l of Right Cabal.AllRightsReserved -> Just () ; Left SPDX.NONE -> Just() ; _ -> Nothing ) Dhall.inject
-
-    unspecified =
-      unionAlt
-        "Unspecified"
-        ( \l ->
-            case l of
-              Right Cabal.UnspecifiedLicense ->
-                Just ()
-
-              Right ( Cabal.UnknownLicense "UnspecifiedLicense" ) ->
-                Just ()
-
-              _ ->
-                Nothing
-        )
-        Dhall.inject
-
-    other =
-      unionAlt "Other" ( \l -> case l of Right Cabal.OtherLicense -> Just () ; _ -> Nothing ) Dhall.inject
-
-    unknown =
-      unionAlt "Unknown" ( \l -> case l of Right ( Cabal.UnknownLicense s ) -> Just s ; _ -> Nothing ) stringToDhall
-
-    spdxLicense =
-      unionAlt "SPDX" ( \l -> case l of Left ( SPDX.License x ) -> Just x ; _ -> Nothing ) spdxLicenseExpressionToDhall
+    license name =
+      Expr.App
+        ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Licenses" `Expr.Field` name )
 
 spdxLicenseExpressionToDhall :: Dhall.InputType SPDX.LicenseExpression
 spdxLicenseExpressionToDhall =
@@ -387,9 +627,9 @@
 
   where
 
-  identName :: SPDX.LicenseId -> LazyText.Text
+  identName :: SPDX.LicenseId -> StrictText.Text
   identName e =
-    LazyText.pack ( show e )
+    StrictText.pack ( show e )
 
 spdxLicenseExceptionIdToDhall :: Dhall.InputType SPDX.LicenseExceptionId
 spdxLicenseExceptionIdToDhall =
@@ -404,13 +644,13 @@
 
   where
 
-  identName :: SPDX.LicenseExceptionId -> LazyText.Text
+  identName :: SPDX.LicenseExceptionId -> StrictText.Text
   identName e =
-    LazyText.pack ( show e )
+    StrictText.pack ( show e )
 
 newtype Union a =
   Union
-    { unUnion ::
+    { _unUnion ::
         ( a ->
           ( First ( Dhall.Text, DhallExpr )
           , Map.InsOrdHashMap Dhall.Text DhallExpr
@@ -445,7 +685,7 @@
           Nothing ->
             ( mempty, Map.singleton k ( Dhall.declared t ) )
 
-          Just b ->
+          Just _ ->
             ( First ( fmap ( \b -> ( k, Dhall.embed t b ) ) ( f a ) ), mempty )
     , Map.singleton k ( Dhall.declared t )
     )
@@ -482,12 +722,6 @@
     )
 
 
-instance {-# OVERLAPS #-} Dhall.Inject [Char] where
-  injectWith _ = stringToDhall
-
-instance Dhall.Inject Cabal.CompilerFlavor
-
-
 compilerFlavor :: Dhall.InputType Cabal.CompilerFlavor
 compilerFlavor =
   let
@@ -507,7 +741,8 @@
           constructor "HBC" ( Expr.RecordLit mempty )
 
         Cabal.HaskellSuite v ->
-          constructor "HaskellSuite" ( Expr.Record ( Map.singleton "_1" ( Dhall.embed Dhall.inject v ) ) )
+          constructor "HaskellSuite"
+          ( Expr.Record ( Map.singleton "_1" ( dhallString v ) ) )
 
         Cabal.Helium ->
           constructor "Helium" ( Expr.RecordLit mempty )
@@ -525,7 +760,8 @@
           constructor "NHC" ( Expr.RecordLit mempty )
 
         Cabal.OtherCompiler v ->
-          constructor "OtherCompiler" ( Expr.Record ( Map.singleton "_1" ( Dhall.embed Dhall.inject v ) ) )
+          constructor "OtherCompiler"
+          ( Expr.Record ( Map.singleton "_1" ( dhallString v ) ) )
 
         Cabal.UHC ->
           constructor "UHC" ( Expr.RecordLit mempty )
@@ -587,7 +823,7 @@
 
 sourceRepo :: Dhall.InputType Cabal.SourceRepo
 sourceRepo =
-  runRecordInputType
+  runRecordInputTypeWithDefault "SourceRepo" sourceRepoDefault
     ( mconcat
         [ recordField "kind" ( contramap Cabal.repoKind repoKind )
         , recordField "type" ( contramap Cabal.repoType ( maybeToDhall repoType ) )
@@ -602,38 +838,55 @@
 
 repoKind :: Dhall.InputType Cabal.RepoKind
 repoKind =
-  ( runUnion
-      ( mconcat
-          [ unionAlt "RepoThis" ( \x -> case x of Cabal.RepoThis -> Just () ; _ -> Nothing) Dhall.inject
-          , unionAlt "RepoKindUnknown" ( \x -> case x of Cabal.RepoKindUnknown str -> Just  str ; _ -> Nothing) ( runRecordInputType ( recordField "_1" stringToDhall ) )
-          , unionAlt "RepoHead" ( \x -> case x of Cabal.RepoHead -> Just () ; _ -> Nothing) Dhall.inject
-          ]
-      )
-  )
-    { Dhall.declared =
-         Expr.Var "types" `Expr.Field` "RepoKind"
+  Dhall.InputType
+    { Dhall.embed = \case
+        Cabal.RepoThis ->
+          Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoKind" `Expr.Field` "RepoThis" )
+            ( Expr.RecordLit mempty )
+        Cabal.RepoHead ->
+          Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoKind" `Expr.Field` "RepoHead" )
+            ( Expr.RecordLit mempty )
+        Cabal.RepoKindUnknown str ->
+          Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoKind" `Expr.Field` "RepoThis" )
+            ( Expr.RecordLit ( Map.singleton "_1" ( dhallString str ) ) )
+    , Dhall.declared =
+        Expr.Var "types" `Expr.Field` "RepoKind"
     }
 
 
 repoType :: Dhall.InputType Cabal.RepoType
 repoType =
-  ( runUnion
-      ( mconcat
-          [ unionAlt "Darcs" ( \x -> case x of Cabal.Darcs -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "Git" ( \x -> case x of Cabal.Git -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "SVN" ( \x -> case x of Cabal.SVN -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "CVS" ( \x -> case x of Cabal.CVS -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "Mercurial" ( \x -> case x of Cabal.Mercurial -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "GnuArch" ( \x -> case x of Cabal.GnuArch -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "Monotone" ( \x -> case x of Cabal.Monotone -> Just () ; _ -> Nothing ) Dhall.inject
-          , unionAlt "OtherRepoType" ( \x -> case x of Cabal.OtherRepoType s -> Just s ; _ -> Nothing ) ( runRecordInputType ( recordField "_1" stringToDhall ) )
-          , unionAlt "Bazaar" ( \x -> case x of Cabal.Bazaar -> Just () ; _ -> Nothing ) Dhall.inject
-          ]
-      )
-  )
-    { Dhall.declared =
+  Dhall.InputType
+    { Dhall.embed = \case
+        Cabal.Darcs ->
+          Expr.App ( constr "Darcs" ) ( Expr.RecordLit mempty )
+        Cabal.Git ->
+          Expr.App ( constr "Git" ) ( Expr.RecordLit mempty )
+        Cabal.SVN ->
+          Expr.App ( constr "SVN" ) ( Expr.RecordLit mempty )
+        Cabal.CVS ->
+          Expr.App ( constr "CVS" ) ( Expr.RecordLit mempty )
+        Cabal.Mercurial ->
+          Expr.App ( constr "Mercurial" ) ( Expr.RecordLit mempty )
+        Cabal.GnuArch ->
+          Expr.App ( constr "GnuArch" ) ( Expr.RecordLit mempty )
+        Cabal.Monotone ->
+          Expr.App ( constr "Monotone" ) ( Expr.RecordLit mempty )
+        Cabal.Bazaar ->
+          Expr.App ( constr "Bazaar" ) ( Expr.RecordLit mempty )
+        Cabal.OtherRepoType str ->
+          Expr.App
+            ( constr "OtherRepoType" )
+            ( Expr.RecordLit ( Map.singleton "_1" ( dhallString str ) ) )
+    , Dhall.declared =
         Expr.Var "types" `Expr.Field` "RepoType"
     }
+  where
+    constr name =
+      Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoType" `Expr.Field` name
 
 
 specVersion :: Dhall.InputType ( Either Cabal.Version Cabal.VersionRange )
@@ -715,7 +968,7 @@
 
 library :: Dhall.InputType Cabal.Library
 library =
-  ( runRecordInputType
+  ( runRecordInputTypeWithDefault "Library" libraryDefault
       ( mconcat
           [ contramap Cabal.libBuildInfo buildInfoRecord
           , recordField
@@ -759,7 +1012,7 @@
 
 
 condTree
-  :: ( Monoid a, Monoid x )
+  :: ( Monoid a )
   => Dhall.InputType a
   -> Dhall.InputType ( Cabal.CondTree Cabal.ConfVar x a )
 condTree t =
@@ -910,6 +1163,11 @@
             ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Ghcjs" )
             ( Expr.RecordLit mempty )
 
+        Cabal.OtherOS os ->
+          Expr.App
+            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "OtherOS" )
+            ( Expr.RecordLit ( Map.singleton "_1" ( dhallString os ) ) )
+
     , Dhall.declared =
         Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OS"
     }
@@ -1077,9 +1335,9 @@
 
   where
 
-  extName :: Cabal.KnownExtension -> LazyText.Text
+  extName :: Cabal.KnownExtension -> StrictText.Text
   extName e =
-    LazyText.pack ( show e )
+    StrictText.pack ( show e )
 
   extWith trueFalse ext =
     Expr.App
@@ -1090,39 +1348,25 @@
 compilerOptions :: Dhall.InputType [ ( Cabal.CompilerFlavor, [ String ] ) ]
 compilerOptions =
   Dhall.InputType
-    { Dhall.embed = \l ->
-        case filter ( not . null . snd ) l of
-          [] ->
-            Expr.Var "prelude" `Expr.Field` "defaults" `Expr.Field` "CompilerOptions"
-
-          xs ->
-            Expr.Prefer
-              ( Expr.Var "prelude" `Expr.Field` "defaults" `Expr.Field` "compiler-options" )
-              ( Expr.RecordLit
-                  ( Map.fromList
-                      ( map
-                          ( \( c, opts ) ->
-                              ( LazyText.pack ( show c ), Dhall.embed Dhall.inject opts )
+    { Dhall.embed = \xs ->
+        withDefault "CompilerOptions" compilerOptionsDefault
+          ( Expr.RecordLit
+              ( Map.fromList
+                  ( map
+                      ( \( c, opts ) ->
+                          ( StrictText.pack ( show c )
+                          , Expr.ListLit ( Just Expr.Text ) ( dhallString <$> Seq.fromList opts )
                           )
-                          xs
                       )
+                      xs
                   )
               )
+          )
     , Dhall.declared =
         Expr.Var "types" `Expr.Field` "CompilerOptions"
     }
 
-  where
 
-    field c =
-      recordField ( LazyText.pack ( show c ) ) ( filtering c )
-
-    filtering c =
-      contramap
-        ( \l -> join [ opts | ( c', opts ) <- l, c == c' ] )
-        ( listOf stringToDhall )
-
-
 mixin :: Dhall.InputType Cabal.Mixin
 mixin =
   ( runRecordInputType
@@ -1163,7 +1407,7 @@
 
 benchmark :: Dhall.InputType Cabal.Benchmark
 benchmark =
-  (  runRecordInputType
+  (  runRecordInputTypeWithDefault "Benchmark" benchmarkDefault
        ( mconcat
            [ recordField "main-is" ( ( \( Cabal.BenchmarkExeV10 _ s ) -> s ) . Cabal.benchmarkInterface >$< stringToDhall )
            , Cabal.benchmarkBuildInfo >$< buildInfoRecord
@@ -1177,7 +1421,7 @@
 
 testSuite :: Dhall.InputType Cabal.TestSuite
 testSuite =
-  ( runRecordInputType
+  ( runRecordInputTypeWithDefault "TestSuite" testSuiteDefault
       ( mconcat
           [ recordField "type" ( Cabal.testInterface >$< testSuiteInterface )
           , Cabal.testBuildInfo >$< buildInfoRecord
@@ -1221,7 +1465,7 @@
 
 executable :: Dhall.InputType Cabal.Executable
 executable =
-  ( runRecordInputType
+  ( runRecordInputTypeWithDefault "Executable" executableDefault
       ( mconcat
           [ recordField "main-is" ( Cabal.modulePath >$< stringToDhall )
           , recordField "scope" ( Cabal.exeScope >$< executableScope )
diff --git a/lib/Dhall/Extra.hs b/lib/Dhall/Extra.hs
--- a/lib/Dhall/Extra.hs
+++ b/lib/Dhall/Extra.hs
@@ -24,7 +24,7 @@
 import Data.Ord ( comparing )
 
 import qualified Data.HashMap.Strict.InsOrd as Map
-import qualified Data.Text.Lazy as LazyText
+import qualified Data.Text as StrictText
 import qualified Dhall
 import qualified Dhall.Core as Dhall ( Expr )
 import qualified Dhall.Core as Expr ( Expr(..) )
@@ -38,7 +38,7 @@
     ( Product
         ( Const
             ( Map.InsOrdHashMap
-                LazyText.Text
+                StrictText.Text
                 ( Dhall.Expr Dhall.Parser.Src Dhall.TypeCheck.X )
             )
         )
@@ -67,7 +67,7 @@
 
 
 
-keyValue :: LazyText.Text -> Dhall.Type a -> RecordBuilder a
+keyValue :: StrictText.Text -> Dhall.Type a -> RecordBuilder a
 keyValue key valueType =
   let
     extract expr = do
@@ -85,7 +85,7 @@
 
 
 
-makeUnion :: Map.InsOrdHashMap LazyText.Text ( Dhall.Type a ) -> Dhall.Type a
+makeUnion :: Map.InsOrdHashMap StrictText.Text ( Dhall.Type a ) -> Dhall.Type a
 makeUnion alts =
   let
     extract expr = do
diff --git a/lib/DhallLocation.hs b/lib/DhallLocation.hs
--- a/lib/DhallLocation.hs
+++ b/lib/DhallLocation.hs
@@ -8,7 +8,7 @@
 
 import Data.Version ( showVersion )
 
-import qualified Data.Text.Lazy as LazyText
+import qualified Data.Text as StrictText
 import qualified Dhall.Core
 
 import qualified Paths_dhall_to_cabal as Paths
@@ -20,8 +20,8 @@
   }
 
 
-version :: LazyText.Text
-version = LazyText.pack ( showVersion Paths.version )
+version :: StrictText.Text
+version = StrictText.pack ( showVersion Paths.version )
 
 
 dhallFromGitHub :: DhallLocation
diff --git a/lib/DhallToCabal.hs b/lib/DhallToCabal.hs
--- a/lib/DhallToCabal.hs
+++ b/lib/DhallToCabal.hs
@@ -39,23 +39,13 @@
   , sortExpr
   ) where
 
-import Control.Exception ( Exception, throwIO )
-import Data.Function ( (&) )
 import Data.List ( partition )
 import Data.Maybe ( fromMaybe )
 import Data.Monoid ( (<>) )
-import Formatting.Buildable ( Buildable(..) )
 
-import qualified Data.ByteString.Lazy as LazyByteString
 import qualified Data.HashMap.Strict.InsOrd as Map
 import qualified Data.Text as StrictText
-import qualified Data.Text.Encoding as StrictText
-import qualified Data.Text.Lazy as LazyText
-import qualified Data.Text.Lazy.Builder as Builder
-import qualified Data.Text.Lazy.Encoding as LazyText
 import qualified Dhall
-import qualified Dhall.Core
-import qualified Dhall.Import
 import qualified Dhall.Parser
 import qualified Dhall.TypeCheck
 import qualified Distribution.Compiler as Cabal
@@ -212,17 +202,31 @@
   extraDocFiles <-
     keyValue "extra-doc-files" ( Dhall.list Dhall.string )
 
-  return Cabal.PackageDescription { .. }
+  return ( adjustUnspecifiedLicense Cabal.PackageDescription { .. } )
 
+  where
+    -- Cabal reads a 2.0-spec file without a license as having
+    -- SPDX.NONE, but outputting SPDX-style licenses with 2.0 doesn't
+    -- work (and outputting legacy non-SPDX licenses with 2.2 also
+    -- doesn't work). In CabalToDhall we map SPDX.NONE to
+    -- AllRightsReserved, but we still have to switch between
+    -- SPDX-style NONE and legacy-style AllRightsReserved here
+    -- depending on cabal-version.
+    adjustUnspecifiedLicense desc
+      | Cabal.specVersion desc >= Cabal.mkVersion [2,2]
+      , Cabal.licenseRaw desc == Right Cabal.AllRightsReserved
+        = desc { Cabal.licenseRaw = Left SPDX.NONE }
+      | otherwise
+        = desc
 
 
 version :: Dhall.Type Cabal.Version
 version =
   let
-    parse builder =
+    parse text =
       fromMaybe
         ( error "Could not parse version" )
-        ( Cabal.simpleParse ( LazyText.unpack ( Builder.toLazyText builder ) ) )
+        ( Cabal.simpleParse ( StrictText.unpack text ) )
 
     extract =
       \case
@@ -234,8 +238,8 @@
 
     go =
       \case
-        Expr.App ( V0 "v" ) ( Expr.TextLit ( Expr.Chunks [] builder ) ) ->
-          return ( parse builder )
+        Expr.App ( V0 "v" ) ( Expr.TextLit ( Expr.Chunks [] text ) ) ->
+          return ( parse text )
 
         e ->
           error ( show e )
@@ -585,56 +589,9 @@
 
 
 
-dhallToCabal :: FilePath -> LazyText.Text -> IO Cabal.GenericPackageDescription
-dhallToCabal fileName source =
-  input fileName source genericPackageDescription
-
-
-input :: FilePath -> LazyText.Text -> Dhall.Type a -> IO a
-input fileName source t = do
-  expr  <-
-    throws ( Dhall.Parser.exprFromText fileName source )
-
-  expr' <-
-    Dhall.Import.load expr
-
-  let
-    suffix =
-      Dhall.expected t
-        & build
-        & Builder.toLazyText
-
-  let
-    annot =
-      case expr' of
-        Expr.Note ( Dhall.Parser.Src begin end bytes ) _ ->
-          Expr.Note
-            ( Dhall.Parser.Src begin end bytes' )
-            ( Expr.Annot expr' ( Dhall.expected t ) )
-
-          where
-
-          bytes' =
-            bytes <> " : " <> suffix
-
-        _ ->
-          Expr.Annot expr' ( Dhall.expected t )
-
-  _ <-
-    throws (Dhall.TypeCheck.typeOf annot)
-
-  case Dhall.extract t ( Dhall.Core.normalize expr' ) of
-    Just x  ->
-      return x
-
-    Nothing ->
-      throwIO Dhall.InvalidType
-
-  where
-
-    throws :: Exception e => Either e a -> IO a
-    throws =
-      either throwIO return
+dhallToCabal :: FilePath -> StrictText.Text -> IO Cabal.GenericPackageDescription
+dhallToCabal fileName =
+  Dhall.inputFrom fileName genericPackageDescription
 
 
 
diff --git a/lib/DhallToCabal/ConfigTree.hs b/lib/DhallToCabal/ConfigTree.hs
--- a/lib/DhallToCabal/ConfigTree.hs
+++ b/lib/DhallToCabal/ConfigTree.hs
@@ -18,11 +18,11 @@
   deriving (Functor, Show)
 
 instance Applicative ( ConfigTree cond ) where
-  pure = return
+  pure = Leaf
   (<*>) = ap
 
 instance Monad ( ConfigTree cond ) where
-  return = Leaf
+  return = pure
 
   Leaf a >>= f = f a
   Branch cond l r >>= f = Branch cond ( l >>= f ) ( r >>= f )
@@ -40,7 +40,7 @@
 -- @False@. The two substitutions are captured in a 'Branch'.
 
 toConfigTree
-  :: ( Eq a, Eq s )
+  :: ( Eq a )
   => Expr s a
   -> ConfigTree ( Expr s a ) ( Expr s a )
 toConfigTree e =
