Skip to content

Commit 9916421

Browse files
committed
Main: main': printer: m org
1 parent 8e710dd commit 9916421

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

main/Main.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,24 +178,24 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
178178
| isFinder = findAttrs <=< fromValue @(AttrSet StdVal)
179179
| otherwise = printer'
180180
where
181+
-- 2021-05-27: NOTE: With naive fix of the #941
182+
-- This is overall a naive printer implementation, as options should interact/respect one another.
183+
-- A nice question: "Should respect one another to what degree?": Go full combinator way, for which
184+
-- old Nix CLI is nototrious for (and that would mean to reimplement the old Nix CLI),
185+
-- OR: https://github.com/haskell-nix/hnix/issues/172 and have some sane standart/default behaviour for (most) keys.
181186
printer'
182-
| isXml = fun (ignoreContext . toXML) normalForm
183-
-- 2021-05-27: NOTE: With naive fix of the #941
184-
-- This is overall a naive printer implementation, as options should interact/respect one another.
185-
-- A nice question: "Should respect one another to what degree?": Go full combinator way, for which
186-
-- old Nix CLI is nototrious for (and that would mean to reimplement the old Nix CLI),
187-
-- 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
187+
| isXml = out (ignoreContext . toXML) normalForm
188+
| isJson = out (ignoreContext . mempty . toJSONNixString) normalForm
189+
| isStrict = out (show . prettyNValue) normalForm
190+
| isValues = out (show . prettyNValueProv) removeEffects
191+
| otherwise = out (show . prettyNValue) removeEffects
192192
where
193-
fun
193+
out
194194
:: (b -> Text)
195195
-> (a -> StandardIO b)
196196
-> a
197197
-> StdIO
198-
fun g f = liftIO . Text.putStrLn . g <=< f
198+
out transform val = liftIO . Text.putStrLn . transform <=< val
199199

200200
findAttrs
201201
:: AttrSet StdVal

0 commit comments

Comments
 (0)