From 256ff157005f44c97fa5affe2ed9655815b3788e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 15 Apr 2013 12:38:22 -0400 Subject: [PATCH] remove TH and export one symbol used by TH --- Data/.FileEmbed.hs.swp | Bin 16384 -> 0 bytes Data/FileEmbed.hs | 80 +++---------------------------------------------- 2 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 Data/.FileEmbed.hs.swp diff --git a/Data/.FileEmbed.hs.swp b/Data/.FileEmbed.hs.swp deleted file mode 100644 index 1b2ddbfaa71697e9df3869555aee8c97ca7ea0cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHNZEPGz8J?z;l0w=5RfRyn>$8>HBX?)xk`I~qq+D`I3}?sToJzq>+`YRw-^O>l z*WKCLCgwvzNFb1);!ir*%6;!D~AU?_ukSIa|0TNP$5Jm93GrM~q zjuRvP0NRxw-|fsh@60^&&O0;jTz%?+xp_KLykFqiFT`)B+;d-jZzZDh-@^(gRkt_UayqggyLH(tOcke!Zz&#`JZUR?@)Xi5oLp=NyHc47r3|DD z?1q6*wF*b~iTkJDJT;yfqgTJ`{BBC6GARQo11SS311SS311SS311SS31OG=1sNNp& zPxNOGa0R$6!tMCX1MiLA@sU0$11SS311SS311SS311SS311SS311SS311SUlqYT(h zA*RvxX$}D3{-0w2zq&_=9|B(oJ`TJeP{1ls23`y71@-_h+%3fOz|Vo70p9>V3^ahF zz%+0#un)Kc_}e}qegu3C_%d)6aDW-$b-)X+5aMazbHMw6w*zCq9^f|M$M{{sb>Io$ zDsTmu2a3QOfxq4*#4mxL0AB%~0z$wCs=#SrKk&!BLOct68+a6001g9(fV+S@fnUE& zh$n$h0-pdb0VUu*;P-b5@f+Y7;Bnwnz!hK(r~;F~i!T-8@4!!iYruDb&jKF=LO=l} z;0?g*f#>cJ;yXYO7zh6R5+S|?d;oYSa0ECE>;;}ffaVv#4}hnDCxOR-j{zSATEGS1 zUf>TH+wTKwz-8bZPyu+%$AEi)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q><;e%HA*@I!Ehm>Bnt#+{>VxS=BY= zF&#KzxYPQmQR9=wZiq~pO$3+rCXmD$p;&ojyI7Us(3D+IYBZJ+RUdm_{YsR08vSk= zg^`cMe#7hbcnT}0D@E69hWM^0nzj=5q~c0poT|qcPM<%1x z(gJ+`e*))O7w26*|L5^>9q0OIfiD6d0UiM^0B;5E1O9|_{L{cS;4xqcI0Wnm{(>|7 zmw?Xzp9a=}67W3E?$?2D0$%_Kcn$C(&g|EKEnpEi415pg^Q*w;fe!&Iz!6{^xE=T% z+WHLe7{KlB0_l@7kTQ@mkTQ@mkTQ@m@ZZS*MbFzpgaMiW!X4$}y6-5-8#zuowaEXY zO(D^Or`kBev0xM}pL2t-)p8mRLO6q=aT5mD!ELj%WS92}IBf8pMleGe4v*>U5U#dd z8>({f!okrwx^0Nk@8+Ii=#C-#?_Dw^w;EPm;t(zeFDmK?6|dF8x(Pv&6-7o7z1H^= zp6{&cwkmJVyo6NW|1E4~>r)#MRJ zMs2LC=hGcn)&p|kwa&PDJQgEt$EO3jZUuIaqSKi^9_lz z9hWDvK4Heq9If<{sAr2sLAk_D| z`qc+J6D-CzXMwU2H^e;Cr|*ba{SoCH#C(s9#asr$L#)) --- | Embed a single file in your source code. --- --- > import qualified Data.ByteString --- > --- > myFile :: Data.ByteString.ByteString --- > myFile = $(embedFile "dirName/fileName") -embedFile :: FilePath -> Q Exp -embedFile fp = -#if MIN_VERSION_template_haskell(2,7,0) - qAddDependentFile fp >> -#endif - (runIO $ B.readFile fp) >>= bsToExp - --- | Embed a directory recusrively in your source code. --- --- > import qualified Data.ByteString --- > --- > myDir :: [(FilePath, Data.ByteString.ByteString)] --- > myDir = $(embedDir "dirName") -embedDir :: FilePath -> Q Exp -embedDir fp = do - typ <- [t| [(FilePath, B.ByteString)] |] - e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp)) - return $ SigE e typ - -- | Get a directory tree in the IO monad. -- -- This is the workhorse of 'embedDir' getDir :: FilePath -> IO [(FilePath, B.ByteString)] getDir = fileList -pairToExp :: FilePath -> (FilePath, B.ByteString) -> Q Exp -pairToExp _root (path, bs) = do -#if MIN_VERSION_template_haskell(2,7,0) - qAddDependentFile $ _root ++ '/' : path -#endif - exp' <- bsToExp bs - return $! TupE [LitE $ StringL path, exp'] - -bsToExp :: B.ByteString -> Q Exp -bsToExp bs = do - helper <- [| stringToBs |] - let chars = B8.unpack bs - return $! AppE helper $! LitE $! StringL chars - stringToBs :: String -> B.ByteString stringToBs = B8.pack @@ -123,23 +68,6 @@ padSize i = let s = show i in replicate (sizeLen - length s) '0' ++ s -#if MIN_VERSION_template_haskell(2,5,0) -dummySpace :: Int -> Q Exp -dummySpace space = do - let size = padSize space - let start = magic ++ size - let chars = LitE $ StringPrimL $ -#if MIN_VERSION_template_haskell(2,6,0) - map (toEnum . fromEnum) $ -#endif - start ++ replicate space '0' - let len = LitE $ IntegerL $ fromIntegral $ length start + space - upi <- [|unsafePerformIO|] - pack <- [|unsafePackAddressLen|] - getInner' <- [|getInner|] - return $ getInner' `AppE` (upi `AppE` (pack `AppE` len `AppE` chars)) -#endif - inject :: B.ByteString -- ^ bs to inject -> B.ByteString -- ^ original BS containing dummy -> Maybe B.ByteString -- ^ new BS, or Nothing if there is insufficient dummy space -- 1.8.2.rc3