Skip to content

Commit dab5a93

Browse files
Merge #802 NixString: rm hacky funs, convert principled funs into regular ones
This nearly finishes the work people did on the NixString & StringContext handling. HNix had hacky* implementations used for a long time, and now type and implementation systems arrived into great shape that all of the functions become principled. * Closes: #383 #384 #385. * Removed hacky functions/. * Reduced prefixes from functions. * NixString now is a Monoid, project code now leverages that. * Clean-up & restructure in the Nix.String module.
2 parents fb3786e + 80b283d commit dab5a93

File tree

16 files changed

+218
-246
lines changed

16 files changed

+218
-246
lines changed

benchmarks/ParserBench.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ module ParserBench (benchmarks) where
22

33
import Nix.Parser
44

5-
import Control.Applicative
65
import Criterion
76

87
benchFile :: FilePath -> Benchmark
9-
benchFile = bench <*> whnfIO . parseNixFile . ("data/" ++)
8+
benchFile = bench <*> whnfIO . parseNixFile . ("data/" <>)
109

1110
benchmarks :: Benchmark
1211
benchmarks = bgroup
13-
"Parser"
14-
[ benchFile "nixpkgs-all-packages.nix"
15-
, benchFile "nixpkgs-all-packages-pretty.nix"
16-
, benchFile "let-comments.nix"
17-
, benchFile "let-comments-multiline.nix"
18-
, benchFile "let.nix"
19-
, benchFile "simple.nix"
20-
, benchFile "simple-pretty.nix"
21-
]
12+
"Parser" $
13+
fmap benchFile
14+
[ "nixpkgs-all-packages.nix"
15+
, "nixpkgs-all-packages-pretty.nix"
16+
, "let-comments.nix"
17+
, "let-comments-multiline.nix"
18+
, "let.nix"
19+
, "simple.nix"
20+
, "simple-pretty.nix"
21+
]

main/Main.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ main = do
143143
= liftIO
144144
. putStrLn
145145
. Text.unpack
146-
. principledStringIgnoreContext
146+
. stringIgnoreContext
147147
. toXML
148148
<=< normalForm
149149
| json opts
150150
= liftIO
151151
. Text.putStrLn
152-
. principledStringIgnoreContext
152+
. stringIgnoreContext
153153
<=< nvalueToJSONNixString
154154
| strict opts
155155
= liftIO . print . prettyNValue <=< normalForm

0 commit comments

Comments
 (0)