diff options
Diffstat (limited to 'compiler/src/Input.hs')
-rw-r--r-- | compiler/src/Input.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs index 75d1ed3..6ed7471 100644 --- a/compiler/src/Input.hs +++ b/compiler/src/Input.hs | |||
@@ -19,7 +19,7 @@ | |||
19 | module Input | 19 | module Input |
20 | ( decodeYamlFile | 20 | ( decodeYamlFile |
21 | , Sidecar(..) | 21 | , Sidecar(..) |
22 | , InputTree(..), readInputTree | 22 | , InputTree(..), readInputTree, filterInputTree |
23 | ) where | 23 | ) where |
24 | 24 | ||
25 | 25 | ||
@@ -132,3 +132,14 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root | |||
132 | 132 | ||
133 | findThumbnail :: [FSNode] -> Maybe Path | 133 | findThumbnail :: [FSNode] -> Maybe Path |
134 | findThumbnail = (fmap Files.path) . (find isThumbnail) | 134 | findThumbnail = (fmap Files.path) . (find isThumbnail) |
135 | |||
136 | -- | Filters an InputTree. The root is always returned. | ||
137 | filterInputTree :: (InputTree -> Bool) -> InputTree -> InputTree | ||
138 | filterInputTree cond = filterNode | ||
139 | where | ||
140 | filterNode :: InputTree -> InputTree | ||
141 | filterNode inputFile@InputFile{} = inputFile | ||
142 | filterNode inputDir@InputDir{items} = | ||
143 | filter cond items | ||
144 | & map filterNode | ||
145 | & \curatedItems -> inputDir { items = curatedItems } :: InputTree | ||