Always format output of the dhall executable (#303)

Fixes #284
This commit is contained in:
Gabriel Gonzalez 2018-02-25 14:31:38 -08:00 committed by GitHub
parent 1bd7884c05
commit 4b3f28374c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,6 @@ import qualified System.IO
data Options w = Options
{ explain :: w ::: Bool <?> "Explain error messages in more detail"
, version :: w ::: Bool <?> "Display version and exit"
, pretty :: w ::: Bool <?> "Format output"
} deriving (Generic)
instance ParseRecord (Options Wrapped)
@ -46,9 +45,6 @@ opts =
Pretty.defaultLayoutOptions
{ Pretty.layoutPageWidth = Pretty.AvailablePerLine 80 1.0 }
unbounded :: Pretty.LayoutOptions
unbounded = Pretty.LayoutOptions { Pretty.layoutPageWidth = Pretty.Unbounded }
main :: IO ()
main = do
Options {..} <- Options.Generic.unwrapRecord "Compiler for the Dhall language"
@ -96,7 +92,7 @@ main = do
let render h e = do
let doc = prettyExpr e
let layoutOptions = if pretty then opts else unbounded
let layoutOptions = opts
let stream = Pretty.layoutSmart layoutOptions doc
supportsANSI <- System.Console.ANSI.hSupportsANSI h