core: derivation test, use Text.Lazy.IO

This commit is contained in:
Richard Marko 2023-11-19 18:06:26 +01:00
parent 42f56f504f
commit 17d20b5417

View File

@ -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
)