packages feed

hercules-ci-cnix-expr-0.3.0.0: test/Hercules/CNix/Store/TestUtil.hs

{-# LANGUAGE BlockArguments #-}

module Hercules.CNix.Store.TestUtil where

import Hercules.CNix.Store (Store, withStoreFromURI)
import Protolude
import System.IO.Temp (withSystemTempDirectory)

withTempStore :: (Store -> IO a) -> IO a
withTempStore f =
  withSystemTempDirectory "cnix-test-store" \d ->
    withStoreFromURI (toS d) f