File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ import Nix.Parser
4141import Nix.String
4242import Nix.Thunk
4343import Nix.Value
44- import Prettyprinter
44+ import Prettyprinter hiding ( list )
4545import Text.Read ( readMaybe )
4646import Nix.Utils
4747
@@ -212,18 +212,12 @@ exprFNixDoc :: NExprF (NixDoc ann) -> NixDoc ann
212212exprFNixDoc = \ case
213213 NConstant atom -> prettyAtom atom
214214 NStr str -> simpleExpr $ prettyString str
215- NList [] -> simpleExpr " []"
216215 NList xs ->
217- prettyContainer $
218- [" [" ] <> (wrapParens appOpNonAssoc <$> xs) <> [" ]" ]
219- NSet NNonRecursive [] -> simpleExpr " {}"
216+ prettyContainer " [" (wrapParens appOpNonAssoc) " ]" xs
220217 NSet NNonRecursive xs ->
221- prettyContainer $
222- [" {" ] <> (prettyBind <$> xs) <> [" }" ]
223- NSet NRecursive [] -> simpleExpr " rec {}"
218+ prettyContainer " {" prettyBind " }" xs
224219 NSet NRecursive xs ->
225- prettyContainer $
226- [" rec {" ] <> (prettyBind <$> xs) <> [" }" ]
220+ prettyContainer " rec {" prettyBind " }" xs
227221 NAbs args body ->
228222 leastPrecedence $
229223 nest 2 $
@@ -302,8 +296,11 @@ exprFNixDoc = \case
302296 [" assert " <> withoutParens cond <> " ;" , align $ withoutParens body]
303297 NSynHole name -> simpleExpr $ pretty (" ^" <> name)
304298 where
305- prettyContainer =
306- simpleExpr . group . nest 2 . vsep
299+ prettyContainer h f t c =
300+ list
301+ (simpleExpr (h <> t))
302+ (const $ simpleExpr $ group $ nest 2 $ vsep $ [h] <> (f <$> c) <> [t])
303+ c
307304
308305
309306valueToExpr :: forall t f m . MonadDataContext f m => NValue t f m -> NExpr
You can’t perform that action at this time.
0 commit comments