Skip to content

Commit 862ccef

Browse files
committed
Add PathFilter newtype to System.Nix.Store.Types
1 parent 152ce6f commit 862ccef

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hnix-store-core/src/System/Nix/ReadonlyStore.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Crypto.Hash (Context, Digest, SHA256)
1313
import Data.ByteString (ByteString)
1414
import Data.HashSet (HashSet)
1515
import System.Nix.Hash (BaseEncoding(Base16), NamedAlgo(algoName))
16-
import System.Nix.Store.Types (FileIngestionMethod(..), RepairMode)
16+
import System.Nix.Store.Types (FileIngestionMethod(..), PathFilter, RepairMode)
1717
import System.Nix.StorePath (StoreDir, StorePath(StorePath), StorePathName)
1818

1919
import qualified Crypto.Hash
@@ -99,7 +99,7 @@ computeStorePathForPath
9999
-> StorePathName -- ^ Name part of the newly created `StorePath`
100100
-> FilePath -- ^ Local `FilePath` to add
101101
-> FileIngestionMethod -- ^ Add target directory recursively
102-
-> (FilePath -> Bool) -- ^ Path filter function
102+
-> PathFilter -- ^ Path filter function
103103
-> RepairMode -- ^ Only used by local store backend
104104
-> IO StorePath
105105
computeStorePathForPath storeDir name pth recursive _pathFilter _repair = do

hnix-store-core/src/System/Nix/Store/Types.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module System.Nix.Store.Types
22
( FileIngestionMethod(..)
3+
, PathFilter(..)
34
, RepairMode(..)
45
) where
56

@@ -11,6 +12,11 @@ data FileIngestionMethod
1112
| FileIngestionMethod_FileRecursive
1213
deriving (Bounded, Eq, Generic, Enum, Ord, Show)
1314

15+
-- | Path filtering function
16+
newtype PathFilter = PathFilter
17+
{ pathFilterFunction :: FilePath -> Bool
18+
}
19+
1420
-- | Repair mode
1521
data RepairMode
1622
= RepairMode_DoRepair

0 commit comments

Comments
 (0)