@@ -1,11 +1,11 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE FlexibleContexts #-}
3−{-# LANGUAGE FlexibleInstances #-}
4−{-# LANGUAGE LambdaCase #-}
5−{-# LANGUAGE OverloadedStrings #-}
6−{-# LANGUAGE RankNTypes #-}
7−{-# LANGUAGE RecordWildCards #-}
8−{-# LANGUAGE ViewPatterns #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE LambdaCase #-}
5+{-# LANGUAGE OverloadedStrings #-}
6+{-# LANGUAGE RankNTypes #-}
7+{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE ViewPatterns #-}
99
1010-- Module : Gen.AST.Render
1111-- Copyright : (c) 2015-2016 Brendan Hay
@@ -35,7 +35,7 @@ import Gen.Formatting
3535import Gen.Syntax
3636import Gen.Types
3737import HIndent
38−import HIndent.Types (defaultConfig)
38+import HIndent.Types
3939import Language.Haskell.Exts.Build (name)
4040import Language.Haskell.Exts.Pretty as PP
4141import Prelude hiding (sum)
@@ -172,7 +172,7 @@ data PP
172172
173173pp :: (Pretty a, Show a) => PP -> a -> AST Rendered
174174pp i x
175− | i == Indent = result (reformat defaultConfig Nothing Nothing p)
175+ | i == Indent = result (reformat hindentConfig Nothing Nothing p)
176176 | otherwise = pure (LText.pack (C8.unpack p))
177177 where
178178 result = hoistEither . bimap (e . LText.pack) (LText.pack . LBS.unpack . LBB.toLazyByteString)
@@ -183,6 +183,11 @@ pp i x
183183 . C8.pack
184184 $ prettyPrintStyleMode s m x
185185
186+ hindentConfig = defaultConfig
187+ { configTrailingNewline = False
188+ , configSortImports = False
189+ }
190+
186191 s = style
187192 { mode = PageMode
188193 , lineLength = 80
@@ -199,15 +204,12 @@ pp i x
199204-- FIXME: dirty hack to render smart ctor parameter comments.
200205comments :: Prefix -> Map Local Solved -> Rendered -> Rendered
201206comments p (Map.toList -> rs) =
202− LText.replace " :: " "\n :: "
203− . LText.intercalate "\n -> "
204− . zipWith rel ps
205− . map LText.strip
206− . LText.splitOn "->"
207+ LText.replace " :: " "\n :: " .
208+ LText.intercalate "\n -> " .
209+ zipWith rel ps . map LText.strip . LText.splitOn "->"
207210 where
208211 ks = filter (parameter . _schema . snd) rs
209212 ps = map (Just . fst) ks ++ repeat Nothing
210−
211− rel Nothing t = t
213+ rel Nothing t = t
212214 rel (Just l) t =
213− t <> " -- ^ '" <> fromString (PP.prettyPrint (lname p l)) <> "'"
215+ t <> " -- ^ '" <> fromString (PP.prettyPrint (lname p l)) <> "'"