diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+1.2.8
+
+* Build against `dhall-1.40.0`
+
 1.2.7
 
 * Build against `dhall-1.39.0`
diff --git a/dhall-yaml.cabal b/dhall-yaml.cabal
--- a/dhall-yaml.cabal
+++ b/dhall-yaml.cabal
@@ -1,8 +1,7 @@
 Name: dhall-yaml
-Version: 1.2.7
+Version: 1.2.8
 Cabal-Version: >=1.10
 Build-Type: Simple
-Tested-With: GHC == 8.4.3, GHC == 8.6.1
 License: GPL-3
 License-File: LICENSE
 Copyright: 2019 Gabriel Gonzalez
@@ -37,7 +36,7 @@
         base                      >= 4.11.0.0  && < 5   ,
         aeson                     >= 1.0.0.0   && < 1.6 ,
         bytestring                                < 0.12,
-        dhall                     >= 1.31.0    && < 1.40,
+        dhall                     >= 1.31.0    && < 1.41,
         dhall-json                >= 1.6.0     && < 1.8 ,
         optparse-applicative      >= 0.14.0.0  && < 0.17,
         text                      >= 0.11.1.0  && < 1.3 ,
diff --git a/yaml-to-dhall/Main.hs b/yaml-to-dhall/Main.hs
--- a/yaml-to-dhall/Main.hs
+++ b/yaml-to-dhall/Main.hs
@@ -17,16 +17,11 @@
 
 import qualified Control.Exception
 import qualified Data.ByteString.Char8                     as BSL8
-import qualified Data.Text.IO                              as Text.IO
-import qualified Data.Text.Prettyprint.Doc                 as Pretty
-import qualified Data.Text.Prettyprint.Doc.Render.Terminal as Pretty.Terminal
-import qualified Data.Text.Prettyprint.Doc.Render.Text     as Pretty.Text
-import qualified Dhall.Pretty
 import qualified Dhall.YamlToDhall                         as YamlToDhall
+import qualified Dhall.Util
 import qualified GHC.IO.Encoding
 import qualified Options.Applicative                       as Options
 import qualified Paths_dhall_yaml                          as Meta
-import qualified System.Console.ANSI                       as ANSI
 import qualified System.Exit
 import qualified System.IO                                 as IO
 
@@ -146,30 +141,6 @@
             Nothing   -> BSL8.getContents
             Just path -> BSL8.readFile path
 
-    let renderExpression characterSet plain output expression = do
-            let document = Dhall.Pretty.prettyCharacterSet characterSet expression
-
-            let stream = Dhall.Pretty.layout document
-
-            case output of
-                Nothing -> do
-                    supportsANSI <- ANSI.hSupportsANSI IO.stdout
-
-                    let ansiStream =
-                            if supportsANSI && not plain
-                            then fmap Dhall.Pretty.annToAnsiStyle stream
-                            else Pretty.unAnnotateS stream
-
-                    Pretty.Terminal.renderIO IO.stdout ansiStream
-
-                    Text.IO.putStrLn ""
-
-                Just file_ ->
-                    IO.withFile file_ IO.WriteMode $ \h -> do
-                        Pretty.Text.renderIO h stream
-
-                        Text.IO.hPutStrLn h ""
-
     case options of
         Version ->
             putStrLn (showVersion Meta.version)
@@ -182,7 +153,7 @@
 
                 expression <- dhallFromYaml (Options schema conversion) yaml
 
-                renderExpression characterSet plain output expression
+                Dhall.Util.renderExpression characterSet plain output expression
 
         Type{..} -> do
             let characterSet = toCharacterSet ascii
@@ -192,7 +163,7 @@
 
                 schema <- YamlToDhall.schemaFromYaml yaml
 
-                renderExpression characterSet plain output schema
+                Dhall.Util.renderExpression characterSet plain output schema
 
 handle :: IO a -> IO a
 handle = Control.Exception.handle handler
