How to implement search in file system in haskell?
<p>I'm not exactly new to haskell, but haven't used it much in real world.</p>

<p>So what I want to do is to find all git repositories starting from some folders. Basically I'm trying to do this <code>find . -type d -exec test -e '{}/.git' ';' -print -prune</code> only faster via using haskell concurrency features.</p>

<p>This is what I got so far.</p>

<pre><code>import Control.Concurrent.Async
import System.Directory (doesDirectoryExist)
import System.FilePath ((&lt;/&gt;))
import System.IO (FilePath)


isGitRepo :: FilePath -&gt; IO Bool
isGitRepo p = doesDirectoryExist $ p &lt;/&gt; ".git"


main :: IO ()
main = putStrLn "hello"
</code></pre>

<p>I've found this <a href="https://www.stackage.org/haddock/lts-7.14/async-2.1.1/Control-Concurrent-Async.html#v:mapConcurrently" rel="nofollow noreferrer">lib</a> which has this function <code>mapConcurrently :: Traversable t =&gt; (a -&gt; IO b) -&gt; t a -&gt; IO (t b)</code>
Which got me thinking that what I need is to produce lazy Tree data structure that would reflect folders structure. Then filter it concurrently with <code>isGitRepo</code> and that fold it into list and print it.
Well, of course I know how to make <code>data FTree = Node String [FTree]</code> or something like that, but I have questions.
How to produce it concurrently? How to produce absolute path while traversing the tree? Questions like that and so on.</p>