mirror of
https://github.com/typeable/file-embed.git
synced 2024-09-11 07:45:30 +03:00
commit
257de69493
@ -1,3 +1,7 @@
|
|||||||
|
## 0.0.11
|
||||||
|
|
||||||
|
* embedDirListing [#26](https://github.com/snoyberg/file-embed/pull/26)
|
||||||
|
|
||||||
## 0.0.10.1
|
## 0.0.10.1
|
||||||
|
|
||||||
* Minor doc improvements
|
* Minor doc improvements
|
||||||
|
@ -21,6 +21,7 @@ module Data.FileEmbed
|
|||||||
embedFile
|
embedFile
|
||||||
, embedOneFileOf
|
, embedOneFileOf
|
||||||
, embedDir
|
, embedDir
|
||||||
|
, embedDirListing
|
||||||
, getDir
|
, getDir
|
||||||
-- * Embed as a IsString
|
-- * Embed as a IsString
|
||||||
, embedStringFile
|
, embedStringFile
|
||||||
@ -118,6 +119,18 @@ embedDir fp = do
|
|||||||
e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp))
|
e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp))
|
||||||
return $ SigE e typ
|
return $ SigE e typ
|
||||||
|
|
||||||
|
-- | Embed a directory listing recursively in your source code.
|
||||||
|
--
|
||||||
|
-- > myFiles :: [FilePath]
|
||||||
|
-- > myFiles = $(embedDirListing "dirName")
|
||||||
|
--
|
||||||
|
-- @since 0.0.11
|
||||||
|
embedDirListing :: FilePath -> Q Exp
|
||||||
|
embedDirListing fp = do
|
||||||
|
typ <- [t| [FilePath] |]
|
||||||
|
e <- ListE <$> ((runIO $ fmap fst <$> fileList fp) >>= mapM strToExp)
|
||||||
|
return $ SigE e typ
|
||||||
|
|
||||||
-- | Get a directory tree in the IO monad.
|
-- | Get a directory tree in the IO monad.
|
||||||
--
|
--
|
||||||
-- This is the workhorse of 'embedDir'
|
-- This is the workhorse of 'embedDir'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: file-embed
|
name: file-embed
|
||||||
version: 0.0.10.1
|
version: 0.0.11
|
||||||
license: BSD3
|
license: BSD3
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
Loading…
Reference in New Issue
Block a user