summaryrefslogtreecommitdiff
path: root/standalone/no-th/haskell-patches/file-embed_remove-TH.patch
diff options
context:
space:
mode:
Diffstat (limited to 'standalone/no-th/haskell-patches/file-embed_remove-TH.patch')
-rw-r--r--standalone/no-th/haskell-patches/file-embed_remove-TH.patch43
1 files changed, 31 insertions, 12 deletions
diff --git a/standalone/no-th/haskell-patches/file-embed_remove-TH.patch b/standalone/no-th/haskell-patches/file-embed_remove-TH.patch
index e637465e1..a089f1f9e 100644
--- a/standalone/no-th/haskell-patches/file-embed_remove-TH.patch
+++ b/standalone/no-th/haskell-patches/file-embed_remove-TH.patch
@@ -1,17 +1,17 @@
-From cd49a96991dc3dd8867038fa9d426a8ccdb25f8d Mon Sep 17 00:00:00 2001
-From: Joey Hess <joey@kitenet.net>
-Date: Tue, 17 Dec 2013 18:40:48 +0000
+From 2b41af230ea5675592e87a2362d9c17bcd8df1db Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Tue, 10 Jun 2014 19:00:44 +0000
Subject: [PATCH] remove TH
---
- Data/FileEmbed.hs | 87 ++++---------------------------------------------------
- 1 file changed, 5 insertions(+), 82 deletions(-)
+ Data/FileEmbed.hs | 100 +++---------------------------------------------------
+ 1 file changed, 5 insertions(+), 95 deletions(-)
diff --git a/Data/FileEmbed.hs b/Data/FileEmbed.hs
-index 5617493..ad92cdc 100644
+index aae9d5a..efdbb7b 100644
--- a/Data/FileEmbed.hs
+++ b/Data/FileEmbed.hs
-@@ -17,13 +17,13 @@
+@@ -17,19 +17,18 @@
-- > {-# LANGUAGE TemplateHaskell #-}
module Data.FileEmbed
( -- * Embed at compile time
@@ -30,7 +30,13 @@ index 5617493..ad92cdc 100644
#endif
, inject
, injectFile
-@@ -56,72 +56,11 @@ import Data.ByteString.Unsafe (unsafePackAddressLen)
+ -- * Internal
+ , stringToBs
+- , bsToExp
+ ) where
+
+ import Language.Haskell.TH.Syntax
+@@ -57,85 +56,12 @@ import Data.ByteString.Unsafe (unsafePackAddressLen)
import System.IO.Unsafe (unsafePerformIO)
import System.FilePath ((</>))
@@ -81,7 +87,7 @@ index 5617493..ad92cdc 100644
- e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp))
- 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'
getDir :: FilePath -> IO [(FilePath, B.ByteString)]
@@ -96,14 +102,27 @@ index 5617493..ad92cdc 100644
- return $! TupE [LitE $ StringL path, exp']
-
-bsToExp :: B.ByteString -> Q Exp
+-#if MIN_VERSION_template_haskell(2, 5, 0)
+-bsToExp bs =
+- return $ VarE 'unsafePerformIO
+- `AppE` (VarE 'unsafePackAddressLen
+- `AppE` LitE (IntegerL $ fromIntegral $ B8.length bs)
+-#if MIN_VERSION_template_haskell(2, 8, 0)
+- `AppE` LitE (StringPrimL $ B.unpack bs))
+-#else
+- `AppE` LitE (StringPrimL $ B8.unpack bs))
+-#endif
+-#else
-bsToExp bs = do
- helper <- [| stringToBs |]
- let chars = B8.unpack bs
- return $! AppE helper $! LitE $! StringL chars
-
+-#endif
+-
stringToBs :: String -> B.ByteString
stringToBs = B8.pack
-@@ -164,22 +103,6 @@ padSize i =
+
+@@ -177,22 +103,6 @@ padSize i =
let s = show i
in replicate (sizeLen - length s) '0' ++ s
@@ -127,5 +146,5 @@ index 5617493..ad92cdc 100644
inject :: B.ByteString -- ^ bs to inject
-> B.ByteString -- ^ original BS containing dummy
--
-1.8.5.1
+2.0.0