git.iko.soy/typeable/file-embed
on master help sign in
Exposing getDir
commit5fa4f48a7cc4b044febaa33d90bf62034087be28 authorMichael Snoyman <michael@snoyman.com> dateSun 29 Nov 2009, 22:40 (17 years ago) parent46d444a
2 files changed+10−3
Data/FileEmbed.hs+7 file-embed.cabal+3−3
Data/FileEmbed.hs+7
@@ -2,6 +2,7 @@
22module Data.FileEmbed
33 ( embedFile
44 , embedDir
5+ , getDir
56 ) where
67
78import Language.Haskell.TH (runQ,
@@ -36,6 +37,12 @@ embedFile fp = (runIO $ B.readFile fp) >>= bsToExp
3637embedDir :: FilePath -> Q Exp
3738embedDir fp = ListE <$> ((runIO $ fileList fp) >>= mapM pairToExp)
3839
40+-- | Get a directory tree in the IO monad.
41+--
42+-- This is the workhorse of 'embedDir'
43+getDir :: FilePath -> IO [(FilePath, B.ByteString)]
44+getDir = fileList
45+
3946pairToExp :: (FilePath, B.ByteString) -> Q Exp
4047pairToExp (path, bs) = do
4148 exp' <- bsToExp bs
file-embed.cabal+3−3
@@ -1,5 +1,5 @@
11name: file-embed
2−version: 0.0.2
2+version: 0.0.3
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -13,8 +13,8 @@ homepage: http://github.com/snoyberg/file-embed/tree/master
1313
1414library
1515 build-depends: base >= 4 && < 5,
16− bytestring >= 0.9.1.4 && < 1,
17− directory >= 1.0.0.3 && < 2,
16+ bytestring >= 0.9.1.4 && < 0.10,
17+ directory >= 1.0.0.3 && < 1.1,
1818 template-haskell
1919 exposed-modules: Data.FileEmbed
2020 ghc-options: -Wall