summaryrefslogtreecommitdiff
path: root/standalone/android/haskell-patches/shakespeare-js_1.1.2_0001-remove-TH.patch
blob: 98a16ae079c0c8802259a18b8a3c8f3bdfd5a4de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
From 332c71b3f6bc4786b914e675020a23c492beee5a Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Tue, 7 May 2013 19:28:06 -0400
Subject: [PATCH] remove TH

---
 Text/Coffee.hs     |   54 -------------------------------------------------
 Text/Julius.hs     |   56 ++++-----------------------------------------------
 Text/Roy.hs        |   54 -------------------------------------------------
 Text/TypeScript.hs |   57 +---------------------------------------------------
 4 files changed, 5 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..1a0376f 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,9 +28,11 @@ module Text.Julius
     , renderJavascriptUrl
 
       -- ** internal, used by 'Text.Coffee'
-    , javascriptSettings
       -- ** internal
     , juliusUsedIdentifiers
+
+      -- used by TH splices
+    , asJavascriptUrl
     ) where
 
 import Language.Haskell.TH.Quote (QuasiQuoter (..))
@@ -101,47 +94,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