Return a list of subdirs of a given dir
This commit is contained in:
parent
abbef763e7
commit
ccdd98ca7e
2 changed files with 16 additions and 2 deletions
|
@ -14,6 +14,19 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
module Vervis
|
module Vervis
|
||||||
(
|
( subdirs
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
import Data.Maybe (mapMaybe)
|
||||||
|
import System.Directory.Tree
|
||||||
|
|
||||||
|
subdirs :: FilePath -> IO [FilePath]
|
||||||
|
subdirs dir = do
|
||||||
|
_base :/ tree <- buildL dir
|
||||||
|
return $ case tree of
|
||||||
|
Dir _ cs ->
|
||||||
|
let dirName (Dir n _) = Just n
|
||||||
|
dirName _ = Nothing
|
||||||
|
in mapMaybe dirName cs
|
||||||
|
_ -> []
|
||||||
|
|
|
@ -29,7 +29,8 @@ library
|
||||||
exposed-modules: Vervis
|
exposed-modules: Vervis
|
||||||
-- other-modules:
|
-- other-modules:
|
||||||
-- other-extensions:
|
-- other-extensions:
|
||||||
build-depends: base >=4.8 && <5
|
build-depends: base >=4.8 && <5
|
||||||
|
, directory-tree >=0.12
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
Loading…
Reference in a new issue