add patches porting necessary Haskell libraries to Android
This goes all the way up to Yesod, but everything above Wai is a real hack job, removing TH left and right.
This commit is contained in:
parent
1943bb31ab
commit
1bc5734037
31 changed files with 6311 additions and 0 deletions
|
@ -0,0 +1,303 @@
|
|||
From f3e31696cfb45a528e4b4b6f016dc7101d7cd4fb Mon Sep 17 00:00:00 2001
|
||||
From: Joey Hess <joey@kitenet.net>
|
||||
Date: Thu, 28 Feb 2013 23:36:06 -0400
|
||||
Subject: [PATCH] remove TH
|
||||
|
||||
---
|
||||
Text/Coffee.hs | 54 -------------------------------------------------
|
||||
Text/Julius.hs | 53 +-----------------------------------------------
|
||||
Text/Roy.hs | 54 -------------------------------------------------
|
||||
Text/TypeScript.hs | 57 +---------------------------------------------------
|
||||
4 files changed, 2 insertions(+), 216 deletions(-)
|
||||
|
||||
diff --git a/Text/Coffee.hs b/Text/Coffee.hs
|
||||
index 2481936..3f7f9c3 100644
|
||||
--- a/Text/Coffee.hs
|
||||
+++ b/Text/Coffee.hs
|
||||
@@ -51,14 +51,6 @@ module Text.Coffee
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- coffee
|
||||
- , coffeeFile
|
||||
- , coffeeFileReload
|
||||
- , coffeeFileDebug
|
||||
-
|
||||
-#ifdef TEST_EXPORT
|
||||
- , coffeeSettings
|
||||
-#endif
|
||||
) where
|
||||
|
||||
import Language.Haskell.TH.Quote (QuasiQuoter (..))
|
||||
@@ -66,49 +58,3 @@ import Language.Haskell.TH.Syntax
|
||||
import Text.Shakespeare
|
||||
import Text.Julius
|
||||
|
||||
-coffeeSettings :: Q ShakespeareSettings
|
||||
-coffeeSettings = do
|
||||
- jsettings <- javascriptSettings
|
||||
- return $ jsettings { varChar = '%'
|
||||
- , preConversion = Just PreConvert {
|
||||
- preConvert = ReadProcess "coffee" ["-spb"]
|
||||
- , preEscapeIgnoreBalanced = "'\"`" -- don't insert backtacks for variable already inside strings or backticks.
|
||||
- , preEscapeIgnoreLine = "#" -- ignore commented lines
|
||||
- , wrapInsertion = Just WrapInsertion {
|
||||
- wrapInsertionIndent = Just " "
|
||||
- , wrapInsertionStartBegin = "(("
|
||||
- , wrapInsertionSeparator = ", "
|
||||
- , wrapInsertionStartClose = ") =>"
|
||||
- , wrapInsertionEnd = ")"
|
||||
- , wrapInsertionApplyBegin = "("
|
||||
- , wrapInsertionApplyClose = ")\n"
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
--- | Read inline, quasiquoted CoffeeScript.
|
||||
-coffee :: QuasiQuoter
|
||||
-coffee = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- coffeeSettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
--- | Read in a CoffeeScript template file. This function reads the file once, at
|
||||
--- compile time.
|
||||
-coffeeFile :: FilePath -> Q Exp
|
||||
-coffeeFile fp = do
|
||||
- rs <- coffeeSettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
--- | Read in a CoffeeScript template file. This impure function uses
|
||||
--- unsafePerformIO to re-read the file on every call, allowing for rapid
|
||||
--- iteration.
|
||||
-coffeeFileReload :: FilePath -> Q Exp
|
||||
-coffeeFileReload fp = do
|
||||
- rs <- coffeeSettings
|
||||
- shakespeareFileReload rs fp
|
||||
-
|
||||
--- | Deprecated synonym for 'coffeeFileReload'
|
||||
-coffeeFileDebug :: FilePath -> Q Exp
|
||||
-coffeeFileDebug = coffeeFileReload
|
||||
-{-# DEPRECATED coffeeFileDebug "Please use coffeeFileReload instead." #-}
|
||||
diff --git a/Text/Julius.hs b/Text/Julius.hs
|
||||
index 230eac3..b990f73 100644
|
||||
--- a/Text/Julius.hs
|
||||
+++ b/Text/Julius.hs
|
||||
@@ -14,17 +14,8 @@ module Text.Julius
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- js
|
||||
- , julius
|
||||
- , juliusFile
|
||||
- , jsFile
|
||||
- , juliusFileDebug
|
||||
- , jsFileDebug
|
||||
- , juliusFileReload
|
||||
- , jsFileReload
|
||||
-
|
||||
-- * Datatypes
|
||||
- , JavascriptUrl
|
||||
+ JavascriptUrl
|
||||
, Javascript (..)
|
||||
, RawJavascript (..)
|
||||
|
||||
@@ -37,7 +28,6 @@ module Text.Julius
|
||||
, renderJavascriptUrl
|
||||
|
||||
-- ** internal, used by 'Text.Coffee'
|
||||
- , javascriptSettings
|
||||
-- ** internal
|
||||
, juliusUsedIdentifiers
|
||||
) where
|
||||
@@ -101,47 +91,6 @@ instance RawJS TL.Text where rawJS = RawJavascript . fromLazyText
|
||||
instance RawJS Builder where rawJS = RawJavascript
|
||||
instance RawJS Bool where rawJS = RawJavascript . toJavascript
|
||||
|
||||
-javascriptSettings :: Q ShakespeareSettings
|
||||
-javascriptSettings = do
|
||||
- toJExp <- [|toJavascript|]
|
||||
- wrapExp <- [|Javascript|]
|
||||
- unWrapExp <- [|unJavascript|]
|
||||
- asJavascriptUrl' <- [|asJavascriptUrl|]
|
||||
- return $ defaultShakespeareSettings { toBuilder = toJExp
|
||||
- , wrap = wrapExp
|
||||
- , unwrap = unWrapExp
|
||||
- , modifyFinalValue = Just asJavascriptUrl'
|
||||
- }
|
||||
-
|
||||
-js, julius :: QuasiQuoter
|
||||
-js = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- javascriptSettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
-julius = js
|
||||
-
|
||||
-jsFile, juliusFile :: FilePath -> Q Exp
|
||||
-jsFile fp = do
|
||||
- rs <- javascriptSettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
-juliusFile = jsFile
|
||||
-
|
||||
-
|
||||
-jsFileReload, juliusFileReload :: FilePath -> Q Exp
|
||||
-jsFileReload fp = do
|
||||
- rs <- javascriptSettings
|
||||
- shakespeareFileReload rs fp
|
||||
-
|
||||
-juliusFileReload = jsFileReload
|
||||
-
|
||||
-jsFileDebug, juliusFileDebug :: FilePath -> Q Exp
|
||||
-juliusFileDebug = jsFileReload
|
||||
-{-# DEPRECATED juliusFileDebug "Please use juliusFileReload instead." #-}
|
||||
-jsFileDebug = jsFileReload
|
||||
-{-# DEPRECATED jsFileDebug "Please use jsFileReload instead." #-}
|
||||
-
|
||||
-- | Determine which identifiers are used by the given template, useful for
|
||||
-- creating systems like yesod devel.
|
||||
juliusUsedIdentifiers :: String -> [(Deref, VarType)]
|
||||
diff --git a/Text/Roy.hs b/Text/Roy.hs
|
||||
index cf09cec..870c9f6 100644
|
||||
--- a/Text/Roy.hs
|
||||
+++ b/Text/Roy.hs
|
||||
@@ -23,13 +23,6 @@ module Text.Roy
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- roy
|
||||
- , royFile
|
||||
- , royFileReload
|
||||
-
|
||||
-#ifdef TEST_EXPORT
|
||||
- , roySettings
|
||||
-#endif
|
||||
) where
|
||||
|
||||
import Language.Haskell.TH.Quote (QuasiQuoter (..))
|
||||
@@ -37,50 +30,3 @@ import Language.Haskell.TH.Syntax
|
||||
import Text.Shakespeare
|
||||
import Text.Julius
|
||||
|
||||
--- | The Roy language compiles down to Javascript.
|
||||
--- We do this compilation once at compile time to avoid needing to do it during the request.
|
||||
--- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request instead rather than a system call.
|
||||
-roySettings :: Q ShakespeareSettings
|
||||
-roySettings = do
|
||||
- jsettings <- javascriptSettings
|
||||
- return $ jsettings { varChar = '#'
|
||||
- , preConversion = Just PreConvert {
|
||||
- preConvert = ReadProcess "roy" ["--stdio"]
|
||||
- , preEscapeIgnoreBalanced = "'\""
|
||||
- , preEscapeIgnoreLine = "//"
|
||||
- , wrapInsertion = Nothing
|
||||
- {-
|
||||
- Just WrapInsertion {
|
||||
- wrapInsertionIndent = Just " "
|
||||
- , wrapInsertionStartBegin = "(\\"
|
||||
- , wrapInsertionSeparator = " "
|
||||
- , wrapInsertionStartClose = " ->\n"
|
||||
- , wrapInsertionEnd = ")"
|
||||
- , wrapInsertionApplyBegin = " "
|
||||
- , wrapInsertionApplyClose = ")\n"
|
||||
- }
|
||||
- -}
|
||||
- }
|
||||
- }
|
||||
-
|
||||
--- | Read inline, quasiquoted Roy.
|
||||
-roy :: QuasiQuoter
|
||||
-roy = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- roySettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
--- | Read in a Roy template file. This function reads the file once, at
|
||||
--- compile time.
|
||||
-royFile :: FilePath -> Q Exp
|
||||
-royFile fp = do
|
||||
- rs <- roySettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
--- | Read in a Roy template file. This impure function uses
|
||||
--- unsafePerformIO to re-read the file on every call, allowing for rapid
|
||||
--- iteration.
|
||||
-royFileReload :: FilePath -> Q Exp
|
||||
-royFileReload fp = do
|
||||
- rs <- roySettings
|
||||
- shakespeareFileReload rs fp
|
||||
diff --git a/Text/TypeScript.hs b/Text/TypeScript.hs
|
||||
index 34bf4bf..30c5388 100644
|
||||
--- a/Text/TypeScript.hs
|
||||
+++ b/Text/TypeScript.hs
|
||||
@@ -53,65 +53,10 @@
|
||||
--
|
||||
-- 2. TypeScript: <http://typescript.codeplex.com/>
|
||||
module Text.TypeScript
|
||||
- ( -- * Functions
|
||||
- -- ** Template-Reading Functions
|
||||
- -- | These QuasiQuoter and Template Haskell methods return values of
|
||||
- -- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- tsc
|
||||
- , typeScriptFile
|
||||
- , typeScriptFileReload
|
||||
-
|
||||
-#ifdef TEST_EXPORT
|
||||
- , typeScriptSettings
|
||||
-#endif
|
||||
+ (
|
||||
) where
|
||||
|
||||
import Language.Haskell.TH.Quote (QuasiQuoter (..))
|
||||
import Language.Haskell.TH.Syntax
|
||||
import Text.Shakespeare
|
||||
import Text.Julius
|
||||
-
|
||||
--- | The TypeScript language compiles down to Javascript.
|
||||
--- We do this compilation once at compile time to avoid needing to do it during the request.
|
||||
--- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request instead rather than a system call.
|
||||
-typeScriptSettings :: Q ShakespeareSettings
|
||||
-typeScriptSettings = do
|
||||
- jsettings <- javascriptSettings
|
||||
- return $ jsettings { varChar = '#'
|
||||
- , preConversion = Just PreConvert {
|
||||
- preConvert = ReadProcess "sh" ["-c", "TMP_IN=$(mktemp XXXXXXXXXX.ts); TMP_OUT=$(mktemp XXXXXXXXXX.js); cat /dev/stdin > ${TMP_IN} && tsc --out ${TMP_OUT} ${TMP_IN} && cat ${TMP_OUT}; rm ${TMP_IN} && rm ${TMP_OUT}"]
|
||||
- , preEscapeIgnoreBalanced = "'\""
|
||||
- , preEscapeIgnoreLine = "//"
|
||||
- , wrapInsertion = Just WrapInsertion {
|
||||
- wrapInsertionIndent = Nothing
|
||||
- , wrapInsertionStartBegin = ";(function("
|
||||
- , wrapInsertionSeparator = ", "
|
||||
- , wrapInsertionStartClose = "){"
|
||||
- , wrapInsertionEnd = "})"
|
||||
- , wrapInsertionApplyBegin = "("
|
||||
- , wrapInsertionApplyClose = ");\n"
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
--- | Read inline, quasiquoted TypeScript
|
||||
-tsc :: QuasiQuoter
|
||||
-tsc = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- typeScriptSettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
--- | Read in a Roy template file. This function reads the file once, at
|
||||
--- compile time.
|
||||
-typeScriptFile :: FilePath -> Q Exp
|
||||
-typeScriptFile fp = do
|
||||
- rs <- typeScriptSettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
--- | Read in a Roy template file. This impure function uses
|
||||
--- unsafePerformIO to re-read the file on every call, allowing for rapid
|
||||
--- iteration.
|
||||
-typeScriptFileReload :: FilePath -> Q Exp
|
||||
-typeScriptFileReload fp = do
|
||||
- rs <- typeScriptSettings
|
||||
- shakespeareFileReload rs fp
|
||||
--
|
||||
1.7.10.4
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue