diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,5 +1,23 @@
 # dhall-to-cabal change log
 
+## 1.3.2.0 -- 2019-02-12
+
+* Use `dhall` version 1.20.1.
+
+* `prelude.dhall` no longer provides types (as this isn't supported in
+  Dhall 1.20.1). Instead, there is now a new `types.dhall` file.
+
+* `dhall-to-cabal` now accepts`--output-stdout`, `--output-dir-cwd
+  DIR`, and `--output-dir-input DIR` flags control the destination of
+  the generated `.cabal` file. `--output-dir-cwd` interprets its
+  argument relative to the current working directory and
+  `--output-dir-input` interprets its argument relative to the input
+  file.
+
+  The default has been changed to `--output-dir-input .`, which writes
+  to the same directory as the input file; previously it corresponded
+  to `--output-stdout`.
+
 ## 1.3.1.0 -- 2018-10-23
 
 * Allow `Cabal` version 2.4.0.0. There have been consequent changes to
diff --git a/Setup.hs b/Setup.hs
deleted file mode 100644
--- a/Setup.hs
+++ /dev/null
@@ -1,2 +0,0 @@
-import Distribution.Simple
-main = defaultMain
diff --git a/dhall-to-cabal.cabal b/dhall-to-cabal.cabal
--- a/dhall-to-cabal.cabal
+++ b/dhall-to-cabal.cabal
@@ -6,10 +6,10 @@
 --
 -- Instead, edit the source Dhall file, namely
 -- 'dhall-to-cabal.dhall', and re-generate this file by running
--- 'dhall-to-cabal -- dhall-to-cabal.dhall > dhall-to-cabal.cabal'.
+-- 'dhall-to-cabal -- dhall-to-cabal.dhall'.
 -- * * * * * * * * * * * * WARNING * * * * * * * * * * * *
 name: dhall-to-cabal
-version: 1.3.1.0
+version: 1.3.2.0
 license: MIT
 license-file: LICENSE
 maintainer: ollie@ocharles.org.uk
@@ -109,9 +109,10 @@
 
 library
     exposed-modules:
-        DhallToCabal
-        DhallLocation
         CabalToDhall
+        DhallLocation
+        DhallToCabal
+        DhallToCabal.Util
     hs-source-dirs: lib
     other-modules:
         DhallToCabal.ConfigTree
@@ -134,7 +135,8 @@
         bytestring ^>=0.10,
         containers ^>=0.5 || ^>=0.6,
         contravariant ^>=1.4 || ^>=1.5,
-        dhall ^>=1.18.0,
+        dhall ^>=1.20.1,
+        filepath ^>=1.4,
         hashable ^>=1.2.6.1,
         text ^>=1.2,
         transformers ^>=0.5.2,
@@ -157,8 +159,9 @@
     build-depends:
         Cabal ^>=2.4,
         base ^>=4.10 || ^>=4.11 || ^>=4.12,
-        dhall ^>=1.18.0,
+        dhall ^>=1.20.1,
         dhall-to-cabal -any,
+        directory ^>=1.3.0.2,
         filepath ^>=1.4,
         microlens ^>=0.1.0.0 || ^>=0.2.0.0 || ^>=0.3.0.0 || ^>=0.4.0.0,
         optparse-applicative ^>=0.13.2 || ^>=0.14,
@@ -182,7 +185,7 @@
                  -fno-warn-name-shadowing
     build-depends:
         base ^>=4.10 || ^>=4.11 || ^>=4.12,
-        dhall ^>=1.18.0,
+        dhall ^>=1.20.1,
         bytestring ^>=0.10,
         dhall-to-cabal -any,
         optparse-applicative ^>=0.13.2 || ^>=0.14,
@@ -202,7 +205,7 @@
     build-depends:
         base ^>=4.10 || ^>=4.11 || ^>=4.12,
         directory ^>=1.3.0.2,
-        dhall ^>=1.18.0,
+        dhall ^>=1.20.1,
         dhall-to-cabal -any,
         filepath ^>=1.4,
         optparse-applicative ^>=0.13.2 || ^>=0.14,
@@ -223,7 +226,7 @@
         Cabal ^>=2.4,
         Diff ^>=0.3.4,
         bytestring ^>=0.10,
-        dhall ^>=1.18.0,
+        dhall ^>=1.20.1,
         dhall-to-cabal -any,
         filepath ^>=1.4,
         microlens ^>=0.1.0.0 || ^>=0.2.0.0 || ^>=0.3.0.0 || ^>=0.4.0.0,
@@ -247,9 +250,8 @@
     build-depends:
         base ^>=4.10 || ^>=4.11 || ^>=4.12,
         Cabal ^>=2.4,
-        dhall ^>=1.18.0,
+        dhall ^>=1.20.1,
         dhall-to-cabal -any,
         tasty ^>=0.11 || ^>=0.12 || ^>=1.0 || ^>=1.1,
         tasty-hunit ^>=0.10.0.1,
         text ^>=1.2
-
diff --git a/dhall/SPDX/and.dhall b/dhall/SPDX/and.dhall
--- a/dhall/SPDX/and.dhall
+++ b/dhall/SPDX/and.dhall
@@ -1,30 +1,16 @@
-   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
-     )
+let LicenseId = ../types/SPDX/LicenseId.dhall
+
+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
--- a/dhall/SPDX/license.dhall
+++ b/dhall/SPDX/license.dhall
@@ -1,12 +1,14 @@
-   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
+let LicenseId = ../types/SPDX/LicenseId.dhall
+
+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
--- a/dhall/SPDX/licenseVersionOrLater.dhall
+++ b/dhall/SPDX/licenseVersionOrLater.dhall
@@ -1,12 +1,14 @@
-   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
+let LicenseId = ../types/SPDX/LicenseId.dhall
+
+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
--- a/dhall/SPDX/or.dhall
+++ b/dhall/SPDX/or.dhall
@@ -1,30 +1,16 @@
-   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
-     )
+let LicenseId = ../types/SPDX/LicenseId.dhall
+
+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
--- a/dhall/SPDX/ref.dhall
+++ b/dhall/SPDX/ref.dhall
@@ -1,12 +1,14 @@
-   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
+let LicenseId = ../types/SPDX/LicenseId.dhall
+
+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
--- a/dhall/SPDX/refWithFile.dhall
+++ b/dhall/SPDX/refWithFile.dhall
@@ -1,13 +1,15 @@
-   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
+let LicenseId = ../types/SPDX/LicenseId.dhall
+
+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
--- a/dhall/Version/v.dhall
+++ b/dhall/Version/v.dhall
@@ -1,5 +1,5 @@
-    let v
-        : ∀(str : Text) → ../types/Version.dhall 
-        = λ(str : Text) → λ(Version : Type) → λ(v : Text → Version) → v str
+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
--- a/dhall/VersionRange/anyVersion.dhall
+++ b/dhall/VersionRange/anyVersion.dhall
@@ -1,14 +1,14 @@
   λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/differenceVersionRanges.dhall b/dhall/VersionRange/differenceVersionRanges.dhall
--- a/dhall/VersionRange/differenceVersionRanges.dhall
+++ b/dhall/VersionRange/differenceVersionRanges.dhall
@@ -1,16 +1,16 @@
-  λ(a : ../types/VersionRange.dhall )
-→ λ(b : ../types/VersionRange.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/earlierVersion.dhall b/dhall/VersionRange/earlierVersion.dhall
--- a/dhall/VersionRange/earlierVersion.dhall
+++ b/dhall/VersionRange/earlierVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/intersectVersionRanges.dhall b/dhall/VersionRange/intersectVersionRanges.dhall
--- a/dhall/VersionRange/intersectVersionRanges.dhall
+++ b/dhall/VersionRange/intersectVersionRanges.dhall
@@ -1,16 +1,16 @@
-  λ(a : ../types/VersionRange.dhall )
-→ λ(b : ../types/VersionRange.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/invertVersionRange.dhall b/dhall/VersionRange/invertVersionRange.dhall
--- a/dhall/VersionRange/invertVersionRange.dhall
+++ b/dhall/VersionRange/invertVersionRange.dhall
@@ -1,15 +1,15 @@
-  λ(a : ../types/VersionRange.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/laterVersion.dhall b/dhall/VersionRange/laterVersion.dhall
--- a/dhall/VersionRange/laterVersion.dhall
+++ b/dhall/VersionRange/laterVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/majorBoundVersion.dhall b/dhall/VersionRange/majorBoundVersion.dhall
--- a/dhall/VersionRange/majorBoundVersion.dhall
+++ b/dhall/VersionRange/majorBoundVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/noVersion.dhall b/dhall/VersionRange/noVersion.dhall
--- a/dhall/VersionRange/noVersion.dhall
+++ b/dhall/VersionRange/noVersion.dhall
@@ -1,14 +1,14 @@
   λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/notThisVersion.dhall b/dhall/VersionRange/notThisVersion.dhall
--- a/dhall/VersionRange/notThisVersion.dhall
+++ b/dhall/VersionRange/notThisVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/orEarlierVersion.dhall b/dhall/VersionRange/orEarlierVersion.dhall
--- a/dhall/VersionRange/orEarlierVersion.dhall
+++ b/dhall/VersionRange/orEarlierVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/orLaterVersion.dhall b/dhall/VersionRange/orLaterVersion.dhall
--- a/dhall/VersionRange/orLaterVersion.dhall
+++ b/dhall/VersionRange/orLaterVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/thisVersion.dhall b/dhall/VersionRange/thisVersion.dhall
--- a/dhall/VersionRange/thisVersion.dhall
+++ b/dhall/VersionRange/thisVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/unionVersionRanges.dhall b/dhall/VersionRange/unionVersionRanges.dhall
--- a/dhall/VersionRange/unionVersionRanges.dhall
+++ b/dhall/VersionRange/unionVersionRanges.dhall
@@ -1,16 +1,16 @@
-  λ(a : ../types/VersionRange.dhall )
-→ λ(b : ../types/VersionRange.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/VersionRange/withinVersion.dhall b/dhall/VersionRange/withinVersion.dhall
--- a/dhall/VersionRange/withinVersion.dhall
+++ b/dhall/VersionRange/withinVersion.dhall
@@ -1,15 +1,15 @@
-  λ(v : ../types/Version.dhall )
+  λ(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)
+→ λ(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)
diff --git a/dhall/defaults/Benchmark.dhall b/dhall/defaults/Benchmark.dhall
--- a/dhall/defaults/Benchmark.dhall
+++ b/dhall/defaults/Benchmark.dhall
@@ -1,2 +1,2 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-let types = ./../types.dhall in ././BuildInfo.dhall
+././BuildInfo.dhall
diff --git a/dhall/defaults/BuildInfo.dhall b/dhall/defaults/BuildInfo.dhall
--- a/dhall/defaults/BuildInfo.dhall
+++ b/dhall/defaults/BuildInfo.dhall
@@ -1,5 +1,5 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-    let types = ./../types.dhall
+let types = ./../types.dhall
 
 in  { autogen-modules =
         [] : List Text
@@ -23,7 +23,7 @@
     , default-extensions =
         [] : List types.Extension
     , default-language =
-        [] : Optional types.Language
+        None types.Language
     , extra-framework-dirs =
         [] : List Text
     , extra-ghci-libraries =
diff --git a/dhall/defaults/CompilerOptions.dhall b/dhall/defaults/CompilerOptions.dhall
--- a/dhall/defaults/CompilerOptions.dhall
+++ b/dhall/defaults/CompilerOptions.dhall
@@ -1,26 +1,24 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-    let types = ./../types.dhall
-
-in  { Eta =
-        [] : List Text
-    , GHC =
-        [] : List Text
-    , GHCJS =
-        [] : List Text
-    , HBC =
-        [] : List Text
-    , Helium =
-        [] : List Text
-    , Hugs =
-        [] : List Text
-    , JHC =
-        [] : List Text
-    , LHC =
-        [] : List Text
-    , NHC =
-        [] : List Text
-    , UHC =
-        [] : List Text
-    , YHC =
-        [] : List Text
-    }
+{ Eta =
+    [] : List Text
+, GHC =
+    [] : List Text
+, GHCJS =
+    [] : List Text
+, HBC =
+    [] : List Text
+, Helium =
+    [] : List Text
+, Hugs =
+    [] : List Text
+, JHC =
+    [] : List Text
+, LHC =
+    [] : List Text
+, NHC =
+    [] : List Text
+, UHC =
+    [] : List Text
+, YHC =
+    [] : List Text
+}
diff --git a/dhall/defaults/Executable.dhall b/dhall/defaults/Executable.dhall
--- a/dhall/defaults/Executable.dhall
+++ b/dhall/defaults/Executable.dhall
@@ -1,4 +1,4 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-    let types = ./../types.dhall
+let types = ./../types.dhall
 
-in  ././BuildInfo.dhall ⫽ { scope = (constructors types.Scope).Public {=} }
+in  ././BuildInfo.dhall ⫽ { scope = types.Scope.Public {=} }
diff --git a/dhall/defaults/Library.dhall b/dhall/defaults/Library.dhall
--- a/dhall/defaults/Library.dhall
+++ b/dhall/defaults/Library.dhall
@@ -1,16 +1,10 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-    let types = ./../types.dhall
-
-in    ././BuildInfo.dhall
-    ⫽ { exposed-modules =
-          [] : List Text
-      , reexported-modules =
-          [] : List
-               { name :
-                   Text
-               , original :
-                   { name : Text, package : Optional Text }
-               }
-      , signatures =
-          [] : List Text
-      }
+  ././BuildInfo.dhall
+⫽ { exposed-modules =
+      [] : List Text
+  , reexported-modules =
+      [] : List
+           { name : Text, original : { name : Text, package : Optional Text } }
+  , signatures =
+      [] : List Text
+  }
diff --git a/dhall/defaults/Package.dhall b/dhall/defaults/Package.dhall
--- a/dhall/defaults/Package.dhall
+++ b/dhall/defaults/Package.dhall
@@ -1,5 +1,5 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-    let types = ./../types.dhall
+let types = ./../types.dhall
 
 in  { author =
         ""
@@ -16,7 +16,7 @@
     , bug-reports =
         ""
     , build-type =
-        [] : Optional types.BuildType
+        None types.BuildType
     , cabal-version =
         ./../Version/v.dhall "2.2"
     , category =
@@ -52,9 +52,9 @@
     , homepage =
         ""
     , library =
-        [] : Optional (∀(config : types.Config) → types.Library)
+        None (∀(config : types.Config) → types.Library)
     , license =
-        (constructors types.License).AllRightsReserved {=}
+        types.License.AllRightsReserved {=}
     , license-files =
         [] : List Text
     , maintainer =
@@ -82,5 +82,5 @@
     , x-fields =
         [] : List { _1 : Text, _2 : Text }
     , custom-setup =
-        [] : Optional types.CustomSetup
+        None types.CustomSetup
     }
diff --git a/dhall/defaults/SourceRepo.dhall b/dhall/defaults/SourceRepo.dhall
--- a/dhall/defaults/SourceRepo.dhall
+++ b/dhall/defaults/SourceRepo.dhall
@@ -1,18 +1,18 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-    let types = ./../types.dhall
+let types = ./../types.dhall
 
 in  { type =
-        [] : Optional types.RepoType
+        None types.RepoType
     , location =
-        [] : Optional Text
+        None Text
     , module =
-        [] : Optional Text
+        None Text
     , branch =
-        [] : Optional Text
+        None Text
     , tag =
-        [] : Optional Text
+        None Text
     , subdir =
-        [] : Optional Text
+        None Text
     , kind =
-        (constructors types.RepoKind).RepoHead {=}
+        types.RepoKind.RepoHead {=}
     }
diff --git a/dhall/defaults/TestSuite.dhall b/dhall/defaults/TestSuite.dhall
--- a/dhall/defaults/TestSuite.dhall
+++ b/dhall/defaults/TestSuite.dhall
@@ -1,2 +1,2 @@
 -- This file is auto-generated by dhall-to-cabal-meta. Look but don't touch (unless you want your edits to be over-written).
-let types = ./../types.dhall in ././BuildInfo.dhall
+././BuildInfo.dhall
diff --git a/dhall/prelude.dhall b/dhall/prelude.dhall
--- a/dhall/prelude.dhall
+++ b/dhall/prelude.dhall
@@ -1,32 +1,4 @@
-{ types =
-    { BuildTypes =
-        constructors ./types/BuildType.dhall
-    , OSs =
-        constructors ./types/OS.dhall
-    , Compilers =
-        constructors ./types/Compiler.dhall
-    , Extensions =
-        constructors ./types/Extension.dhall
-    , Languages =
-        constructors ./types/Language.dhall
-    , Licenses =
-        constructors ./types/License.dhall
-    , LicenseExceptionId =
-        constructors ./types/SPDX/LicenseExceptionId.dhall
-    , LicenseId =
-        constructors ./types/SPDX/LicenseId.dhall
-    , ModuleRenaming =
-        constructors ./types/ModuleRenaming.dhall
-    , TestTypes =
-        constructors ./types/TestType.dhall
-    , RepoType =
-        constructors ./types/RepoType.dhall
-    , RepoKind =
-        constructors ./types/RepoKind.dhall
-    , Scopes =
-        constructors ./types/Scope.dhall
-    }
-, defaults =
+{ defaults =
     { CompilerOptions =
         ./defaults/CompilerOptions.dhall
     , Library =
@@ -43,31 +15,31 @@
         ./defaults/TestSuite.dhall
     }
 , anyVersion =
-    ./VersionRange/anyVersion.dhall 
+    ./VersionRange/anyVersion.dhall
 , earlierVersion =
-    ./VersionRange/earlierVersion.dhall 
+    ./VersionRange/earlierVersion.dhall
 , orEarlierVersion =
-    ./VersionRange/orEarlierVersion.dhall 
+    ./VersionRange/orEarlierVersion.dhall
 , intersectVersionRanges =
-    ./VersionRange/intersectVersionRanges.dhall 
+    ./VersionRange/intersectVersionRanges.dhall
 , unionVersionRanges =
-    ./VersionRange/unionVersionRanges.dhall 
+    ./VersionRange/unionVersionRanges.dhall
 , majorBoundVersion =
-    ./VersionRange/majorBoundVersion.dhall 
+    ./VersionRange/majorBoundVersion.dhall
 , orLaterVersion =
-    ./VersionRange/orLaterVersion.dhall 
+    ./VersionRange/orLaterVersion.dhall
 , laterVersion =
-    ./VersionRange/laterVersion.dhall 
+    ./VersionRange/laterVersion.dhall
 , thisVersion =
-    ./VersionRange/thisVersion.dhall 
+    ./VersionRange/thisVersion.dhall
 , notThisVersion =
-    ./VersionRange/notThisVersion.dhall 
+    ./VersionRange/notThisVersion.dhall
 , withinVersion =
-    ./VersionRange/withinVersion.dhall 
+    ./VersionRange/withinVersion.dhall
 , v =
-    ./Version/v.dhall 
+    ./Version/v.dhall
 , noVersion =
-    ./VersionRange/noVersion.dhall 
+    ./VersionRange/noVersion.dhall
 , utils =
     ./utils/package.dhall
 , unconditional =
@@ -86,6 +58,6 @@
     , or =
         ./SPDX/or.dhall
     , noException =
-        [] : Optional ./types/SPDX/LicenseExceptionId.dhall
+        None ./types/SPDX/LicenseExceptionId.dhall
     }
 }
diff --git a/dhall/types/Benchmark.dhall b/dhall/types/Benchmark.dhall
--- a/dhall/types/Benchmark.dhall
+++ b/dhall/types/Benchmark.dhall
@@ -1,1 +1,1 @@
-./BuildInfo.dhall  ⩓ { main-is : Text }
+./BuildInfo.dhall ⩓ { main-is : Text }
diff --git a/dhall/types/BuildInfo.dhall b/dhall/types/BuildInfo.dhall
--- a/dhall/types/BuildInfo.dhall
+++ b/dhall/types/BuildInfo.dhall
@@ -1,11 +1,11 @@
 { autogen-modules :
     List Text
 , build-depends :
-    List ./Dependency.dhall 
+    List ./Dependency.dhall
 , build-tool-depends :
-    List { component : Text, package : Text, version : ./VersionRange.dhall  }
+    List { component : Text, package : Text, version : ./VersionRange.dhall }
 , build-tools :
-    List { exe : Text, version : ./VersionRange.dhall  }
+    List { exe : Text, version : ./VersionRange.dhall }
 , buildable :
     Bool
 , c-sources :
@@ -13,13 +13,13 @@
 , cc-options :
     List Text
 , compiler-options :
-    ./CompilerOptions.dhall 
+    ./CompilerOptions.dhall
 , cpp-options :
     List Text
 , default-extensions :
-    List ./Extension.dhall 
+    List ./Extension.dhall
 , default-language :
-    Optional ./Language.dhall 
+    Optional ./Language.dhall
 , extra-framework-dirs :
     List Text
 , extra-ghci-libraries :
@@ -43,21 +43,21 @@
 , ld-options :
     List Text
 , other-extensions :
-    List ./Extension.dhall 
+    List ./Extension.dhall
 , other-languages :
-    List ./Language.dhall 
+    List ./Language.dhall
 , other-modules :
     List Text
 , pkgconfig-depends :
-    List { name : Text, version : ./VersionRange.dhall  }
+    List { name : Text, version : ./VersionRange.dhall }
 , profiling-options :
-    ./CompilerOptions.dhall 
+    ./CompilerOptions.dhall
 , shared-options :
-    ./CompilerOptions.dhall 
+    ./CompilerOptions.dhall
 , static-options :
-    ./CompilerOptions.dhall 
+    ./CompilerOptions.dhall
 , mixins :
-    List ./Mixin.dhall 
+    List ./Mixin.dhall
 , asm-options :
     List Text
 , asm-sources :
diff --git a/dhall/types/BuildType.dhall b/dhall/types/BuildType.dhall
--- a/dhall/types/BuildType.dhall
+++ b/dhall/types/BuildType.dhall
@@ -1,9 +1,1 @@
-< Configure :
-    {}
-| Custom :
-    {}
-| Make :
-    {}
-| Simple :
-    {}
->
+< Configure : {} | Custom : {} | Make : {} | Simple : {} >
diff --git a/dhall/types/Config.dhall b/dhall/types/Config.dhall
--- a/dhall/types/Config.dhall
+++ b/dhall/types/Config.dhall
@@ -1,9 +1,9 @@
 { os :
-    ./OS.dhall  → Bool
+    ./OS.dhall → Bool
 , arch :
-    ./Arch.dhall  → Bool
+    ./Arch.dhall → Bool
 , impl :
-    ./Compiler.dhall  → ./VersionRange.dhall  → Bool
+    ./Compiler.dhall → ./VersionRange.dhall → Bool
 , flag :
     Text → Bool
 }
diff --git a/dhall/types/CustomSetup.dhall b/dhall/types/CustomSetup.dhall
--- a/dhall/types/CustomSetup.dhall
+++ b/dhall/types/CustomSetup.dhall
@@ -1,1 +1,1 @@
-{ setup-depends : List ./Dependency.dhall  }
+{ setup-depends : List ./Dependency.dhall }
diff --git a/dhall/types/Dependency.dhall b/dhall/types/Dependency.dhall
--- a/dhall/types/Dependency.dhall
+++ b/dhall/types/Dependency.dhall
@@ -1,1 +1,1 @@
-{ bounds : ./VersionRange.dhall , package : Text }
+{ bounds : ./VersionRange.dhall, package : Text }
diff --git a/dhall/types/Executable.dhall b/dhall/types/Executable.dhall
--- a/dhall/types/Executable.dhall
+++ b/dhall/types/Executable.dhall
@@ -1,1 +1,1 @@
-./BuildInfo.dhall  ⩓ { main-is : Text, scope : ./Scope.dhall  }
+./BuildInfo.dhall ⩓ { main-is : Text, scope : ./Scope.dhall }
diff --git a/dhall/types/ForeignLibrary.dhall b/dhall/types/ForeignLibrary.dhall
--- a/dhall/types/ForeignLibrary.dhall
+++ b/dhall/types/ForeignLibrary.dhall
@@ -1,4 +1,4 @@
-  ./BuildInfo.dhall 
+  ./BuildInfo.dhall
 ⩓ { type :
       < Shared : {} | Static : {} >
   , options :
@@ -6,7 +6,7 @@
   , lib-version-info :
       Optional { age : Natural, current : Natural, revision : Natural }
   , lib-version-linux :
-      Optional ./Version.dhall 
+      Optional ./Version.dhall
   , mod-def-files :
       List Text
   }
diff --git a/dhall/types/Guarded.dhall b/dhall/types/Guarded.dhall
--- a/dhall/types/Guarded.dhall
+++ b/dhall/types/Guarded.dhall
@@ -1,1 +1,1 @@
-λ(A : Type) → ./Config.dhall  → A
+λ(A : Type) → ./Config.dhall → A
diff --git a/dhall/types/Library.dhall b/dhall/types/Library.dhall
--- a/dhall/types/Library.dhall
+++ b/dhall/types/Library.dhall
@@ -1,4 +1,4 @@
-  ./BuildInfo.dhall 
+  ./BuildInfo.dhall
 ⩓ { exposed-modules :
       List Text
   , reexported-modules :
diff --git a/dhall/types/License.dhall b/dhall/types/License.dhall
--- a/dhall/types/License.dhall
+++ b/dhall/types/License.dhall
@@ -1,9 +1,9 @@
 < AGPL :
-    Optional ./Version.dhall 
+    Optional ./Version.dhall
 | AllRightsReserved :
     {}
 | Apache :
-    Optional ./Version.dhall 
+    Optional ./Version.dhall
 | BSD2 :
     {}
 | BSD3 :
@@ -11,21 +11,23 @@
 | BSD4 :
     {}
 | GPL :
-    Optional ./Version.dhall 
+    Optional ./Version.dhall
 | ISC :
     {}
 | LGPL :
-    Optional ./Version.dhall 
+    Optional ./Version.dhall
 | MIT :
     {}
 | MPL :
-    ./Version.dhall 
+    ./Version.dhall
 | Other :
     {}
 | PublicDomain :
     {}
 | Unspecified :
     {}
+| Unknown :
+    Text
 | SPDX :
     ./SPDX.dhall
 >
diff --git a/dhall/types/Mixin.dhall b/dhall/types/Mixin.dhall
--- a/dhall/types/Mixin.dhall
+++ b/dhall/types/Mixin.dhall
@@ -1,5 +1,5 @@
 { package :
     Text
 , renaming :
-    { provides : ./ModuleRenaming.dhall , requires : ./ModuleRenaming.dhall  }
+    { provides : ./ModuleRenaming.dhall, requires : ./ModuleRenaming.dhall }
 }
diff --git a/dhall/types/Package.dhall b/dhall/types/Package.dhall
--- a/dhall/types/Package.dhall
+++ b/dhall/types/Package.dhall
@@ -1,19 +1,19 @@
 { author :
     Text
 , benchmarks :
-    List { benchmark : ./Guarded.dhall  ./Benchmark.dhall , name : Text }
+    List { benchmark : ./Guarded.dhall ./Benchmark.dhall, name : Text }
 , bug-reports :
     Text
 , build-type :
-    Optional ./BuildType.dhall 
+    Optional ./BuildType.dhall
 , cabal-version :
-    ./Version.dhall 
+    ./Version.dhall
 , category :
     Text
 , copyright :
     Text
 , custom-setup :
-    Optional ./CustomSetup.dhall 
+    Optional ./CustomSetup.dhall
 , data-dir :
     Text
 , data-files :
@@ -21,7 +21,7 @@
 , description :
     Text
 , executables :
-    List { executable : ./Guarded.dhall  ./Executable.dhall , name : Text }
+    List { executable : ./Guarded.dhall ./Executable.dhall, name : Text }
 , extra-doc-files :
     List Text
 , extra-source-files :
@@ -31,13 +31,13 @@
 , flags :
     List { default : Bool, description : Text, manual : Bool, name : Text }
 , foreign-libraries :
-    List { foreign-lib : ./Guarded.dhall  ./ForeignLibrary.dhall , name : Text }
+    List { foreign-lib : ./Guarded.dhall ./ForeignLibrary.dhall, name : Text }
 , homepage :
     Text
 , library :
-    Optional (./Guarded.dhall  ./Library.dhall )
+    Optional (./Guarded.dhall ./Library.dhall)
 , license :
-    ./License.dhall 
+    ./License.dhall
 , license-files :
     List Text
 , maintainer :
@@ -47,19 +47,19 @@
 , package-url :
     Text
 , source-repos :
-    List ./SourceRepo.dhall 
+    List ./SourceRepo.dhall
 , stability :
     Text
 , sub-libraries :
-    List { library : ./Guarded.dhall  ./Library.dhall , name : Text }
+    List { library : ./Guarded.dhall ./Library.dhall, name : Text }
 , synopsis :
     Text
 , test-suites :
-    List { name : Text, test-suite : ./Guarded.dhall  ./TestSuite.dhall  }
+    List { name : Text, test-suite : ./Guarded.dhall ./TestSuite.dhall }
 , tested-with :
-    List { compiler : ./Compiler.dhall , version : ./VersionRange.dhall  }
+    List { compiler : ./Compiler.dhall, version : ./VersionRange.dhall }
 , version :
-    ./Version.dhall 
+    ./Version.dhall
 , x-fields :
     List { _1 : Text, _2 : Text }
 }
diff --git a/dhall/types/SPDX.dhall b/dhall/types/SPDX.dhall
--- a/dhall/types/SPDX.dhall
+++ b/dhall/types/SPDX.dhall
@@ -1,10 +1,12 @@
-   let LicenseExceptionId : Type = ./SPDX/LicenseExceptionId.dhall
-in let LicenseId : Type = ./SPDX/LicenseId.dhall
-in   ∀(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)
-   → SPDX
+let LicenseExceptionId : Type = ./SPDX/LicenseExceptionId.dhall
+
+let LicenseId : Type = ./SPDX/LicenseId.dhall
+
+in    ∀(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)
+    → SPDX
diff --git a/dhall/types/SetupBuildInfo.dhall b/dhall/types/SetupBuildInfo.dhall
--- a/dhall/types/SetupBuildInfo.dhall
+++ b/dhall/types/SetupBuildInfo.dhall
@@ -1,1 +1,1 @@
-{ setup-depends : List ./Dependency.dhall  }
+{ setup-depends : List ./Dependency.dhall }
diff --git a/dhall/types/SourceRepo.dhall b/dhall/types/SourceRepo.dhall
--- a/dhall/types/SourceRepo.dhall
+++ b/dhall/types/SourceRepo.dhall
@@ -1,5 +1,5 @@
 { type :
-    Optional ./RepoType.dhall 
+    Optional ./RepoType.dhall
 , location :
     Optional Text
 , module :
@@ -11,5 +11,5 @@
 , subdir :
     Optional Text
 , kind :
-    ./RepoKind.dhall 
+    ./RepoKind.dhall
 }
diff --git a/dhall/types/TestSuite.dhall b/dhall/types/TestSuite.dhall
--- a/dhall/types/TestSuite.dhall
+++ b/dhall/types/TestSuite.dhall
@@ -1,1 +1,1 @@
-./BuildInfo.dhall  ⩓ { type : ./TestType.dhall  }
+./BuildInfo.dhall ⩓ { type : ./TestType.dhall }
diff --git a/dhall/types/VersionRange.dhall b/dhall/types/VersionRange.dhall
--- a/dhall/types/VersionRange.dhall
+++ b/dhall/types/VersionRange.dhall
@@ -1,14 +1,14 @@
   ∀(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)
+→ ∀(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)
diff --git a/dhall/unconditional.dhall b/dhall/unconditional.dhall
--- a/dhall/unconditional.dhall
+++ b/dhall/unconditional.dhall
@@ -1,44 +1,43 @@
-    let unconditional
-        : ∀(A : Type) → A → ./types/Guarded.dhall  A
-        = λ(A : Type) → λ(a : A) → λ(_ : ./types/Config.dhall ) → a
+let unconditional
+    : ∀(A : Type) → A → ./types/Guarded.dhall A
+    = λ(A : Type) → λ(a : A) → λ(_ : ./types/Config.dhall) → a
 
-in  let executable
-        :   ∀(name : Text)
-          → ∀(executable : ./types/Executable.dhall )
-          → { name :
-                Text
-            , executable :
-                ./types/Guarded.dhall  ./types/Executable.dhall 
-            }
-        =   λ(name : Text)
-          → λ(executable : ./types/Executable.dhall )
-          → { name =
-                name
-            , executable =
-                unconditional ./types/Executable.dhall  executable
-            }
+let executable
+    :   ∀(name : Text)
+      → ∀(executable : ./types/Executable.dhall)
+      → { name :
+            Text
+        , executable :
+            ./types/Guarded.dhall ./types/Executable.dhall
+        }
+    =   λ(name : Text)
+      → λ(executable : ./types/Executable.dhall)
+      → { name =
+            name
+        , executable =
+            unconditional ./types/Executable.dhall executable
+        }
 
-in  let library
-        :   ∀(library : ./types/Library.dhall )
-          → Optional (./types/Guarded.dhall  ./types/Library.dhall )
-        =   λ(library : ./types/Library.dhall )
-          → [ unconditional ./types/Library.dhall  library
-            ] : Optional (./types/Guarded.dhall  ./types/Library.dhall )
+let library
+    :   ∀(library : ./types/Library.dhall)
+      → Optional (./types/Guarded.dhall ./types/Library.dhall)
+    =   λ(library : ./types/Library.dhall)
+      → Some (unconditional ./types/Library.dhall library)
 
-in  let test-suite
-        :   ∀(name : Text)
-          → ∀(test-suite : ./types/TestSuite.dhall )
-          → { name :
-                Text
-            , test-suite :
-                ./types/Guarded.dhall  ./types/TestSuite.dhall 
-            }
-        =   λ(name : Text)
-          → λ(test-suite : ./types/TestSuite.dhall )
-          → { name =
-                name
-            , test-suite =
-                unconditional ./types/TestSuite.dhall  test-suite
-            }
+let test-suite
+    :   ∀(name : Text)
+      → ∀(test-suite : ./types/TestSuite.dhall)
+      → { name :
+            Text
+        , test-suite :
+            ./types/Guarded.dhall ./types/TestSuite.dhall
+        }
+    =   λ(name : Text)
+      → λ(test-suite : ./types/TestSuite.dhall)
+      → { name =
+            name
+        , test-suite =
+            unconditional ./types/TestSuite.dhall test-suite
+        }
 
 in  { executable = executable, library = library, test-suite = test-suite }
diff --git a/dhall/utils/GitHub-project.dhall b/dhall/utils/GitHub-project.dhall
--- a/dhall/utils/GitHub-project.dhall
+++ b/dhall/utils/GitHub-project.dhall
@@ -1,26 +1,24 @@
-    let GitHubProject : Type = { owner : Text, repo : Text }
+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 
-                          }
-                      ]
-                  }
+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 =
+                          Some gitHubRoot
+                      , type =
+                          Some ((../types/RepoType.dhall).Git {=})
+                      }
+                  ]
+              }
 
 in  gitHubProject
diff --git a/dhall/utils/majorVersions.dhall b/dhall/utils/majorVersions.dhall
--- a/dhall/utils/majorVersions.dhall
+++ b/dhall/utils/majorVersions.dhall
@@ -1,52 +1,49 @@
-   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
-        }
+let Version = ../types/Version.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 
+let VersionRange = ../types/VersionRange.dhall
+
+let Versions =
+      { unionVersionRanges =
+          ../VersionRange/unionVersionRanges.dhall
+      , majorBoundVersion =
+          ../VersionRange/majorBoundVersion.dhall
+      , noVersion =
+          ../VersionRange/noVersion.dhall
+      }
+
+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)
+                    → Some
+                      ( Versions.unionVersionRanges
+                        (Versions.majorBoundVersion v)
+                        r
                       )
                   )
-                  ([] : Optional VersionRange )
-                )
-                VersionRange 
-                (λ(a : VersionRange ) → a)
-                Versions.noVersion 
-            }
+                  (Some (Versions.majorBoundVersion v))
+              )
+              (None VersionRange)
+            )
+            VersionRange
+            (λ(a : VersionRange) → a)
+            Versions.noVersion
+        }
 
 in  majorVersions
diff --git a/dhall/utils/mapSourceRepos.dhall b/dhall/utils/mapSourceRepos.dhall
--- a/dhall/utils/mapSourceRepos.dhall
+++ b/dhall/utils/mapSourceRepos.dhall
@@ -1,23 +1,23 @@
-    let SourceRepo = ../types/SourceRepo.dhall
+let SourceRepo = ../types/SourceRepo.dhall
 
-in  let Package = ../types/Package.dhall
+let Package = ../types/Package.dhall
 
-in  let mapSourceRepos
-        : (SourceRepo → SourceRepo) → Package → Package
-        =   λ(f : SourceRepo → SourceRepo)
-          → λ(pkg : Package)
-          →   pkg
-            ⫽ { source-repos =
-                  List/build
+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
-                  (   λ(list : Type)
-                    → λ(cons : SourceRepo → list → list)
-                    → List/fold
-                      SourceRepo
-                      pkg.source-repos
-                      list
-                      (λ(x : SourceRepo) → cons (f x))
-                  )
-              }
+                  pkg.source-repos
+                  list
+                  (λ(x : SourceRepo) → cons (f x))
+              )
+          }
 
 in  mapSourceRepos
diff --git a/exe/Main.hs b/exe/Main.hs
--- a/exe/Main.hs
+++ b/exe/Main.hs
@@ -1,4 +1,3 @@
-{-# language GeneralizedNewtypeDeriving #-}
 {-# language NoMonomorphismRestriction #-}
 {-# language NamedFieldPuns #-}
 {-# language OverloadedStrings #-}
@@ -7,27 +6,30 @@
 
 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, traverse_ )
+import Data.Function ( (&) )
 import Data.Functor.Product ( Product(..) )
 import Data.Functor.Identity ( Identity(..) )
+import Data.List.NonEmpty ( NonEmpty(..) )
 import Data.Monoid ( Any(..) )
-import Data.Function ( (&) )
 import Data.Maybe ( fromMaybe )
 import Data.Text (Text)
 import Data.String ( fromString )
 import Data.Version ( showVersion )
 import Lens.Micro ( set )
-import System.FilePath ( takeDirectory )
+import System.Directory ( createDirectoryIfMissing )
+import System.FilePath ( (</>), (<.>), addTrailingPathSeparator, normalise, takeDirectory )
 
 import CabalToDhall ( KnownDefault, getDefault, resolvePreludeVar )
 import DhallLocation ( preludeLocation, typesLocation, dhallFromGitHub )
 import DhallToCabal
+import DhallToCabal.Util ( relativeTo )
 import qualified Paths_dhall_to_cabal as Paths
 
 import qualified Data.Text.IO as StrictText
@@ -35,7 +37,7 @@
 import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
 import qualified Dhall
 import qualified Dhall.Core as Dhall
-import qualified Dhall.Core as Expr ( Expr(..), Var(..), shift )
+import qualified Dhall.Core as Expr ( Expr(..), Var(..), Binding(..), shift )
 import qualified Distribution.PackageDescription as Cabal
 import qualified Dhall.Map as Map
 import qualified Dhall.Parser
@@ -103,10 +105,20 @@
 data DhallToCabalOptions = DhallToCabalOptions
   { dhallFilePath :: Maybe String
   , explain :: Bool
+  , outputDirection :: OutputDirection
   }
 
 
+data OutputDirection
+  = OutputStdout
+  | OutputDir RelativeDir
 
+
+data RelativeDir
+  = RelativeToCWD FilePath
+  | RelativeToInput FilePath
+
+
 dhallToCabalOptionsParser :: OptParse.Parser DhallToCabalOptions
 dhallToCabalOptionsParser =
   DhallToCabalOptions
@@ -129,8 +141,37 @@
             , OptParse.help "Provide explanations to type Dhall syntax and type errors."
             ]
         )
+    <*>
+      outputDirectionParser
+  where
+  -- Note order: the --output-dir-input does not fail because it has a default value.
+  outputDirectionParser =
+        OptParse.flag'
+          OutputStdout
+          ( mconcat
+            [ OptParse.long "output-stdout"
+            , OptParse.help "Write the .cabal file to standard output."
+            ]
+          )
 
+    <|> OutputDir . RelativeToCWD <$> OptParse.strOption
+          ( mconcat
+              [ OptParse.long "output-dir-cwd"
+              , OptParse.metavar "DIR"
+              , OptParse.help "Write the resulting .cabal file to DIR/NAME.cabal, where NAME is taken from the .cabal file's 'name' field, and DIR is relative to the current working directory."
+              ]
+          )
 
+    <|> OutputDir . RelativeToInput <$> OptParse.strOption
+          ( mconcat
+              [ OptParse.long "output-dir-input"
+              , OptParse.metavar "DIR"
+              , OptParse.help "Write the resulting .cabal file to DIR/NAME.cabal, where NAME is taken from the .cabal file's 'name' field, and DIR is relative to the directory containing the input Dhall file (or the current working directory if the input is from standard input)."
+              , OptParse.value "."
+              ]
+          )
+
+
 data PrintTypeOptions = PrintTypeOptions
   { typeToPrint :: KnownType
   , selfContained :: Bool
@@ -193,7 +234,7 @@
 
 
 runDhallToCabal :: DhallToCabalOptions -> IO ()
-runDhallToCabal DhallToCabalOptions { dhallFilePath, explain } = do
+runDhallToCabal DhallToCabalOptions { dhallFilePath, explain, outputDirection } = do
   source <-
     case dhallFilePath of
       Nothing ->
@@ -204,21 +245,38 @@
 
   let
     settings = Dhall.defaultInputSettings
-      & set Dhall.rootDirectory ( maybe "." takeDirectory dhallFilePath )
+      & set Dhall.rootDirectory inputDir
       & set Dhall.sourceName ( fromMaybe "(STDIN)" dhallFilePath )
 
-  explaining
-    ( dhallToCabal settings source
-        & fmap ( \ pkgDesc ->
-                       pkgDesc
-                     & Cabal.showGenericPackageDescription
-                     & addWarningHeader ( pkgDescName pkgDesc )
-               )
-        >>= putStrLn
-    )
+  pkgDesc <- explaining ( dhallToCabal settings source )
+  let
+    rendered =
+      addWarningHeader
+        ( Cabal.showGenericPackageDescription pkgDesc )
 
+  case outputDirection of
+
+    OutputStdout ->
+      putStrLn rendered
+
+    OutputDir _ -> do
+      createDirectoryIfMissing True destDir
+      let dest = destDir </> pkgDescName pkgDesc <.> "cabal"
+      putStrLn ( "Writing to " ++ normalise dest ++ "." )
+      writeFile dest rendered
+
   where
+    inputDir = maybe "." takeDirectory dhallFilePath
 
+    destDir =
+      case outputDirection of
+        OutputStdout ->
+          "."
+        OutputDir (RelativeToCWD dir) ->
+          dir
+        OutputDir (RelativeToInput relativeDir) ->
+          inputDir </> relativeDir
+
     explaining =
       if explain then Dhall.detailed else id
 
@@ -230,24 +288,36 @@
     isAcceptableCommentChar c =
       isAlphaNum c || c == '.' || c == '/' || c == '_' || c == '-'
 
-    regenerationInstructions name =
+    -- These regeneration instructions assume that (a) if we are
+    -- writing to stdout, the user is redirecting it a file in the
+    -- current directory, (b) the generated file is not moved after we
+    -- produce it, (c) there are no symlinks breaking .. components,
+    -- and (d) they will run the regeneration instructions from the
+    -- directory of the generated .cabal file.
+    --
+    -- These assumptions are necessarily approximations, but they're a
+    -- reasonable guess at the common case and at least give the user
+    -- something to go on.
+    regenerationInstructions =
       case dhallFilePath of
         Just filePath | all isAcceptableCommentChar filePath ->
           [ "-- Instead, edit the source Dhall file, namely"
           , "-- '" ++ filePath ++ "', and re-generate this file by running"
-          , "-- 'dhall-to-cabal -- " ++ filePath ++ " > " ++ name ++ ".cabal'."
+          , "-- 'dhall-to-cabal -- " ++ sourcePath ++ "'."
           ]
+          where
+            sourcePath =
+              relativeTo ( addTrailingPathSeparator destDir ) filePath
         _ ->
           [ "-- Instead, edit the source Dhall file (which may have the"
-          , "-- '.dhall' extension) and re-run dhall-to-cabal, passing the"
-          , "-- source file's name as its argument and redirecting output to"
-          , "-- '" ++ name ++ ".cabal' (this file)."
+          , "-- '.dhall' extension) and re-run dhall-to-cabal, passing "
+          , "-- the source file's name as its argument."
           ]
 
     -- Starting with Cabal 2.2, the cabal-version field *has* to be
     -- the first thing in the .cabal file. So split that off and plonk
     -- the warning header after it.
-    addWarningHeader name str =
+    addWarningHeader str =
       case lines str of
         [] ->
           error "addWarningHeader: no cabal-version line found?"
@@ -260,7 +330,7 @@
               , "-- Do not edit it by hand, because your changes will be over-written!"
               , "--"
               ]
-            , regenerationInstructions name
+            , regenerationInstructions
             , [ "-- * * * * * * * * * * * * WARNING * * * * * * * * * * * *" ]
             , rest
             ]
@@ -300,6 +370,14 @@
   modifiers =
     mconcat
       [ OptParse.progDesc "Generate Cabal files from Dhall expressions"
+      , OptParse.footer
+          ( "The default behaviour is to generate a .cabal file in the "
+         ++ "directory of the input file with a name corresponding to the "
+         ++ "'name' field of the generated package description (i.e., the "
+         ++ "same behaviour as specifying '--output-dir-input .'). In the "
+         ++ "case of reading from standard input, the .cabal file will be "
+         ++ "placed in the current working directory."
+          )
       ]
 
 
@@ -379,7 +457,7 @@
         name = fromString ( show t )
       in if shouldBeImported t && not selfContained
          then Dhall.subst ( Expr.V name 0 ) ( Expr.Var ( Expr.V "types" 0 ) `Expr.Field` name ) reduced
-         else Expr.Let name Nothing val reduced
+         else Expr.Let (Expr.Binding name Nothing val :| []) reduced
 
     factoredType :: Expr.Expr Dhall.Parser.Src Dhall.Import
     factoredType =
@@ -398,7 +476,8 @@
         body = foldr ( uncurry makeLetOrImport ) expr types
 
         importing = if any shouldBeImported ( fst <$> types ) && not selfContained
-          then Expr.Let "types" Nothing ( Expr.Embed ( typesLocation dhallFromGitHub ) )
+          then Expr.Let
+                 ( Expr.Binding "types" Nothing ( Expr.Embed ( typesLocation dhallFromGitHub ) ) :| [] )
           else id
 
       in
@@ -525,8 +604,10 @@
         Expr.App f a ->
           Expr.App <$> go f v <*> go a v
 
-        Expr.Let n t b e ->
-          Expr.Let n t <$> go b v <*> go e ( shiftName n v )
+        Expr.Let bs e ->
+          Expr.Let <$> traverse go' bs <*> go e shifted
+            where go' (Expr.Binding n t b) = Expr.Binding n t <$> go b v
+                  shifted = foldr (shiftName . Expr.variable) v bs
 
         Expr.Annot a b ->
           Expr.Annot <$> go a v <*> go b v
@@ -733,11 +814,10 @@
 
   where
     withPreludeImport =
-      Expr.Let "prelude" Nothing ( Expr.Embed ( preludeLocation dhallFromGitHub ) )
+      Expr.Let (Expr.Binding "prelude" Nothing
+                  ( Expr.Embed ( preludeLocation dhallFromGitHub ) ) :| [])
 
     expr :: Expr.Expr Dhall.Parser.Src Dhall.Import
-    expr =
-      getDefault
-        ( typesLocation dhallFromGitHub )
-        resolvePreludeVar
-        defaultToPrint
+    expr = getDefault
+             ( typesLocation dhallFromGitHub )
+             resolvePreludeVar defaultToPrint
diff --git a/golden-tests/GoldenTests.hs b/golden-tests/GoldenTests.hs
--- a/golden-tests/GoldenTests.hs
+++ b/golden-tests/GoldenTests.hs
@@ -8,12 +8,13 @@
 import Lens.Micro ( set )
 import System.FilePath ( takeBaseName, takeDirectory, replaceExtension )
 import Test.Tasty ( defaultMain, TestTree, testGroup )
-import Test.Tasty.Golden ( findByExtension, goldenVsStringDiff )
+import Test.Tasty.Golden ( findByExtension )
 import Test.Tasty.Golden.Advanced ( goldenTest )
 
 import qualified Data.ByteString as BS
 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.Lazy as LazyText
 import qualified Data.Text.Prettyprint.Doc as Pretty
 import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
 import qualified Dhall
@@ -27,7 +28,7 @@
 import DhallToCabal ( dhallToCabal )
 
 
-  
+
 main :: IO ()
 main =
   defaultMain =<< goldenTests
@@ -96,7 +97,7 @@
               ( StrictText.readFile dhallFile >>= dhallToCabal settings )
               ( \ ( Cabal.showGenericPackageDescription -> exp ) ( Cabal.showGenericPackageDescription -> act ) -> do
                   if exp == act then
-                      return Nothing
+                    return Nothing
                   else do
                     putStrLn $ "Diff between expected " ++ cabalFile ++
                                " and actual " ++ dhallFile ++ " :"
@@ -112,16 +113,40 @@
                   & set Dhall.sourceName dhallFile
           ]
      , testGroup "cabal-to-dhall"
-         [ goldenVsStringDiff
+         [ goldenTest
              ( takeBaseName cabalFile )
-             ( \ ref new -> [ "diff", "-u", ref, new ] )
-             dhallFile
+             ( LazyText.readFile dhallFile )
              ( BS.readFile cabalFile >>= parseGenericPackageDescriptionThrows
-                 & fmap ( LazyText.encodeUtf8 . Pretty.renderLazy
+                 & fmap ( Pretty.renderLazy
                         . Pretty.layoutSmart layoutOpts . Pretty.pretty
                         . cabalToDhall dhallLocation
                         )
              )
+
+             ( \( LazyText.unpack -> exp ) ( LazyText.unpack -> act ) -> do
+                 let
+                   gDiff =
+                     getGroupedDiff ( lines exp ) ( lines act )
+
+                   ppDiff' =
+                     ppDiff gDiff
+
+                 if ppDiff' == "\n"
+                   then return Nothing
+                   else do
+                     putStrLn
+                       ( "Diff between expected "
+                           ++ dhallFile
+                           ++ " and actual "
+                           ++ cabalFile
+                           ++ " :"
+                       )
+
+                     putStrLn ppDiff'
+
+                     return ( Just "Generated .dhall file does not match input" )
+              )
+              ( LazyText.writeFile dhallFile )
          | cabalFile <- cabalFiles
          , let dhallFile = replaceExtension cabalFile ".dhall"
          ]
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,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -8,17 +8,15 @@
       , version =
           prelude.v "0"
       , license =
-          prelude.types.Licenses.SPDX
+          types.License.SPDX
           ( prelude.SPDX.and
             ( prelude.SPDX.or
               ( prelude.SPDX.license
-                (prelude.types.LicenseId.AGPL_3_0_or_later {=})
-                ( Some
-                  (prelude.types.LicenseExceptionId.Classpath_exception_2_0 {=})
-                )
+                (types.LicenseId.AGPL_3_0_or_later {=})
+                (Some (types.LicenseExceptionId.Classpath_exception_2_0 {=}))
               )
               ( prelude.SPDX.licenseVersionOrLater
-                (prelude.types.LicenseId.Apache_2_0 {=})
+                (types.LicenseId.Apache_2_0 {=})
                 (None types.LicenseExceptionId)
               )
             )
diff --git a/golden-tests/cabal-to-dhall/benchmark.dhall b/golden-tests/cabal-to-dhall/benchmark.dhall
--- a/golden-tests/cabal-to-dhall/benchmark.dhall
+++ b/golden-tests/cabal-to-dhall/benchmark.dhall
@@ -1,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
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,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -13,14 +13,14 @@
           Some
           (   λ(config : types.Config)
             →       if config.impl
-                       (prelude.types.Compilers.GHC {=})
+                       (types.Compiler.GHC {=})
                        ( prelude.unionVersionRanges
                          (prelude.thisVersion (prelude.v "8.2"))
                          (prelude.laterVersion (prelude.v "8.2"))
                        )
               
               then        if config.impl
-                             (prelude.types.Compilers.GHC {=})
+                             (types.Compiler.GHC {=})
                              ( prelude.unionVersionRanges
                                (prelude.thisVersion (prelude.v "8.4"))
                                (prelude.laterVersion (prelude.v "8.4"))
@@ -42,7 +42,7 @@
                             }
               
               else  if config.impl
-                       (prelude.types.Compilers.GHC {=})
+                       (types.Compiler.GHC {=})
                        ( prelude.unionVersionRanges
                          (prelude.thisVersion (prelude.v "8.4"))
                          (prelude.laterVersion (prelude.v "8.4"))
@@ -61,5 +61,5 @@
                       }
           )
       , license =
-          prelude.types.Licenses.Unspecified {=}
+          types.License.Unspecified {=}
       }
diff --git a/golden-tests/cabal-to-dhall/default-license-2.2.dhall b/golden-tests/cabal-to-dhall/default-license-2.2.dhall
--- a/golden-tests/cabal-to-dhall/default-license-2.2.dhall
+++ b/golden-tests/cabal-to-dhall/default-license-2.2.dhall
@@ -1,5 +1,5 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in  prelude.defaults.Package ⫽ { name = "test", version = prelude.v "1.0" }
diff --git a/golden-tests/cabal-to-dhall/executable.dhall b/golden-tests/cabal-to-dhall/executable.dhall
--- a/golden-tests/cabal-to-dhall/executable.dhall
+++ b/golden-tests/cabal-to-dhall/executable.dhall
@@ -1,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
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,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -24,18 +24,18 @@
           Some
           (   λ(config : types.Config)
             →       if config.impl
-                       (prelude.types.Compilers.GHC {=})
+                       (types.Compiler.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 {=})
+                             (types.Compiler.GHC {=})
                              (prelude.earlierVersion (prelude.v "0.7.0.2"))
                     
                     then        if config.impl
-                                   (prelude.types.Compilers.GHC {=})
+                                   (types.Compiler.GHC {=})
                                    ( prelude.unionVersionRanges
                                      (prelude.thisVersion (prelude.v "0.0.9"))
                                      (prelude.laterVersion (prelude.v "0.0.9"))
@@ -76,7 +76,7 @@
                                   }
                     
                     else  if config.impl
-                             (prelude.types.Compilers.GHC {=})
+                             (types.Compiler.GHC {=})
                              ( prelude.unionVersionRanges
                                (prelude.thisVersion (prelude.v "0.0.9"))
                                (prelude.laterVersion (prelude.v "0.0.9"))
@@ -109,11 +109,11 @@
                           ⫽ { cpp-options = [ "-DINTEROP" ] }
               
               else  if config.impl
-                       (prelude.types.Compilers.GHC {=})
+                       (types.Compiler.GHC {=})
                        (prelude.earlierVersion (prelude.v "0.7.0.2"))
               
               then        if config.impl
-                             (prelude.types.Compilers.GHC {=})
+                             (types.Compiler.GHC {=})
                              ( prelude.unionVersionRanges
                                (prelude.thisVersion (prelude.v "0.0.9"))
                                (prelude.laterVersion (prelude.v "0.0.9"))
@@ -148,7 +148,7 @@
                           ⫽ { cpp-options = [ "-DPURE_JAVA_WITH" ] }
               
               else  if config.impl
-                       (prelude.types.Compilers.GHC {=})
+                       (types.Compiler.GHC {=})
                        ( prelude.unionVersionRanges
                          (prelude.thisVersion (prelude.v "0.0.9"))
                          (prelude.laterVersion (prelude.v "0.0.9"))
diff --git a/golden-tests/cabal-to-dhall/mixins-no-signatures.dhall b/golden-tests/cabal-to-dhall/mixins-no-signatures.dhall
--- a/golden-tests/cabal-to-dhall/mixins-no-signatures.dhall
+++ b/golden-tests/cabal-to-dhall/mixins-no-signatures.dhall
@@ -1,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -16,16 +16,16 @@
                           "foo"
                       , renaming =
                           { provides =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           , requires =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           }
                       }
                     , { package =
                           "bar"
                       , renaming =
                           { provides =
-                              prelude.types.ModuleRenaming.renaming
+                              types.ModuleRenaming.renaming
                               [ { rename = "Some.Module", to = "Some.Module" }
                               , { rename =
                                     "Some.Other.Module"
@@ -35,17 +35,17 @@
                               , { rename = "Third.Module", to = "Renamed" }
                               ]
                           , requires =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           }
                       }
                     , { package =
                           "baz"
                       , renaming =
                           { provides =
-                              prelude.types.ModuleRenaming.hiding
+                              types.ModuleRenaming.hiding
                               [ "Hidden", "Also.Hidden" ]
                           , requires =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           }
                       }
                     ]
diff --git a/golden-tests/cabal-to-dhall/otheros.dhall b/golden-tests/cabal-to-dhall/otheros.dhall
--- a/golden-tests/cabal-to-dhall/otheros.dhall
+++ b/golden-tests/cabal-to-dhall/otheros.dhall
@@ -1,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -12,7 +12,7 @@
       , library =
           Some
           (   λ(config : types.Config)
-            →       if config.os (prelude.types.OSs.OtherOS { _1 = "multics" })
+            →       if config.os (types.OS.OtherOS { _1 = "multics" })
               
               then    prelude.defaults.Library
                     ⫽ { exposed-modules = [ "A", "B" ] }
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,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
diff --git a/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall b/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall
--- a/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall
+++ b/golden-tests/cabal-to-dhall/sourcerepo-defaults.dhall
@@ -1,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ./../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ./../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -10,17 +10,17 @@
       , source-repos =
           [   prelude.defaults.SourceRepo
             ⫽ { type =
-                  Some (prelude.types.RepoType.Git {=})
+                  Some (types.RepoType.Git {=})
               , location =
                   Some "example.com"
               }
           ,   prelude.defaults.SourceRepo
             ⫽ { type =
-                  Some (prelude.types.RepoType.Darcs {=})
+                  Some (types.RepoType.Darcs {=})
               , location =
                   Some "example.org"
               , kind =
-                  prelude.types.RepoKind.RepoThis {=}
+                  types.RepoKind.RepoThis {=}
               }
           ]
       }
diff --git a/golden-tests/dhall-to-cabal/SPDX.dhall b/golden-tests/dhall-to-cabal/SPDX.dhall
--- a/golden-tests/dhall-to-cabal/SPDX.dhall
+++ b/golden-tests/dhall-to-cabal/SPDX.dhall
@@ -1,19 +1,39 @@
-   let prelude = ../../dhall/prelude.dhall
-in let types = ../../dhall/types.dhall
-in   prelude.defaults.Package
-  // { name = "foo"
-     , version = prelude.v "0"
-     , cabal-version = prelude.v "2.2"
-     , license = prelude.types.Licenses.SPDX
-         ( prelude.SPDX.and
-           ( prelude.SPDX.or
-             (prelude.SPDX.license (prelude.types.LicenseId.AGPL_3_0_or_later {=}) prelude.SPDX.noException)
-             (prelude.SPDX.licenseVersionOrLater (prelude.types.LicenseId.Apache_2_0 {=}) ([prelude.types.LicenseExceptionId.Classpath_exception_2_0 {=}] : Optional types.LicenseExceptionId))
+let prelude = ../../dhall/prelude.dhall
+
+let types = ../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "foo"
+      , version =
+          prelude.v "0"
+      , cabal-version =
+          prelude.v "2.2"
+      , license =
+          types.License.SPDX
+          ( prelude.SPDX.and
+            ( prelude.SPDX.or
+              ( prelude.SPDX.license
+                (types.LicenseId.AGPL_3_0_or_later {=})
+                prelude.SPDX.noException
+              )
+              ( prelude.SPDX.licenseVersionOrLater
+                (types.LicenseId.Apache_2_0 {=})
+                (Some (types.LicenseExceptionId.Classpath_exception_2_0 {=}))
+              )
+            )
+            ( prelude.SPDX.or
+              ( prelude.SPDX.ref
+                "MyFancyLicense"
+                (None types.LicenseExceptionId)
+              )
+              ( prelude.SPDX.refWithFile
+                "MyFancierLicense"
+                "LICENSE.txt"
+                (None types.LicenseExceptionId)
+              )
+            )
           )
-          ( prelude.SPDX.or
-            (prelude.SPDX.ref "MyFancyLicense" ([] : Optional types.LicenseExceptionId))
-            (prelude.SPDX.refWithFile "MyFancierLicense" "LICENSE.txt" ([] : Optional types.LicenseExceptionId))
-         )
-       )
-     , library = prelude.unconditional.library prelude.defaults.Library
-     }
+      , library =
+          prelude.unconditional.library prelude.defaults.Library
+      }
diff --git a/golden-tests/dhall-to-cabal/allrightsreserved-2.0.dhall b/golden-tests/dhall-to-cabal/allrightsreserved-2.0.dhall
--- a/golden-tests/dhall-to-cabal/allrightsreserved-2.0.dhall
+++ b/golden-tests/dhall-to-cabal/allrightsreserved-2.0.dhall
@@ -1,9 +1,16 @@
-   let prelude = ../../dhall/prelude.dhall
-in let types = ../../dhall/types.dhall
-in   prelude.defaults.Package
-  // { name = "foo"
-     , version = prelude.v "0"
-     , cabal-version = prelude.v "2.0"
-     , license = prelude.types.Licenses.AllRightsReserved {=}
-     , library = prelude.unconditional.library prelude.defaults.Library
-     }
+let prelude = ../../dhall/prelude.dhall
+
+let types = ../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "foo"
+      , version =
+          prelude.v "0"
+      , cabal-version =
+          prelude.v "2.0"
+      , license =
+          types.License.AllRightsReserved {=}
+      , library =
+          prelude.unconditional.library prelude.defaults.Library
+      }
diff --git a/golden-tests/dhall-to-cabal/allrightsreserved-2.2.dhall b/golden-tests/dhall-to-cabal/allrightsreserved-2.2.dhall
--- a/golden-tests/dhall-to-cabal/allrightsreserved-2.2.dhall
+++ b/golden-tests/dhall-to-cabal/allrightsreserved-2.2.dhall
@@ -1,9 +1,16 @@
-   let prelude = ../../dhall/prelude.dhall
-in let types = ../../dhall/types.dhall
-in   prelude.defaults.Package
-  // { name = "foo"
-     , version = prelude.v "0"
-     , cabal-version = prelude.v "2.2"
-     , license = prelude.types.Licenses.AllRightsReserved {=}
-     , library = prelude.unconditional.library prelude.defaults.Library
-     }
+let prelude = ../../dhall/prelude.dhall
+
+let types = ../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "foo"
+      , version =
+          prelude.v "0"
+      , cabal-version =
+          prelude.v "2.2"
+      , license =
+          types.License.AllRightsReserved {=}
+      , library =
+          prelude.unconditional.library prelude.defaults.Library
+      }
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
@@ -1,44 +1,63 @@
-   let prelude = ../../dhall/prelude.dhall
+let prelude = ../../dhall/prelude.dhall
 
-in let types = ../../dhall/types.dhall
+let types = ../../dhall/types.dhall
 
-in let v = prelude.v
+let v = prelude.v
 
-in let ghcImpl =
-       \ ( cfg : types.Config ) -> \ ( ver : types.VersionRange )
-    -> cfg.impl ( prelude.types.Compilers.GHC {=} ) ver
+let ghcImpl =
+        λ(cfg : types.Config)
+      → λ(ver : types.VersionRange)
+      → cfg.impl (types.Compiler.GHC {=}) ver
 
-in ../../dhall/defaults/Package.dhall 
-// { name =
-       "Name"
-   , version =
-       ../../dhall/Version/v.dhall  "1"
-   , library =
-        [ \ ( config : types.Config )
-         -> prelude.defaults.Library
-         // { exposed-modules = [ "Foo", "Bar" ]
-            , compiler-options =
-                   prelude.defaults.CompilerOptions
-                // { GHC = ["A"]
-                     # ( if ghcImpl config (prelude.orLaterVersion (v "8.2"))
-                         then ["B"]
-                         else [] : List Text
-                       )
-                     # ( if ghcImpl config (prelude.orLaterVersion (v "8.4"))
-                         then ["C"]
-                         else [] : List Text
-                       )
-                     # ( if ghcImpl config (prelude.orLaterVersion (v "8.2"))
-                         then ["D"]
-                         else [] : List Text
-                       )
-                     # ( if ghcImpl config (prelude.orLaterVersion (v "8.4"))
-                         then ["E"]
-                         else [] : List Text
-                       )
-                     # ["F"]
-                   }
-            }
-        ] : Optional ( types.Config -> types.Library )
-        
-   }
+in    ../../dhall/defaults/Package.dhall
+    ⫽ { name =
+          "Name"
+      , version =
+          ../../dhall/Version/v.dhall "1"
+      , library =
+          Some
+          (   λ(config : types.Config)
+            →   prelude.defaults.Library
+              ⫽ { exposed-modules =
+                    [ "Foo", "Bar" ]
+                , compiler-options =
+                      prelude.defaults.CompilerOptions
+                    ⫽ { GHC =
+                            [ "A" ]
+                          # (       if ghcImpl
+                                       config
+                                       (prelude.orLaterVersion (v "8.2"))
+                              
+                              then  [ "B" ]
+                              
+                              else  [] : List Text
+                            )
+                          # (       if ghcImpl
+                                       config
+                                       (prelude.orLaterVersion (v "8.4"))
+                              
+                              then  [ "C" ]
+                              
+                              else  [] : List Text
+                            )
+                          # (       if ghcImpl
+                                       config
+                                       (prelude.orLaterVersion (v "8.2"))
+                              
+                              then  [ "D" ]
+                              
+                              else  [] : List Text
+                            )
+                          # (       if ghcImpl
+                                       config
+                                       (prelude.orLaterVersion (v "8.4"))
+                              
+                              then  [ "E" ]
+                              
+                              else  [] : List Text
+                            )
+                          # [ "F" ]
+                      }
+                }
+          )
+      }
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
@@ -1,32 +1,41 @@
-   let prelude = ../../dhall/prelude.dhall
-
-in let types = ../../dhall/types.dhall
+let prelude = ../../dhall/prelude.dhall
 
-in let v = prelude.v
+let types = ../../dhall/types.dhall
 
-in let ghcImpl =
-       \ ( cfg : types.Config ) -> \ ( ver : types.VersionRange )
-    -> cfg.impl ( prelude.types.Compilers.GHC {=} ) ver
+let v = prelude.v
 
-in ../../dhall/defaults/Package.dhall
-// { name =
-       "Name"
-   , version =
-       ../../dhall/Version/v.dhall  "1"
-   , library =
-        [ \ ( config : types.Config )
-         -> prelude.defaults.Library
-         // { build-depends =
-                  [ { package = "A", bounds = prelude.anyVersion } ]
-                # ( if ghcImpl config (prelude.orLaterVersion (v "8.2"))
-                    then [ { package = "B", bounds = prelude.anyVersion } ]
-                    else [] : List types.Dependency
-                  )
-                # ( if ghcImpl config (prelude.orLaterVersion (v "8.4"))
-                    then [ { package = "C", bounds = prelude.anyVersion } ]
-                    else [] : List types.Dependency
-                  )
-            }
-        ] : Optional ( types.Config -> types.Library )
+let ghcImpl =
+        λ(cfg : types.Config)
+      → λ(ver : types.VersionRange)
+      → cfg.impl (types.Compiler.GHC {=}) ver
 
