@@ -16,8 +16,8 @@ module Elm.Compiler.Type
1616
1717import qualified Data.Text as Text
1818import qualified Data.Text.Encoding as Text
19−import qualified Text.PrettyPrint as P
20−import Text.PrettyPrint ((<+>))
19+import qualified Text.PrettyPrint.ANSI.Leijen as P
20+import Text.PrettyPrint.ANSI.Leijen ((<+>))
2121
2222import qualified AST.Source as Src
2323import qualified Elm.Name as N
@@ -63,15 +63,12 @@ data Format = OneLine | MultiLine
6363
6464toString :: Format -> Type -> String
6565toString format tipe =
66− let
67− mode =
68− case format of
69− OneLine ->
70− P.OneLineMode
71− MultiLine ->
72− P.PageMode
73− in
74− P.renderStyle (P.Style mode 80 1.0) (toDoc None tipe)
66+ case format of
67+ OneLine ->
68+ P.displayS (P.renderPretty 1.0 maxBound (toDoc None tipe)) ""
69+
70+ MultiLine ->
71+ P.displayS (P.renderPretty 1.0 80 (toDoc None tipe)) ""
7572
7673
7774data Context = None | InType | InFunction
@@ -114,11 +111,11 @@ toDoc context tipe =
114111
115112 _ ->
116113 let
114+ docName =
115+ P.text (N.toString name)
116+
117117 application =
118− P.hang
119− (P.text (N.toString name))
120− 2
121− (P.sep $ map (toDoc InType) args)
118+ P.hang 2 $ P.sep (docName : map (toDoc InType) args)
122119 in
123120 case context of
124121 InType ->
@@ -139,14 +136,12 @@ toDoc context tipe =
139136 ]
140137
141138 Just x ->
142− P.hang
143− ("{" <+> P.text (N.toString x) <+> "|")
144− 4
145− (P.sep
146− [ P.sep (P.punctuate "," (map entryToDoc fields))
147− , "}"
148− ]
149− )
139+ P.hang 4 $
140+ P.sep
141+ [ "{" <+> P.text (N.toString x) <+> "|"
142+ , P.sep (P.punctuate "," (map entryToDoc fields))
143+ , "}"
144+ ]
150145
151146
152147entryToDoc :: (N.Name, Type) -> P.Doc