aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Input.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/Input.hs')
-rw-r--r--compiler/src/Input.hs13
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 @@
19module Input 19module 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.
137filterInputTree :: (InputTree -> Bool) -> InputTree -> InputTree
138filterInputTree 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