Skip to content

Commit 8e710dd

Browse files
committed
Main: main': m layout
1 parent ae700e5 commit 8e710dd

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

main/Main.hs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
152152
| isEvaluate =
153153
if
154154
| isTrace -> evaluateExprWith nixTracingEvalExprLoc expr
155-
| Just path <- getReduce -> evaluateExprWith (reduction path . coerce) expr
156-
| null getArg || null getArgstr -> evaluateExprWith nixEvalExprLoc expr
155+
| Just path <- getReduce -> evaluateExprWith (reduction path . coerce) expr
156+
| null getArg || null getArgstr -> evaluateExprWith nixEvalExprLoc expr
157157
| otherwise -> processResult printer <=< nixEvalExprLoc (coerce mpath) $ expr
158158
| isXml = fail "Rendering expression trees to XML is not yet implemented"
159159
| isJson = fail "Rendering expression trees to JSON is not implemented"
160-
| getVerbosity >= DebugInfo = liftIO . putStr . ppShow . stripAnnotation $ expr
161-
| isCache , Just path <- mpath = liftIO . writeCache (replaceExtension path "nixc") $ expr
162-
| isParseOnly = void . liftIO . Exception.evaluate . force $ expr
163-
| otherwise =
160+
| getVerbosity >= DebugInfo = liftIO . putStr . ppShow . stripAnnotation $ expr
161+
| isCache , Just path <- mpath = liftIO . writeCache (replaceExtension path "nixc") $ expr
162+
| isParseOnly = void . liftIO . Exception.evaluate . force $ expr
163+
| otherwise =
164164
liftIO .
165165
renderIO
166166
stdout
@@ -179,16 +179,16 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
179179
| otherwise = printer'
180180
where
181181
printer'
182-
| isXml = fun (ignoreContext . toXML) normalForm
182+
| isXml = fun (ignoreContext . toXML) normalForm
183183
-- 2021-05-27: NOTE: With naive fix of the #941
184184
-- This is overall a naive printer implementation, as options should interact/respect one another.
185185
-- A nice question: "Should respect one another to what degree?": Go full combinator way, for which
186186
-- old Nix CLI is nototrious for (and that would mean to reimplement the old Nix CLI),
187187
-- OR: https://github.com/haskell-nix/hnix/issues/172 and have some sane standart/default behaviour for (most) keys.
188-
| isJson = fun (ignoreContext . mempty . toJSONNixString) normalForm
189-
| isStrict = fun (show . prettyNValue) normalForm
190-
| isValues = fun (show . prettyNValueProv) removeEffects
191-
| otherwise = fun (show . prettyNValue) removeEffects
188+
| isJson = fun (ignoreContext . mempty . toJSONNixString) normalForm
189+
| isStrict = fun (show . prettyNValue) normalForm
190+
| isValues = fun (show . prettyNValueProv) removeEffects
191+
| otherwise = fun (show . prettyNValue) removeEffects
192192
where
193193
fun
194194
:: (b -> Text)
@@ -238,9 +238,9 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
238238
(forceEntry path nv)
239239
(descend &&
240240
deferred
241-
(const False)
242-
(const True)
243-
val
241+
(const False)
242+
(const True)
243+
val
244244
)
245245
)
246246
(pure . pure . Free)

src/Nix/Pretty.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ hasAttrOp = getSpecialOperator NHasAttrOp
8989
-- | Determine if to return doc wraped into parens,
9090
-- according the given operator.
9191
precedenceWrap :: OperatorInfo -> NixDoc ann -> Doc ann
92-
precedenceWrap op sub = maybeWrap (getDoc sub)
92+
precedenceWrap op sub =
93+
maybeWrap (getDoc sub)
9394
where
9495
maybeWrap :: Doc ann -> Doc ann
9596
maybeWrap =

0 commit comments

Comments
 (0)