-   }
+in    ../../dhall/defaults/Package.dhall
+    ⫽ { name =
+          "Name"
+      , version =
+          v "1"
+      , library =
+          Some
+          (   λ(config : types.Config)
+            →   prelude.defaults.Library
+              ⫽ { build-depends =
+                      [ { package = "A", bounds = prelude.anyVersion } ]
+                    # (       if ghcImpl
+                                 config
+                                 (prelude.orLaterVersion (v "8.2"))
+                        
+                        then  [ { package = "B", bounds = prelude.anyVersion } ]
+                        
+                        else  [] : List types.Dependency
+                      )
+                    # (       if ghcImpl
+                                 config
+                                 (prelude.orLaterVersion (v "8.4"))
+                        
+                        then  [ { package = "C", bounds = prelude.anyVersion } ]
+                        
+                        else  [] : List types.Dependency
+                      )
+                }
+          )
+      }
diff --git a/golden-tests/dhall-to-cabal/default-license-2.2.dhall b/golden-tests/dhall-to-cabal/default-license-2.2.dhall
--- a/golden-tests/dhall-to-cabal/default-license-2.2.dhall
+++ b/golden-tests/dhall-to-cabal/default-license-2.2.dhall
@@ -1,8 +1,14 @@
-   let prelude = ../../dhall/prelude.dhall
-in let types = ../../dhall/types.dhall
-in   prelude.defaults.Package
-  // { name = "foo"
-     , version = prelude.v "0"
-     , cabal-version = prelude.v "2.2"
-     , library = prelude.unconditional.library prelude.defaults.Library
-     }
+let prelude = ../../dhall/prelude.dhall
+
+let types = ../../dhall/types.dhall
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "foo"
+      , version =
+          prelude.v "0"
+      , cabal-version =
+          prelude.v "2.2"
+      , library =
+          prelude.unconditional.library prelude.defaults.Library
+      }
diff --git a/golden-tests/dhall-to-cabal/dhall-to-cabal.dhall b/golden-tests/dhall-to-cabal/dhall-to-cabal.dhall
--- a/golden-tests/dhall-to-cabal/dhall-to-cabal.dhall
+++ b/golden-tests/dhall-to-cabal/dhall-to-cabal.dhall
@@ -1,62 +1,60 @@
-    let prelude = ../../dhall/prelude.dhall 
-
-in  let types = ../../dhall/types.dhall 
+let prelude = ../../dhall/prelude.dhall
 
-in  let v = prelude.v
+let types = ../../dhall/types.dhall
 
-in  let anyVersion = prelude.anyVersion
+let v = prelude.v
 
-in  let OS = types.OS
+let anyVersion = prelude.anyVersion
 
-in  let package =
-            λ(package : Text)
-          → λ(version-range : types.VersionRange)
-          → { bounds = version-range, package = package }
+let package =
+        λ(package : Text)
+      → λ(version-range : types.VersionRange)
+      → { bounds = version-range, package = package }
 
-in  let majorVersions = prelude.utils.majorVersions
+let majorVersions = prelude.utils.majorVersions
 
-in  let deps =
-          { Cabal =
-              majorVersions "Cabal" [ v "2.0" ]
-          , Diff =
-              majorVersions "Diff" [ v "0.3.4" ]
-          , base =
-              majorVersions "base" [ v "4.10" ]
-          , bytestring =
-              majorVersions "bytestring" [ v "0.10" ]
-          , containers =
-              majorVersions "containers" [ v "0.5" ]
-          , dhall =
-              majorVersions "dhall" [ v "1.12.0" ]
-          , dhall-to-cabal =
-              package "dhall-to-cabal" anyVersion
-          , filepath =
-              majorVersions "filepath" [ v "1.4" ]
-          , insert-ordered-containers =
-              majorVersions "insert-ordered-containers" [ v "0.2.1.0" ]
-          , optparse-applicative =
-              majorVersions "optparse-applicative" [ v "0.13.2", v "0.14" ]
-          , prettyprinter =
-              majorVersions "prettyprinter" [ v "1.2.0.1" ]
-          , contravariant =
-              majorVersions "contravariant" [ v "1.4" ]
-          , hashable =
-              majorVersions "hashable" [ v "1.2.6.1" ]
-          , tasty =
-              majorVersions "tasty" [ v "0.11" ]
-          , tasty-golden =
-              majorVersions "tasty-golden" [ v "2.3" ]
-          , text =
-              majorVersions "text" [ v "1.2" ]
-          , formatting =
-              majorVersions "formatting" [ v "6.3.1" ]
-          , transformers =
-              majorVersions "transformers" [ v "0.5.2" ]
-          , trifecta =
-              majorVersions "trifecta" [ v "1.7" ]
-          , vector =
-              majorVersions "vector" [ v "0.12" ]
-          }
+let deps =
+      { Cabal =
+          majorVersions "Cabal" [ v "2.0" ]
+      , Diff =
+          majorVersions "Diff" [ v "0.3.4" ]
+      , base =
+          majorVersions "base" [ v "4.10" ]
+      , bytestring =
+          majorVersions "bytestring" [ v "0.10" ]
+      , containers =
+          majorVersions "containers" [ v "0.5" ]
+      , dhall =
+          majorVersions "dhall" [ v "1.12.0" ]
+      , dhall-to-cabal =
+          package "dhall-to-cabal" anyVersion
+      , filepath =
+          majorVersions "filepath" [ v "1.4" ]
+      , insert-ordered-containers =
+          majorVersions "insert-ordered-containers" [ v "0.2.1.0" ]
+      , optparse-applicative =
+          majorVersions "optparse-applicative" [ v "0.13.2", v "0.14" ]
+      , prettyprinter =
+          majorVersions "prettyprinter" [ v "1.2.0.1" ]
+      , contravariant =
+          majorVersions "contravariant" [ v "1.4" ]
+      , hashable =
+          majorVersions "hashable" [ v "1.2.6.1" ]
+      , tasty =
+          majorVersions "tasty" [ v "0.11" ]
+      , tasty-golden =
+          majorVersions "tasty-golden" [ v "2.3" ]
+      , text =
+          majorVersions "text" [ v "1.2" ]
+      , formatting =
+          majorVersions "formatting" [ v "6.3.1" ]
+      , transformers =
+          majorVersions "transformers" [ v "0.5.2" ]
+      , trifecta =
+          majorVersions "trifecta" [ v "1.7" ]
+      , vector =
+          majorVersions "vector" [ v "0.12" ]
+      }
 
 in    prelude.utils.GitHub-project
       { owner = "ocharles", repo = "dhall-to-cabal" }
@@ -133,7 +131,7 @@
           , "dhall/types/SetupBuildInfo.dhall"
           ]
       , license =
-          prelude.types.Licenses.MIT {=}
+          types.License.MIT {=}
       , license-files =
           [ "LICENSE" ]
       , version =
@@ -163,13 +161,13 @@
               , hs-source-dirs =
                   [ "lib" ]
               , other-extensions =
-                  [ prelude.types.Extensions.ApplicativeDo True
-                  , prelude.types.Extensions.GADTs True
-                  , prelude.types.Extensions.GeneralizedNewtypeDeriving True
-                  , prelude.types.Extensions.LambdaCase True
-                  , prelude.types.Extensions.OverloadedStrings True
-                  , prelude.types.Extensions.RecordWildCards True
-                  , prelude.types.Extensions.TypeApplications True
+                  [ types.Extension.ApplicativeDo True
+                  , types.Extension.GADTs True
+                  , types.Extension.GeneralizedNewtypeDeriving True
+                  , types.Extension.LambdaCase True
+                  , types.Extension.OverloadedStrings True
+                  , types.Extension.RecordWildCards True
+                  , types.Extension.TypeApplications True
                   ]
               , other-modules =
                   [ "DhallToCabal.ConfigTree"
@@ -177,8 +175,7 @@
                   , "Dhall.Extra"
                   ]
               , default-language =
-                  [ prelude.types.Languages.Haskell2010 {=} ] : Optional
-                                                                types.Language
+                  Some (types.Language.Haskell2010 {=})
               }
           )
       , executables =
@@ -199,10 +196,9 @@
                 , main-is =
                     "Main.hs"
                 , other-extensions =
-                    [ prelude.types.Extensions.NamedFieldPuns True ]
+                    [ types.Extension.NamedFieldPuns True ]
                 , default-language =
-                    [ prelude.types.Languages.Haskell2010 {=} ] : Optional
-                                                                  types.Language
+                    Some (types.Language.Haskell2010 {=})
                 }
             )
           , prelude.unconditional.executable
@@ -225,10 +221,9 @@
                 , main-is =
                     "Main.hs"
                 , other-extensions =
-                    [ prelude.types.Extensions.NamedFieldPuns True ]
+                    [ types.Extension.NamedFieldPuns True ]
                 , default-language =
-                    [ prelude.types.Languages.Haskell2010 {=} ] : Optional
-                                                                  types.Language
+                    Some (types.Language.Haskell2010 {=})
                 }
             )
           ]
@@ -250,11 +245,9 @@
                 , hs-source-dirs =
                     [ "golden-tests" ]
                 , type =
-                    prelude.types.TestTypes.exitcode-stdio
-                    { main-is = "GoldenTests.hs" }
+                    types.TestType.exitcode-stdio { main-is = "GoldenTests.hs" }
                 , default-language =
-                    [ prelude.types.Languages.Haskell2010 {=} ] : Optional
-                                                                  types.Language
+                    Some (types.Language.Haskell2010 {=})
                 }
             )
           ]
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
@@ -1,15 +1,14 @@
-  ../../dhall/defaults/Package.dhall 
+  ../../dhall/defaults/Package.dhall
 ⫽ { name =
       "Name"
   , version =
-      ../../dhall/Version/v.dhall  "1"
+      ../../dhall/Version/v.dhall "1"
   , executables =
       [ { name =
             "foo"
         , executable =
-            λ(config : ../../dhall/types/Config.dhall)
-          → ../../dhall/defaults/Executable.dhall
-          ⫽ { main-is = "Main.hs" }
+              λ(config : ../../dhall/types/Config.dhall)
+            → ../../dhall/defaults/Executable.dhall ⫽ { main-is = "Main.hs" }
         }
       ]
   }
diff --git a/golden-tests/dhall-to-cabal/gh-53.dhall b/golden-tests/dhall-to-cabal/gh-53.dhall
--- a/golden-tests/dhall-to-cabal/gh-53.dhall
+++ b/golden-tests/dhall-to-cabal/gh-53.dhall
@@ -1,6 +1,6 @@
-    let prelude = ../../dhall/prelude.dhall
+let prelude = ../../dhall/prelude.dhall
 
-in  let types = ../../dhall/types.dhall
+let types = ../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { cabal-version =
@@ -21,27 +21,29 @@
             }
           ]
       , library =
-          [   λ ( config
-                : types.Config
-                )
-            →       if    config.impl
-                          (prelude.types.Compilers.GHC {=})
-                          (prelude.orLaterVersion (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"
+          Some
+          (   λ(config : types.Config)
+            →       if config.impl
+                       (types.Compiler.GHC {=})
+                       (prelude.orLaterVersion (prelude.v "0.0.9"))
+              
+              then        if config.flag "wai-servlet-debug"
+                    
                     then    prelude.defaults.Library
-                          ⫽ { cpp-options = [ "-DWAI_SERVLET_DEBUG" ] }
-
+                          ⫽ { 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/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
@@ -1,32 +1,45 @@
-   let prelude = ../../dhall/prelude.dhall
-
-in let types = ../../dhall/types.dhall
+let prelude = ../../dhall/prelude.dhall
 
-in let v = prelude.v
+let types = ../../dhall/types.dhall
 
-in let ghcImpl =
-       \ ( cfg : types.Config ) -> \ ( ver : types.VersionRange )
-    -> cfg.impl ( prelude.types.Compilers.GHC {=} ) ver
+let v = prelude.v
 
-in ../../dhall/defaults/Package.dhall
-// { name =
-       "Name"
-   , version =
-       ../../dhall/Version/v.dhall  "1"
-   , library =
-        [ \ ( config : types.Config )
-         -> prelude.defaults.Library
-         // { exposed-modules =
-                [ "Module1" ]
-              # ( if ghcImpl config ( prelude.orLaterVersion ( v "7.1.3" ) )
-                  then [ "Module2" ] else [ ] : List Text )
-            , other-modules =
-                ( if ghcImpl config ( prelude.orLaterVersion ( v "7.1.3" ) )
-                  then [ "OtherModule" ] else [ ] : List Text )
-            , cpp-options =
-                ( if ghcImpl config ( prelude.orLaterVersion ( v "7.1.3" ) )
-                  then [ "-DCOND1" ] else [ ] : List Text )
-            }
-        ] : Optional ( ../../dhall/types/Guarded.dhall  types.Library )
+let ghcImpl =
+        λ(cfg : types.Config)
+      → λ(ver : types.VersionRange)
+      → cfg.impl (types.Compiler.GHC {=}) ver
 
-   }
+in    ./../../dhall/defaults/Package.dhall
+    ⫽ { name =
+          "Name"
+      , version =
+          v "1"
+      , library =
+          Some
+          (   λ(config : types.Config)
+            →   prelude.defaults.Library
+              ⫽ { exposed-modules =
+                      [ "Module1" ]
+                    # (       if ghcImpl
+                                 config
+                                 (prelude.orLaterVersion (v "7.1.3"))
+                        
+                        then  [ "Module2" ]
+                        
+                        else  [] : List Text
+                      )
+                , other-modules =
+                          if ghcImpl config (prelude.orLaterVersion (v "7.1.3"))
+                    
+                    then  [ "OtherModule" ]
+                    
+                    else  [] : List Text
+                , cpp-options =
+                          if ghcImpl config (prelude.orLaterVersion (v "7.1.3"))
+                    
+                    then  [ "-DCOND1" ]
+                    
+                    else  [] : List Text
+                }
+          )
+      }
diff --git a/golden-tests/dhall-to-cabal/map-source-repo.dhall b/golden-tests/dhall-to-cabal/map-source-repo.dhall
--- a/golden-tests/dhall-to-cabal/map-source-repo.dhall
+++ b/golden-tests/dhall-to-cabal/map-source-repo.dhall
@@ -1,20 +1,14 @@
-    let prelude = ../../dhall/prelude.dhall
+let prelude = ../../dhall/prelude.dhall
 
-in  let types = ../../dhall/types.dhall
+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 {=}
-                }
-          )
+let updateRepo =
+      prelude.utils.mapSourceRepos
+      (   λ(srcRepo : types.SourceRepo)
+        → srcRepo ⫽ { tag = Some "1.0.0", kind = types.RepoKind.RepoThis {=} }
+      )
 
