Skip to content

Commit 0e13db9

Browse files
Merge #987: specializing Path functions; enabling some tests; clean-up & refactors
Specialization of former `FilePath` functions to `Path` happens mainly to: 1. Prune String from code as much as possible and to maximally avoid conversions in the end. 2. To have typesafe code (I/somebody still should remove `Monoid` for `Path`). 3. Main reason: further to have an easy decision making how to control & process `Path`s and to have breather migration to `path` package (probably), which would make it even more realistic & typesafe code.
2 parents 0fdd17b + 38dcc05 commit 0e13db9

File tree

20 files changed

+883
-645
lines changed

20 files changed

+883
-645
lines changed

hnix.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ library
464464
, time >= 1.8.0 && < 1.9 || >= 1.9.3 && < 1.10
465465
, transformers >= 0.5.5 && < 0.6
466466
, transformers-base >= 0.4.5 && < 0.5
467-
, unix >= 2.7.2 && < 2.8
467+
, unix-compat >= 0.4.3 && < 0.6
468468
, unordered-containers >= 0.2.9 && < 0.3
469469
, vector >= 0.12.0 && < 0.13
470470
, xml >= 1.3.14 && < 1.4
@@ -613,7 +613,7 @@ test-suite hnix-tests
613613
, serialise
614614
, template-haskell
615615
, time
616-
, unix
616+
, unix-compat
617617
default-extensions:
618618
OverloadedStrings
619619
, DeriveGeneric

main/Main.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import Options.Applicative hiding ( ParserResult(..) )
3232
import Prettyprinter hiding ( list )
3333
import Prettyprinter.Render.Text ( renderIO )
3434
import qualified Repl
35-
import System.FilePath
3635
import Nix.Eval
3736

3837
main :: IO ()
@@ -72,15 +71,16 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
7271
expr <- liftIO Text.getContents
7372
processExpr expr
7473

75-
processSeveralFiles files = traverse_ processFile files
74+
processSeveralFiles :: [Path] -> StandardT (StdIdT IO) ()
75+
processSeveralFiles = traverse_ processFile
7676
where
7777
processFile path = handleResult (pure path) =<< parseNixFileLoc path
7878

7979
-- | The `--read` option: load expression from a serialized file.
8080
loadBinaryCacheFile =
8181
(\ (binaryCacheFile :: Path) ->
8282
do
83-
let file = coerce $ (replaceExtension . coerce) binaryCacheFile "nixc"
83+
let file = replaceExtension binaryCacheFile "nixc"
8484
processCLIOptions (Just file) =<< liftIO (readCache binaryCacheFile)
8585
) <$> readFrom
8686

@@ -160,7 +160,7 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
160160
| xml = fail "Rendering expression trees to XML is not yet implemented"
161161
| json = fail "Rendering expression trees to JSON is not implemented"
162162
| verbose >= DebugInfo = liftIO . putStr . ppShow . stripAnnotation $ expr
163-
| cache , Just path <- mpath = liftIO . writeCache (coerce $ replaceExtension (coerce path) "nixc") $ expr
163+
| cache , Just path <- mpath = liftIO . writeCache (replaceExtension path "nixc") $ expr
164164
| parseOnly = void . liftIO . Exception.evaluate . force $ expr
165165
| otherwise =
166166
liftIO .

0 commit comments

Comments
 (0)