mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-11-23 20:56:20 +03:00
core: derivation test, use Text.Lazy.IO
This commit is contained in:
parent
42f56f504f
commit
17d20b5417
@ -7,22 +7,20 @@ import Test.Tasty.Golden (goldenVsFile)
|
||||
import System.Nix.Derivation (parseDerivation, buildDerivation)
|
||||
|
||||
import Data.Default.Class (Default(def))
|
||||
import qualified Data.Attoparsec.Text
|
||||
import qualified Data.Text.IO
|
||||
import qualified Data.Text.Lazy
|
||||
import qualified Data.Attoparsec.Text.Lazy
|
||||
import qualified Data.Text.Lazy.IO
|
||||
import qualified Data.Text.Lazy.Builder
|
||||
|
||||
processDerivation :: FilePath -> FilePath -> IO ()
|
||||
processDerivation source dest = do
|
||||
contents <- Data.Text.IO.readFile source
|
||||
contents <- Data.Text.Lazy.IO.readFile source
|
||||
either
|
||||
fail
|
||||
(Data.Text.IO.writeFile dest
|
||||
. Data.Text.Lazy.toStrict
|
||||
(Data.Text.Lazy.IO.writeFile dest
|
||||
. Data.Text.Lazy.Builder.toLazyText
|
||||
. buildDerivation def
|
||||
)
|
||||
(Data.Attoparsec.Text.parseOnly
|
||||
(Data.Attoparsec.Text.Lazy.parseOnly
|
||||
(parseDerivation def)
|
||||
contents
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user