Skip to content

Commit dcb63cd

Browse files
authored
Merge pull request #52 from mpilgrem/haddocks
Extend Haddock documentation warning
2 parents 77a356f + 9e99f4c commit dcb63cd

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Data/FileEmbed.hs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ embedFileRelative = embedFile <=< makeRelativeToProject
9999

100100
-- | Maybe embed a single file in your source code depending on whether or not file exists.
101101
--
102-
-- Warning: When a build is compiled with the file missing, a recompile when the file exists might not trigger an embed of the file.
103-
-- You might try to fix this by doing a clean build.
102+
-- Warning: When a build is compiled with the file missing, a recompile when the
103+
-- file exists might not trigger an embed of the file. You might try to fix this
104+
-- by doing a clean build or using GHC's -fforce-recomp flag.
104105
--
105106
-- > import qualified Data.ByteString
106107
-- >
@@ -120,13 +121,18 @@ embedFileIfExists fp = do
120121
[| Just $(bsToExp bs) |]
121122
where
122123
maybeFile :: IO (Maybe B.ByteString)
123-
maybeFile =
124-
either (const Nothing) Just <$>
124+
maybeFile =
125+
either (const Nothing) Just <$>
125126
tryJust (guard . isDoesNotExistError) (B.readFile fp)
126127

127128
-- | Embed a single existing file in your source code
128129
-- out of list a list of paths supplied.
129130
--
131+
-- Warning: When a build is compiled with initial file(s) in the list missing, a
132+
-- recompile when one of those files exists might not trigger an embed of the
133+
-- first such file. You might try to fix this by doing a clean build or using
134+
-- GHC's -fforce-recomp flag.
135+
--
130136
-- > import qualified Data.ByteString
131137
-- >
132138
-- > myFile :: Data.ByteString.ByteString
@@ -148,6 +154,11 @@ embedOneFileOf ps =
148154

149155
-- | Embed a directory recursively in your source code.
150156
--
157+
-- Warning: When a build is compiled with a file missing from the directory, a
158+
-- recompile when that file is added might not trigger an embed of the file. You
159+
-- might try to fix this by doing a clean build or using GHC's -fforce-recomp
160+
-- flag.
161+
--
151162
-- > import qualified Data.ByteString
152163
-- >
153164
-- > myDir :: [(FilePath, Data.ByteString.ByteString)]
@@ -231,6 +242,11 @@ embedStringFile fp =
231242
-- | Embed a single existing string file in your source code
232243
-- out of list a list of paths supplied.
233244
--
245+
-- Warning: When a build is compiled with initial file(s) in the list missing, a
246+
-- recompile when one of those files exists might not trigger an embed of the
247+
-- first such file. You might try to fix this by doing a clean build or using
248+
-- GHC's -fforce-recomp flag.
249+
--
234250
-- Since 0.0.9
235251
embedOneStringFileOf :: [FilePath] -> Q Exp
236252
embedOneStringFileOf ps =

0 commit comments

Comments
 (0)