git.iko.soy/typeable/file-embed
on master help sign in
Cleanup
a0f623eMichael Snoyman
Data/FileEmbed.hs+5−3
@@ -14,8 +14,7 @@ module Data.FileEmbed
14 ) where
14 ) where
15
15
16import Language.Haskell.TH.Syntax
16import Language.Haskell.TH.Syntax
17− ( runQ
18− , Exp (AppE, ListE, LitE, TupE)
17+ ( Exp (AppE, ListE, LitE, TupE)
19#if MIN_VERSION_template_haskell(2,5,0)
18#if MIN_VERSION_template_haskell(2,5,0)
20 , Lit (StringL, StringPrimL, IntegerL)
19 , Lit (StringL, StringPrimL, IntegerL)
21#else
20#else
@@ -105,7 +104,10 @@ fileList' realTop top = do
105liftPair2 :: Monad m => (a, m b) -> m (a, b)
104liftPair2 :: Monad m => (a, m b) -> m (a, b)
106liftPair2 (a, b) = b >>= \b' -> return (a, b')
105liftPair2 (a, b) = b >>= \b' -> return (a, b')
107
106
107+magic :: String
108magic = concat ["fe", "MS"]
108magic = concat ["fe", "MS"]
109+
110+sizeLen :: Int
109sizeLen = 20
111sizeLen = 20
110
112
111getInner :: B.ByteString -> B.ByteString
113getInner :: B.ByteString -> B.ByteString
@@ -151,7 +153,7 @@ inject toInj orig =
151 size = case reads $ B8.unpack sizeBS of
153 size = case reads $ B8.unpack sizeBS of
152 (i, _):_ -> i
154 (i, _):_ -> i
153 [] -> error $ "Data.FileEmbed (inject): Your dummy space has been corrupted. Size is: " ++ show sizeBS
155 [] -> error $ "Data.FileEmbed (inject): Your dummy space has been corrupted. Size is: " ++ show sizeBS
154− (dummy, after) = B.splitAt size rest'
156+ (_dummy, after) = B.splitAt size rest'
155
157
156injectFile :: B.ByteString
158injectFile :: B.ByteString
157 -> FilePath -- ^ template file
159 -> FilePath -- ^ template file