This a working snippet:
import Turtle
...
groom :: FilePath -> IO ()
groom src = do
view (ls src)
...
I can see a list of paths on the console. Actually I'd like to have something like [FilePath]
for use, e.g.:
treeCount :: FilePath -> Int
treeCount src = length (lstree src)
Naturally, it won't compile, lstree
being what it is:
lstree :: FilePath -> Shell FilePath
What is the correct way to treat this Shell
thing? It's a newbie question, sorry.
I haven't actually tried this, but just looking at the type signatures the following might work:
import qualified Control.Foldl as F
treeCount :: FilePath -> IO Int
treeCount src = fold (lstree src) F.length
Fold with F.list
to get [FilePath]
instead.