-in  let project =
-          prelude.utils.GitHub-project { owner = "owner", repo = "repo" }
+let project = prelude.utils.GitHub-project { owner = "owner", repo = "repo" }
 
 in  updateRepo
     (   project
@@ -25,8 +19,8 @@
                   "foo"
               , executable =
                     λ(config : ../../dhall/types/Config.dhall)
-                  → ../../dhall/defaults/Executable.dhall
-				  ⫽ { main-is = "Main.hs" }
+                  →   ../../dhall/defaults/Executable.dhall
+                    ⫽ { main-is = "Main.hs" }
               }
             ]
         }
diff --git a/golden-tests/dhall-to-cabal/mixins-no-signatures.dhall b/golden-tests/dhall-to-cabal/mixins-no-signatures.dhall
--- a/golden-tests/dhall-to-cabal/mixins-no-signatures.dhall
+++ b/golden-tests/dhall-to-cabal/mixins-no-signatures.dhall
@@ -1,6 +1,6 @@
-    let prelude = ./../../dhall/prelude.dhall
+let prelude = ../../dhall/prelude.dhall
 
-in  let types = ./../../dhall/types.dhall
+let types = ../../dhall/types.dhall
 
 in    prelude.defaults.Package
     ⫽ { name =
@@ -8,23 +8,24 @@
       , version =
           prelude.v "0"
       , library =
-          [   λ(config : types.Config)
+          Some
+          (   λ(config : types.Config)
             →   prelude.defaults.Library
               ⫽ { mixins =
                     [ { package =
                           "foo"
                       , renaming =
                           { provides =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           , requires =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           }
                       }
                     , { package =
                           "bar"
                       , renaming =
                           { provides =
-                              prelude.types.ModuleRenaming.renaming
+                              types.ModuleRenaming.renaming
                               [ { rename = "Some.Module", to = "Some.Module" }
                               , { rename =
                                     "Some.Other.Module"
@@ -34,20 +35,20 @@
                               , { rename = "Third.Module", to = "Renamed" }
                               ]
                           , requires =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           }
                       }
                     , { package =
                           "baz"
                       , renaming =
                           { provides =
-                              prelude.types.ModuleRenaming.hiding
+                              types.ModuleRenaming.hiding
                               [ "Hidden", "Also.Hidden" ]
                           , requires =
-                              prelude.types.ModuleRenaming.default {=}
+                              types.ModuleRenaming.default {=}
                           }
                       }
                     ]
                 }
-          ] : Optional (types.Config → types.Library)
+          )
       }
diff --git a/golden-tests/dhall-to-cabal/nested-conditions.dhall b/golden-tests/dhall-to-cabal/nested-conditions.dhall
--- a/golden-tests/dhall-to-cabal/nested-conditions.dhall
+++ b/golden-tests/dhall-to-cabal/nested-conditions.dhall
@@ -1,20 +1,39 @@
-   let prelude = ../../dhall/prelude.dhall 
-in let types = ../../dhall/types.dhall 
-in let v = prelude.v
-in   prelude.defaults.Package
-  // { name = "foo"
-     , version = v "0"
-     , library =
-       [ \ (config : types.Config) -> prelude.defaults.Library
-           // { compiler-options = prelude.defaults.CompilerOptions
-                 // { GHC = [ "-Weverything" ]
-                        # (if config.impl (prelude.types.Compilers.GHC {=}) (prelude.orLaterVersion (v "8.2"))
-                             then [ "-Wno-redundant-constraints" ] : List Text
-                             else [] : List Text)
-                        # (if config.impl (prelude.types.Compilers.GHC {=}) (prelude.orLaterVersion (v "8.4"))
-                             then [ "-Wno-missing-export-lists" ] : List Text
-                             else [] : List Text)
-                    }
-              }
-       ] : Optional (types.Config -> types.Library)
-     }
+let prelude = ../../dhall/prelude.dhall
+
+let types = ../../dhall/types.dhall
+
+let v = prelude.v
+
+in    prelude.defaults.Package
+    ⫽ { name =
+          "foo"
+      , version =
+          v "0"
+      , library =
+          Some
+          (   λ(config : types.Config)
+            →   prelude.defaults.Library
+              ⫽ { compiler-options =
+                      prelude.defaults.CompilerOptions
+                    ⫽ { GHC =
+                            [ "-Weverything" ]
+                          # (       if config.impl
+                                       (types.Compiler.GHC {=})
+                                       (prelude.orLaterVersion (v "8.2"))
+                              
+                              then  [ "-Wno-redundant-constraints" ] : List Text
+                              
+                              else  [] : List Text
+                            )
+                          # (       if config.impl
+                                       (types.Compiler.GHC {=})
+                                       (prelude.orLaterVersion (v "8.4"))
+                              
+                              then  [ "-Wno-missing-export-lists" ] : List Text
+                              
+                              else  [] : List Text
+                            )
+                      }
+                }
+          )
+      }
diff --git a/lib/CabalToDhall.hs b/lib/CabalToDhall.hs
--- a/lib/CabalToDhall.hs
+++ b/lib/CabalToDhall.hs
@@ -17,6 +17,7 @@
 
 import Data.Foldable ( foldMap )
 import Data.Functor.Contravariant ( (>$<), Contravariant( contramap ) )
+import Data.List.NonEmpty ( NonEmpty(..) )
 import Data.Monoid ( First(..) )
 import Data.Semigroup ( Semigroup, (<>) )
 import GHC.Stack
@@ -27,7 +28,7 @@
 import qualified Data.Text as StrictText
 import qualified Dhall
 import qualified Dhall.Core
-import qualified Dhall.Core as Expr ( Expr(..), Var(..) )
+import qualified Dhall.Core as Expr ( Expr(..), Var(..), Binding(..), Chunks(..) )
 import qualified Dhall.Map as Map
 import qualified Dhall.Parser
 import qualified Dhall.TypeCheck
@@ -103,8 +104,10 @@
   -> 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 ) )
+  Expr.Let
+    ( Expr.Binding "prelude" Nothing ( Expr.Embed ( preludeLocation dhallLocation ) )
+   :| [ Expr.Binding "types" Nothing ( Expr.Embed ( typesLocation dhallLocation ) ) ]
+    )
     $ Dhall.TypeCheck.absurd <$>
         Dhall.embed
           genericPackageDescriptionToDhall
@@ -139,11 +142,11 @@
   PreludeV ->
     Expr.Var "prelude" `Expr.Field` "v"
   PreludeConstructorsLicense ->
-    Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Licenses"
+    Expr.Var "types" `Expr.Field` "License"
   PreludeConstructorsRepoKind ->
-    Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoKind"
+    Expr.Var "types" `Expr.Field` "RepoKind"
   PreludeConstructorsScope ->
-    Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Scopes"
+    Expr.Var "types" `Expr.Field` "Scope"
 
 
 type Default s a
@@ -160,7 +163,7 @@
 getDefault typesLoc resolve typ = withTypesImport expr
   where
     withTypesImport =
-      Expr.Let "types" Nothing ( Expr.Embed typesLoc )
+      Expr.Let (Expr.Binding "types" Nothing ( Expr.Embed typesLoc ) :| [])
 
     factorBuildInfo fields =
       let
@@ -643,6 +646,8 @@
             license "Unspecified" ( Expr.RecordLit mempty )
           Right ( Cabal.UnknownLicense "UnspecifiedLicense" ) ->
             license "Unspecified" ( Expr.RecordLit mempty )
+          Right ( Cabal.UnknownLicense l ) ->
+            license "Unspecified" ( Expr.TextLit (Expr.Chunks [] (StrictText.pack l)) )
           Right Cabal.OtherLicense ->
             license "Other" ( Expr.RecordLit mempty )
           Left ( SPDX.License x ) ->
@@ -653,7 +658,7 @@
   where
     license name =
       Expr.App
-        ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Licenses" `Expr.Field` name )
+        ( Expr.Var "types" `Expr.Field` "License" `Expr.Field` name )
 
 spdxLicenseExpressionToDhall :: Dhall.InputType SPDX.LicenseExpression
 spdxLicenseExpressionToDhall =
@@ -718,7 +723,7 @@
   Dhall.InputType
     { Dhall.embed = \ident ->
         Expr.App
-          ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "LicenseId" `Expr.Field` identName ident )
+          ( Expr.Var "types" `Expr.Field` "LicenseId" `Expr.Field` identName ident )
           ( Expr.RecordLit mempty )
     , Dhall.declared =
         Expr.Var "types" `Expr.Field` "LicenseId"
@@ -735,7 +740,7 @@
   Dhall.InputType
     { Dhall.embed = \ident ->
         Expr.App
-          ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "LicenseExceptionId" `Expr.Field` identName ident )
+          ( Expr.Var "types" `Expr.Field` "LicenseExceptionId" `Expr.Field` identName ident )
           ( Expr.RecordLit mempty )
     , Dhall.declared =
         Expr.Var "types" `Expr.Field` "LicenseExceptionId"
@@ -827,7 +832,7 @@
 compilerFlavor =
   let
     constructor k v =
-      Expr.App ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Compilers" `Expr.Field` k ) v
+      Expr.App ( Expr.Var "types" `Expr.Field` "Compiler" `Expr.Field` k ) v
 
   in
   Dhall.InputType
@@ -950,15 +955,15 @@
     { Dhall.embed = \case
         Cabal.RepoThis ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoKind" `Expr.Field` "RepoThis" )
+            ( Expr.Var "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.Var "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.Var "types" `Expr.Field` "RepoKind" `Expr.Field` "RepoThis" )
             ( Expr.RecordLit ( Map.singleton "_1" ( dhallString str ) ) )
     , Dhall.declared =
         Expr.Var "types" `Expr.Field` "RepoKind"
@@ -994,7 +999,7 @@
     }
   where
     constr name =
-      Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "RepoType" `Expr.Field` name
+      Expr.Var "types" `Expr.Field` "RepoType" `Expr.Field` name
 
 
 specVersion :: Dhall.InputType ( Either Cabal.Version Cabal.VersionRange )
@@ -1011,22 +1016,22 @@
     { Dhall.embed = \case
         Cabal.Simple ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "BuildTypes" `Expr.Field` "Simple" )
+            ( Expr.Var "types" `Expr.Field` "BuildType" `Expr.Field` "Simple" )
             ( Expr.RecordLit mempty )
 
         Cabal.Configure ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "BuildTypes" `Expr.Field` "Configure" )
+            ( Expr.Var "types" `Expr.Field` "BuildType" `Expr.Field` "Configure" )
             ( Expr.RecordLit mempty )
 
         Cabal.Custom ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "BuildTypes" `Expr.Field` "Custom" )
+            ( Expr.Var "types" `Expr.Field` "BuildType" `Expr.Field` "Custom" )
             ( Expr.RecordLit mempty )
 
         Cabal.Make ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "BuildTypes" `Expr.Field` "Make" )
+            ( Expr.Var "types" `Expr.Field` "BuildType" `Expr.Field` "Make" )
             ( Expr.RecordLit mempty )
 
     , Dhall.declared =
@@ -1193,91 +1198,91 @@
     { Dhall.embed = \case
         Cabal.Linux ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Linux" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "Linux" )
             ( Expr.RecordLit mempty )
 
         Cabal.Windows ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Windows" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "Windows" )
             ( Expr.RecordLit mempty )
 
         Cabal.OSX ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "OSX" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "OSX" )
             ( Expr.RecordLit mempty )
 
         Cabal.FreeBSD ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "FreeBSD" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "FreeBSD" )
             ( Expr.RecordLit mempty )
 
         Cabal.OpenBSD ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "OpenBSD" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "OpenBSD" )
             ( Expr.RecordLit mempty )
 
         Cabal.NetBSD ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "NetBSD" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "NetBSD" )
             ( Expr.RecordLit mempty )
 
         Cabal.DragonFly ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "DragonFly" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "DragonFly" )
             ( Expr.RecordLit mempty )
 
         Cabal.Solaris ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Solaris" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "Solaris" )
             ( Expr.RecordLit mempty )
 
         Cabal.AIX ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "AIX" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "AIX" )
             ( Expr.RecordLit mempty )
 
         Cabal.HPUX ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "HPUX" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "HPUX" )
             ( Expr.RecordLit mempty )
 
         Cabal.IRIX ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "IRIX" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "IRIX" )
             ( Expr.RecordLit mempty )
 
         Cabal.HaLVM ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "HaLVM" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "HaLVM" )
             ( Expr.RecordLit mempty )
 
         Cabal.Hurd ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Hurd" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "Hurd" )
             ( Expr.RecordLit mempty )
 
         Cabal.IOS ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "IOS" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "IOS" )
             ( Expr.RecordLit mempty )
 
         Cabal.Android ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Android" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "Android" )
             ( Expr.RecordLit mempty )
 
         Cabal.Ghcjs ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "Ghcjs" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "Ghcjs" )
             ( Expr.RecordLit mempty )
 
         Cabal.OtherOS os ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OSs" `Expr.Field` "OtherOS" )
