File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -10,25 +10,26 @@ import System.Nix.Derivation ( parseDerivation
1010 , buildDerivation
1111 )
1212
13- import qualified Data.Attoparsec.Text.Lazy
13+ import qualified Data.Attoparsec.Text
1414import qualified Data.Text.IO
1515import qualified Data.Text.Lazy
1616import qualified Data.Text.Lazy.Builder
1717
1818processDerivation :: FilePath -> FilePath -> IO ()
1919processDerivation source dest = do
2020 contents <- Data.Text.IO. readFile source
21- case
22- Data.Attoparsec.Text.Lazy. parseOnly
23- (parseDerivation " /nix/store" )
24- contents
25- of
26- Left e -> error e
27- Right drv ->
21+ either
22+ fail
23+ (\ drv ->
2824 Data.Text.IO. writeFile dest
2925 . Data.Text.Lazy. toStrict
3026 . Data.Text.Lazy.Builder. toLazyText
3127 $ buildDerivation drv
28+ )
29+ (Data.Attoparsec.Text. parseOnly
30+ (parseDerivation " /nix/store" )
31+ contents
32+ )
3233
3334test_derivation :: TestTree
3435test_derivation =
Original file line number Diff line number Diff line change 55
66module StorePath where
77
8- import qualified Data.Attoparsec.Text.Lazy
8+ import qualified Data.Attoparsec.Text
99
1010import Test.Tasty.QuickCheck
1111
@@ -24,8 +24,8 @@ prop_storePathRoundtrip' x =
2424
2525prop_storePathRoundtripParser :: NixLike -> NixLike -> Property
2626prop_storePathRoundtripParser (_ :: NixLike ) = \ (NixLike x) ->
27- (Data.Attoparsec.Text.Lazy. parseOnly (pathParser $ storePathRoot x) $ storePathToText x) === Right x
27+ (Data.Attoparsec.Text. parseOnly (pathParser $ storePathRoot x) $ storePathToText x) === Right x
2828
2929prop_storePathRoundtripParser' :: StorePath -> Property
3030prop_storePathRoundtripParser' x =
31- (Data.Attoparsec.Text.Lazy. parseOnly (pathParser $ storePathRoot x) $ storePathToText x) === Right x
31+ (Data.Attoparsec.Text. parseOnly (pathParser $ storePathRoot x) $ storePathToText x) === Right x
You can’t perform that action at this time.
0 commit comments