+            ( Expr.Var "types" `Expr.Field` "OS" `Expr.Field` "OtherOS" )
             ( Expr.RecordLit ( Map.singleton "_1" ( dhallString os ) ) )
 
     , Dhall.declared =
-        Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "OS"
+        Expr.Var "types" `Expr.Field` "OS"
     }
 
 
@@ -1449,7 +1454,7 @@
 
   extWith trueFalse ext =
     Expr.App
-      ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Extensions" `Expr.Field` extName ext )
+      ( Expr.Var "types" `Expr.Field` "Extension" `Expr.Field` extName ext )
       ( Expr.BoolLit trueFalse )
 
 
@@ -1508,7 +1513,7 @@
           case a of
             Cabal.ModuleRenaming renamed ->
               Expr.App
-                ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "ModuleRenaming" `Expr.Field` "renaming" )
+                ( Expr.Var "types" `Expr.Field` "ModuleRenaming" `Expr.Field` "renaming" )
                 ( Expr.ListLit
                     Nothing
                     ( fmap
@@ -1525,11 +1530,11 @@
                 )
             Cabal.DefaultRenaming ->
               Expr.App
-                ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "ModuleRenaming" `Expr.Field` "default" )
+                ( Expr.Var "types" `Expr.Field` "ModuleRenaming" `Expr.Field` "default" )
                 ( Expr.RecordLit mempty )
             Cabal.HidingRenaming hidden ->
               Expr.App
-                ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "ModuleRenaming" `Expr.Field` "hiding" )
+                ( Expr.Var "types" `Expr.Field` "ModuleRenaming" `Expr.Field` "hiding" )
                 ( Expr.ListLit
                     Nothing
                     ( Dhall.embed moduleName <$> Seq.fromList hidden )
@@ -1543,7 +1548,12 @@
 benchmark =
   (  runRecordInputTypeWithDefault Benchmark benchmarkDefault
        ( mconcat
-           [ recordField "main-is" ( ( \( Cabal.BenchmarkExeV10 _ s ) -> s ) . Cabal.benchmarkInterface >$< stringToDhall )
+           [ recordField "main-is" (
+                ( \case Cabal.BenchmarkExeV10 _ fp -> fp
+                        Cabal.BenchmarkUnsupported _ -> errorWithoutStackTrace "Unsupported benchmark type"
+                )
+              . Cabal.benchmarkInterface >$< stringToDhall
+              )
            , Cabal.benchmarkBuildInfo >$< buildInfoRecord
            ]
        )
@@ -1618,11 +1628,11 @@
     { Dhall.embed = \case
         Cabal.ExecutablePublic ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "Scopes" `Expr.Field` "Public" )
+            ( Expr.Var "types" `Expr.Field` "Scope" `Expr.Field` "Public" )
             ( Expr.RecordLit mempty )
         Cabal.ExecutablePrivate ->
           Expr.App
-            ( Expr.Var "prelude" `Expr.Field` "types" `Expr.Field` "scopes" `Expr.Field` "Private" )
+            ( Expr.Var "types" `Expr.Field` "Scope" `Expr.Field` "Private" )
             ( Expr.RecordLit mempty )
     , Dhall.declared =
         Expr.Var "types" `Expr.Field` "Scope"
diff --git a/lib/Dhall/Extra.hs b/lib/Dhall/Extra.hs
--- a/lib/Dhall/Extra.hs
+++ b/lib/Dhall/Extra.hs
@@ -12,7 +12,6 @@
   where
 
 import Control.Monad ( join )
-import Data.Hashable ( Hashable )
 import Data.List ( sortBy )
 import Data.Ord ( comparing )
 
diff --git a/lib/DhallLocation.hs b/lib/DhallLocation.hs
--- a/lib/DhallLocation.hs
+++ b/lib/DhallLocation.hs
@@ -37,7 +37,7 @@
                     Dhall.Core.Remote
                       ( Dhall.Core.URL
                           Dhall.Core.HTTPS
-                          "https://raw.githubusercontent.com"
+                          "raw.githubusercontent.com"
                           ( Dhall.Core.File
                              ( Dhall.Core.Directory [ "dhall", version, "dhall-to-cabal", "dhall-lang" ] )
                              "prelude.dhall"
@@ -61,7 +61,7 @@
                     Dhall.Core.Remote
                       ( Dhall.Core.URL
                           Dhall.Core.HTTPS
-                          "https://raw.githubusercontent.com"
+                          "raw.githubusercontent.com"
                           ( Dhall.Core.File
                              ( Dhall.Core.Directory [ "dhall", version, "dhall-to-cabal", "dhall-lang" ] )
                              "types.dhall"
diff --git a/lib/DhallToCabal.hs b/lib/DhallToCabal.hs
--- a/lib/DhallToCabal.hs
+++ b/lib/DhallToCabal.hs
@@ -74,7 +74,7 @@
 import qualified Language.Haskell.Extension as Cabal
 
 import qualified Dhall.Core as Expr
-  ( Chunks(..), Const(..), Expr(..) )
+  ( Chunks(..), Const(..), Expr(..), Var(..) )
 
 import Dhall.Extra
 import DhallToCabal.ConfigTree ( ConfigTree(..), toConfigTree )
@@ -641,15 +641,6 @@
         Expr.App "orEarlierVersion" components ->
           Cabal.orEarlierVersion <$> Dhall.extract version components
 
-        Expr.App ( Expr.App "unionVersionRanges" a ) b ->
-          Cabal.unionVersionRanges <$> go a <*> go b
-
-        Expr.App ( Expr.App "intersectVersionRanges" a ) b ->
-          Cabal.intersectVersionRanges <$> go a <*> go b
-
-        Expr.App ( Expr.App "differenceVersionRanges" a ) b ->
-          Cabal.differenceVersionRanges <$> go a <*> go b
-
         Expr.App "invertVersionRange" components ->
           Cabal.invertVersionRange <$> go components
 
@@ -659,6 +650,15 @@
         Expr.App "majorBoundVersion" components ->
           Cabal.majorBoundVersion <$> Dhall.extract version components
 
+        Expr.App ( Expr.App "unionVersionRanges" a ) b ->
+          Cabal.unionVersionRanges <$> go a <*> go b
+
+        Expr.App ( Expr.App "intersectVersionRanges" a ) b ->
+          Cabal.intersectVersionRanges <$> go a <*> go b
+
+        Expr.App ( Expr.App "differenceVersionRanges" a ) b ->
+          Cabal.differenceVersionRanges <$> go a <*> go b
+
         _ ->
           Nothing
 
@@ -723,6 +723,7 @@
         , ( "PublicDomain", Right Cabal.PublicDomain <$ Dhall.unit )
         , ( "AllRightsReserved", Right Cabal.AllRightsReserved<$ Dhall.unit )
         , ( "Unspecified", Right Cabal.UnspecifiedLicense <$ Dhall.unit )
+        , ( "Unknown", Right . Cabal.UnknownLicense <$> Dhall.string )
         , ( "Other", Right Cabal.OtherLicense <$ Dhall.unit )
         , ( "SPDX", Left . SPDX.License <$> spdxLicense )
         ]
@@ -770,10 +771,10 @@
           exceptionMay <- Dhall.extract ( Dhall.maybe spdxLicenseExceptionId ) exceptionMayM
           return ( SPDX.ELicense ( SPDX.ELicenseRef ( SPDX.mkLicenseRef' ( Just filename ) ident ) ) exceptionMay )
 
-        Expr.App ( Expr.App "and" a ) b ->
+        Expr.App ( Expr.App ( Expr.Var (Expr.V "and" 0)) a ) b ->
           SPDX.EAnd <$> go a <*> go b
 
-        Expr.App ( Expr.App "or" a ) b ->
+        Expr.App ( Expr.App ( Expr.Var (Expr.V "or"  0)) a ) b ->
           SPDX.EOr <$> go a <*> go b
 
         _ ->
diff --git a/lib/DhallToCabal/ConfigTree.hs b/lib/DhallToCabal/ConfigTree.hs
--- a/lib/DhallToCabal/ConfigTree.hs
+++ b/lib/DhallToCabal/ConfigTree.hs
@@ -69,7 +69,7 @@
 rewriteConfigUse :: Var -> Expr s a -> ConfigTree (Expr s a) (Expr s a)
 rewriteConfigUse v =
  transformMOf
-   subExpr
+   subExpressions
    ( \expr ->
        if isConfigUse expr then
          Branch
@@ -97,6 +97,3 @@
 transformMOf l f = go where
   go t = l go t >>= f
 {-# INLINE transformMOf #-}
-
-
-
diff --git a/lib/DhallToCabal/Util.hs b/lib/DhallToCabal/Util.hs
new file mode 100644
--- /dev/null
+++ b/lib/DhallToCabal/Util.hs
@@ -0,0 +1,36 @@
+{-# language ViewPatterns #-}
+
+module DhallToCabal.Util
+  ( relativeTo
+  )
+  where
+
+import System.FilePath
+  ( dropTrailingPathSeparator, joinPath, normalise, splitDirectories, takeDirectory )
+
+-- | Like 'System.FilePath.makeRelative', but will introduce @..@
+-- segments (and hence will misbehave in the presence of symlinks).
+--
+-- If the path being relativised is identical to the root path, then
+-- this will return the empty string.
+relativeTo
+  :: FilePath
+     -- ^ The path to be relative to. Note that the final file-name is
+     -- ignored: @foo/bar@ is relative to @foo/@, even if @foo/bar@ is
+     -- a directory.
+  -> FilePath
+     -- ^ The path to relativise.
+  -> FilePath
+relativeTo =
+  \ ( splitDirectories . dropTrailingPathSeparator . takeDirectory . normalise -> base ) ->
+  \ ( splitDirectories . normalise -> path ) ->
+      joinPath ( go base path )
+  where
+  -- @normalise "."@ is @"."@, so we have to take care here with dots.
+  go ( a : as ) ( b : bs )
+    | a == b = go as bs
+    | a == "." = go as ( b : bs )
+    | b == "." = go (a : as) bs
+    | otherwise = ( ".." <$ ( a : as ) ) ++ ( b : bs )
+  go [] bs = bs
+  go as [] = ".." <$ as
diff --git a/meta/Main.hs b/meta/Main.hs
--- a/meta/Main.hs
+++ b/meta/Main.hs
@@ -12,12 +12,14 @@
 import Data.String ( fromString )
 import System.Directory ( createDirectoryIfMissing )
 import System.FilePath
-  ( (</>), (<.>), dropTrailingPathSeparator, joinPath, normalise
+  ( (</>), (<.>), dropTrailingPathSeparator, normalise
   , splitDirectories, splitFileName, takeDirectory
   )
 
 import CabalToDhall
   ( KnownDefault, PreludeReference (..), getDefault )
+import DhallToCabal.Util
+  ( relativeTo )
 
 import qualified Data.Text.Prettyprint.Doc as Pretty
 import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
@@ -49,27 +51,6 @@
 defaultFile typ = "./defaults" </> show typ <.> "dhall"
 
 
--- | Like 'System.FilePath.makeRelative', but will introduce @..@
--- segments (and hence will misbehave in the presence of symlinks).
-relativeTo
-  :: FilePath
-     -- ^ The path to be relative to. Note that the final file-name is
-     -- ignored: @foo/bar@ is relative to @foo/@, even if @foo/bar@ is
-     -- a directory.
-  -> FilePath
-     -- ^ The path to relativise.
-  -> FilePath
-relativeTo =
-  \ ( splitDirectories . dropTrailingPathSeparator . takeDirectory . normalise -> base ) ->
-  \ ( splitDirectories . normalise -> path ) ->
-      joinPath ( go base path )
-  where
-  go ( a : as ) ( b : bs )
-    | a == b = go as bs
-    | otherwise = ( ".." <$ ( a : as ) ) ++ ( b : bs )
-  go [] bs = bs
-  go as [] = ".." <$ as
-
 importFile :: FilePath -> Dhall.Core.Import
 importFile ( splitFileName -> ( directory, filename ) ) =
   let
@@ -113,11 +94,11 @@
             Expr.Embed
               ( importFile ( relativeTo localDest ( defaultFile typ ) ) )
           PreludeConstructorsLicense ->
-            Expr.Constructors ( Expr.Var "types" `Expr.Field` "License" )
+            Expr.Var "types" `Expr.Field` "License"
           PreludeConstructorsRepoKind ->
-            Expr.Constructors ( Expr.Var "types" `Expr.Field` "RepoKind" )
+            Expr.Var "types" `Expr.Field` "RepoKind"
           PreludeConstructorsScope ->
-            Expr.Constructors ( Expr.Var "types" `Expr.Field` "Scope" )
+            Expr.Var "types" `Expr.Field` "Scope"
           PreludeV ->
             Expr.Embed
               ( importFile ( relativeTo localDest "./Version/v.dhall" ) )
