Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
reflex-frp
GitHub Repository: reflex-frp/reflex-platform
Path: blob/develop/haskell-overlays/ghcjs-text-jsstring-8.6/ghcjs-base-text-jsstring.patch
1 views
1
diff --git a/Data/JSString.hs b/Data/JSString.hs
2
index 176aad4..9ca6693 100644
3
--- a/Data/JSString.hs
4
+++ b/Data/JSString.hs
5
@@ -99,6 +99,7 @@ module Data.JSString ( JSString
6
, breakOnEnd
7
, break
8
, span
9
+ , span_
10
, group
11
, group'
12
, groupBy
13
@@ -1231,19 +1232,23 @@ splitAt (I# n) x = case js_splitAt n x of (# y, z #) -> (y, z)
14
-- of @t@ of elements that satisfy @p@, and whose second is the
15
-- remainder of the list.
16
span :: (Char -> Bool) -> JSString -> (JSString, JSString)
17
-span p x = case js_length x of
18
- 0# -> (empty, empty)
19
- l -> let c0 = js_uncheckedIndex 0# x
20
- in if p (C# (chr# c0)) then loop 0# l else (empty, x)
21
+span p x = let (# a, b #) = span_ p x in (a, b)
22
+{-# INLINE span #-}
23
+
24
+span_ :: (Char -> Bool) -> JSString -> (# JSString, JSString #)
25
+span_ p x = case js_length x of
26
+ 0# -> (# empty, empty #)
27
+ l -> let c0 = js_uncheckedIndex 0# x
28
+ in if p (C# (chr# c0)) then loop 0# l else (# empty, x #)
29
where
30
loop i l
31
- | isTrue# (i >=# l) = (x, empty)
32
+ | isTrue# (i >=# l) = (# x, empty #)
33
| otherwise =
34
let c = js_uncheckedIndex i x
35
in if p (C# (chr# c))
36
then loop (i +# charWidth c) l
37
- else (js_substr 0# i x, js_substr1 i x)
38
-{-# INLINE span #-}
39
+ else (# js_substr 0# i x, js_substr1 i x #)
40
+{-# INLINE span_ #-}
41
42
-- | /O(n)/ 'break' is like 'span', but the prefix returned is
43
-- over elements that fail the predicate @p@.
44
diff --git a/GHCJS/Foreign.hs b/GHCJS/Foreign.hs
45
index 5bbc5c5..b128f24 100644
46
--- a/GHCJS/Foreign.hs
47
+++ b/GHCJS/Foreign.hs
48
@@ -82,7 +82,7 @@ import GHCJS.Marshal
49
import GHCJS.Marshal.Pure
50
-}
51
import Data.String (IsString(..))
52
-import qualified Data.Text as T
53
+-- import qualified Data.Text as T
54
55
56
class ToJSString a where
57
diff --git a/GHCJS/Foreign/Internal.hs b/GHCJS/Foreign/Internal.hs
58
index 5ac81f0..449bfe4 100644
59
--- a/GHCJS/Foreign/Internal.hs
60
+++ b/GHCJS/Foreign/Internal.hs
61
@@ -100,10 +100,10 @@ import Data.Typeable (Typeable)
62
import Data.ByteString (ByteString)
63
import Data.ByteString.Unsafe (unsafePackAddressLen)
64
65
-import qualified Data.Text.Array as A
66
-import qualified Data.Text as T
67
-import qualified Data.Text.Internal as T
68
-import qualified Data.Text.Lazy as TL (Text, toStrict, fromStrict)
69
+-- import qualified Data.Text.Array as A
70
+-- import qualified Data.Text as T
71
+-- import qualified Data.Text.Internal as T
72
+-- import qualified Data.Text.Lazy as TL (Text, toStrict, fromStrict)
73
74
import Unsafe.Coerce
75
76
diff --git a/GHCJS/Marshal.hs b/GHCJS/Marshal.hs
77
index a36aca2..6256a73 100644
78
--- a/GHCJS/Marshal.hs
79
+++ b/GHCJS/Marshal.hs
80
@@ -16,7 +16,7 @@
81
82
module GHCJS.Marshal ( FromJSVal(..)
83
, ToJSVal(..)
84
- , toJSVal_aeson
85
+ -- , toJSVal_aeson
86
, toJSVal_pure
87
) where
88
89
@@ -24,17 +24,17 @@ import Control.Applicative
90
import Control.Monad
91
import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)
92
93
-import qualified Data.Aeson as AE
94
-import Data.Attoparsec.Number (Number(..))
95
+-- import qualified Data.Aeson as AE
96
+-- import Data.Attoparsec.Number (Number(..))
97
import Data.Bits ((.&.))
98
import Data.Char (chr, ord)
99
-import qualified Data.HashMap.Strict as H
100
+-- import qualified Data.HashMap.Strict as H
101
import Data.Int (Int8, Int16, Int32)
102
import qualified Data.JSString as JSS
103
-import qualified Data.JSString.Text as JSS
104
+-- import qualified Data.JSString.Text as JSS
105
import Data.Maybe
106
-import Data.Scientific (Scientific, scientific, fromFloatDigits)
107
-import Data.Text (Text)
108
+-- import Data.Scientific (Scientific, scientific, fromFloatDigits)
109
+-- import Data.Text (Text)
110
import qualified Data.Vector as V
111
import Data.Word (Word8, Word16, Word32, Word)
112
import Data.Primitive.ByteArray
113
@@ -85,11 +85,11 @@ instance FromJSVal JSString where
114
{-# INLINE fromJSValUnchecked #-}
115
fromJSVal = fromJSVal_pure
116
{-# INLINE fromJSVal #-}
117
-instance FromJSVal Text where
118
- fromJSValUnchecked = fromJSValUnchecked_pure
119
- {-# INLINE fromJSValUnchecked #-}
120
- fromJSVal = fromJSVal_pure
121
- {-# INLINE fromJSVal #-}
122
+-- instance FromJSVal Text where
123
+-- fromJSValUnchecked = fromJSValUnchecked_pure
124
+-- {-# INLINE fromJSValUnchecked #-}
125
+-- fromJSVal = fromJSVal_pure
126
+-- {-# INLINE fromJSVal #-}
127
instance FromJSVal Char where
128
fromJSValUnchecked = fromJSValUnchecked_pure
129
{-# INLINE fromJSValUnchecked #-}
130
@@ -154,24 +154,24 @@ instance FromJSVal Double where
131
{-# INLINE fromJSValUnchecked #-}
132
fromJSVal = fromJSVal_pure
133
{-# INLINE fromJSVal #-}
134
-instance FromJSVal AE.Value where
135
- fromJSVal r = case jsonTypeOf r of
136
- JSONNull -> return (Just AE.Null)
137
- JSONInteger -> liftM (AE.Number . flip scientific 0 . (toInteger :: Int -> Integer))
138
- <$> fromJSVal r
139
- JSONFloat -> liftM (AE.Number . (fromFloatDigits :: Double -> Scientific))
140
- <$> fromJSVal r
141
- JSONBool -> liftM AE.Bool <$> fromJSVal r
142
- JSONString -> liftM AE.String <$> fromJSVal r
143
- JSONArray -> liftM (AE.Array . V.fromList) <$> fromJSVal r
144
- JSONObject -> do
145
- props <- OI.listProps (OI.Object r)
146
- runMaybeT $ do
147
- propVals <- forM props $ \p -> do
148
- v <- MaybeT (fromJSVal =<< OI.getProp p (OI.Object r))
149
- return (JSS.textFromJSString p, v)
150
- return (AE.Object (H.fromList propVals))
151
- {-# INLINE fromJSVal #-}
152
+-- instance FromJSVal AE.Value where
153
+-- fromJSVal r = case jsonTypeOf r of
154
+-- JSONNull -> return (Just AE.Null)
155
+-- JSONInteger -> liftM (AE.Number . flip scientific 0 . (toInteger :: Int -> Integer))
156
+-- <$> fromJSVal r
157
+-- JSONFloat -> liftM (AE.Number . (fromFloatDigits :: Double -> Scientific))
158
+-- <$> fromJSVal r
159
+-- JSONBool -> liftM AE.Bool <$> fromJSVal r
160
+-- JSONString -> liftM AE.String <$> fromJSVal r
161
+-- JSONArray -> liftM (AE.Array . V.fromList) <$> fromJSVal r
162
+-- JSONObject -> do
163
+-- props <- OI.listProps (OI.Object r)
164
+-- runMaybeT $ do
165
+-- propVals <- forM props $ \p -> do
166
+-- v <- MaybeT (fromJSVal =<< OI.getProp p (OI.Object r))
167
+-- return (JSS.textFromJSString p, v)
168
+-- return (AE.Object (H.fromList propVals))
169
+-- {-# INLINE fromJSVal #-}
170
instance (FromJSVal a, FromJSVal b) => FromJSVal (a,b) where
171
fromJSVal r = runMaybeT $ (,) <$> jf r 0 <*> jf r 1
172
{-# INLINE fromJSVal #-}
173
@@ -204,15 +204,15 @@ jf r n = MaybeT $ do
174
instance ToJSVal JSVal where
175
toJSVal = toJSVal_pure
176
{-# INLINE toJSVal #-}
177
-instance ToJSVal AE.Value where
178
- toJSVal = toJSVal_aeson
179
- {-# INLINE toJSVal #-}
180
+-- instance ToJSVal AE.Value where
181
+-- toJSVal = toJSVal_aeson
182
+-- {-# INLINE toJSVal #-}
183
instance ToJSVal JSString where
184
toJSVal = toJSVal_pure
185
{-# INLINE toJSVal #-}
186
-instance ToJSVal Text where
187
- toJSVal = toJSVal_pure
188
- {-# INLINE toJSVal #-}
189
+-- instance ToJSVal Text where
190
+-- toJSVal = toJSVal_pure
191
+-- {-# INLINE toJSVal #-}
192
instance ToJSVal Char where
193
toJSVal = return . pToJSVal
194
{-# INLINE toJSVal #-}
195
@@ -285,21 +285,21 @@ foreign import javascript unsafe "[$1,$2,$3,$4,$5]" arr5 :: JSVal -> J
196
foreign import javascript unsafe "[$1,$2,$3,$4,$5,$6]" arr6 :: JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> IO JSVal
197
foreign import javascript unsafe "[$1,$2,$3,$4,$5,$6,$7]" arr7 :: JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> IO JSVal
198
199
-toJSVal_aeson :: AE.ToJSON a => a -> IO JSVal
200
-toJSVal_aeson x = cv (AE.toJSON x)
201
- where
202
- cv = convertValue
203
+-- toJSVal_aeson :: AE.ToJSON a => a -> IO JSVal
204
+-- toJSVal_aeson x = cv (AE.toJSON x)
205
+-- where
206
+-- cv = convertValue
207
208
- convertValue :: AE.Value -> IO JSVal
209
- convertValue AE.Null = return jsNull
210
- convertValue (AE.String t) = return (pToJSVal t)
211
- convertValue (AE.Array a) = (\(AI.SomeJSArray x) -> x) <$>
212
- (AI.fromListIO =<< mapM convertValue (V.toList a))
213
- convertValue (AE.Number n) = toJSVal (realToFrac n :: Double)
214
- convertValue (AE.Bool b) = return (toJSBool b)
215
- convertValue (AE.Object o) = do
216
- obj@(OI.Object obj') <- OI.create
217
- mapM_ (\(k,v) -> convertValue v >>= \v' -> OI.setProp (JSS.textToJSString k) v' obj) (H.toList o)
218
- return obj'
219
+-- convertValue :: AE.Value -> IO JSVal
220
+-- convertValue AE.Null = return jsNull
221
+-- convertValue (AE.String t) = return (pToJSVal t)
222
+-- convertValue (AE.Array a) = (\(AI.SomeJSArray x) -> x) <$>
223
+-- (AI.fromListIO =<< mapM convertValue (V.toList a))
224
+-- convertValue (AE.Number n) = toJSVal (realToFrac n :: Double)
225
+-- convertValue (AE.Bool b) = return (toJSBool b)
226
+-- convertValue (AE.Object o) = do
227
+-- obj@(OI.Object obj') <- OI.create
228
+-- mapM_ (\(k,v) -> convertValue v >>= \v' -> OI.setProp (JSS.textToJSString k) v' obj) (H.toList o)
229
+-- return obj'
230
231
232
diff --git a/GHCJS/Marshal/Pure.hs b/GHCJS/Marshal/Pure.hs
233
index 902fa20..268489d 100644
234
--- a/GHCJS/Marshal/Pure.hs
235
+++ b/GHCJS/Marshal/Pure.hs
236
@@ -28,11 +28,11 @@ import Data.Data
237
import Data.Int (Int8, Int16, Int32)
238
import Data.JSString.Internal.Type
239
import Data.Maybe
240
-import Data.Text (Text)
241
+-- import Data.Text (Text)
242
import Data.Typeable
243
import Data.Word (Word8, Word16, Word32, Word)
244
import Data.JSString
245
-import Data.JSString.Text
246
+-- import Data.JSString.Text
247
import Data.Bits ((.&.))
248
import Unsafe.Coerce (unsafeCoerce)
249
import GHC.Int
250
@@ -65,8 +65,8 @@ instance PFromJSVal JSString where pFromJSVal = JSString
251
{-# INLINE pFromJSVal #-}
252
instance PFromJSVal [Char] where pFromJSVal = Prim.fromJSString
253
{-# INLINE pFromJSVal #-}
254
-instance PFromJSVal Text where pFromJSVal = textFromJSVal
255
- {-# INLINE pFromJSVal #-}
256
+-- instance PFromJSVal Text where pFromJSVal = textFromJSVal
257
+-- {-# INLINE pFromJSVal #-}
258
instance PFromJSVal Char where pFromJSVal x = C# (jsvalToChar x)
259
{-# INLINE pFromJSVal #-}
260
instance PFromJSVal Bool where pFromJSVal = isTruthy
261
@@ -103,8 +103,8 @@ instance PToJSVal JSString where pToJSVal = jsval
262
{-# INLINE pToJSVal #-}
263
instance PToJSVal [Char] where pToJSVal = Prim.toJSString
264
{-# INLINE pToJSVal #-}
265
-instance PToJSVal Text where pToJSVal = jsval . textToJSString
266
- {-# INLINE pToJSVal #-}
267
+-- instance PToJSVal Text where pToJSVal = jsval . textToJSString
268
+-- {-# INLINE pToJSVal #-}
269
instance PToJSVal Char where pToJSVal (C# c) = charToJSVal c
270
{-# INLINE pToJSVal #-}
271
instance PToJSVal Bool where pToJSVal True = jsTrue
272
diff --git a/JavaScript/JSON/Types/Instances.hs b/JavaScript/JSON/Types/Instances.hs
273
index 2b288ec..6d7074c 100644
274
--- a/JavaScript/JSON/Types/Instances.hs
275
+++ b/JavaScript/JSON/Types/Instances.hs
276
@@ -57,7 +57,7 @@ import Control.Applicative ((<$>), (<*>), (<|>), pure, empty)
277
278
import Data.JSString (JSString)
279
import qualified Data.JSString as JSS
280
-import qualified Data.JSString.Text as JSS
281
+-- import qualified Data.JSString.Text as JSS
282
283
import JavaScript.Array (JSArray)
284
import qualified JavaScript.Array as JSA
285
@@ -335,21 +335,21 @@ instance FromJSON JSString where
286
parseJSON = withJSString "JSString" pure
287
{-# INLINE parseJSON #-}
288
289
-instance ToJSON Text where
290
- toJSON = stringValue . JSS.textToJSString
291
- {-# INLINE toJSON #-}
292
+-- instance ToJSON Text where
293
+-- toJSON = stringValue . JSS.textToJSString
294
+-- {-# INLINE toJSON #-}
295
296
-instance FromJSON Text where
297
- parseJSON = withJSString "Text" ( pure . JSS.textFromJSString )
298
- {-# INLINE parseJSON #-}
299
+-- instance FromJSON Text where
300
+-- parseJSON = withJSString "Text" ( pure . JSS.textFromJSString )
301
+-- {-# INLINE parseJSON #-}
302
303
-instance ToJSON LT.Text where
304
- toJSON = stringValue . JSS.textToJSString . LT.toStrict
305
- {-# INLINE toJSON #-}
306
+-- instance ToJSON LT.Text where
307
+-- toJSON = stringValue . JSS.textToJSString . LT.toStrict
308
+-- {-# INLINE toJSON #-}
309
310
-instance FromJSON LT.Text where
311
- parseJSON = withJSString "Lazy Text" $ pure . LT.fromStrict . JSS.textFromJSString
312
- {-# INLINE parseJSON #-}
313
+-- instance FromJSON LT.Text where
314
+-- parseJSON = withJSString "Lazy Text" $ pure . LT.fromStrict . JSS.textFromJSString
315
+-- {-# INLINE parseJSON #-}
316
317
instance (ToJSON a) => ToJSON [a] where
318
toJSON = arrayValue . arrayValueList . map toJSON
319
diff --git a/JavaScript/Web/Canvas.hs b/JavaScript/Web/Canvas.hs
320
index 0a7684c..74490c2 100644
321
--- a/JavaScript/Web/Canvas.hs
322
+++ b/JavaScript/Web/Canvas.hs
323
@@ -69,7 +69,7 @@ import Control.Monad
324
325
import Data.Data
326
import Data.Maybe (fromJust)
327
-import Data.Text (Text)
328
+-- import Data.Text (Text)
329
import Data.Typeable
330
331
import GHCJS.Foreign
332
diff --git a/ghcjs-base.cabal b/ghcjs-base.cabal
333
index 4a64694..acf8806 100644
334
--- a/ghcjs-base.cabal
335
+++ b/ghcjs-base.cabal
336
@@ -55,7 +55,7 @@ library
337
Data.JSString.RealFloat
338
Data.JSString.RegExp
339
Data.JSString.Internal
340
- Data.JSString.Text
341
+ -- Data.JSString.Text
342
Data.JSString.Internal.Fusion
343
Data.JSString.Internal.Fusion.Types
344
Data.JSString.Internal.Fusion.Common
345
@@ -78,12 +78,12 @@ library
346
JavaScript.Array.Internal
347
JavaScript.Array.ST
348
JavaScript.Cast
349
- JavaScript.JSON
350
- JavaScript.JSON.Types
351
- JavaScript.JSON.Types.Class
352
- JavaScript.JSON.Types.Generic
353
- JavaScript.JSON.Types.Instances
354
- JavaScript.JSON.Types.Internal
355
+ -- JavaScript.JSON
356
+ -- JavaScript.JSON.Types
357
+ -- JavaScript.JSON.Types.Class
358
+ -- JavaScript.JSON.Types.Generic
359
+ -- JavaScript.JSON.Types.Instances
360
+ -- JavaScript.JSON.Types.Internal
361
JavaScript.Number
362
JavaScript.Object
363
JavaScript.Object.Internal
364
@@ -115,11 +115,11 @@ library
365
JavaScript.Web.Storage
366
JavaScript.Web.Storage.Internal
367
JavaScript.Web.StorageEvent
368
- JavaScript.Web.XMLHttpRequest
369
+ -- JavaScript.Web.XMLHttpRequest
370
JavaScript.Web.WebSocket
371
JavaScript.Web.Worker
372
- other-modules: GHCJS.Internal.Types
373
Data.JSString.Internal.Type
374
+ other-modules: GHCJS.Internal.Types
375
JavaScript.TypedArray.Internal.Types
376
JavaScript.TypedArray.ArrayBuffer.Internal
377
JavaScript.TypedArray.DataView.Internal
378
@@ -144,15 +144,15 @@ library
379
integer-gmp,
380
binary >= 0.8 && < 0.11,
381
bytestring >= 0.10 && < 0.11,
382
- text >= 1.1 && < 1.3,
383
- aeson >= 0.8 && < 1.6,
384
- scientific >= 0.3 && < 0.4,
385
+ -- text >= 1.1 && < 1.3,
386
+ -- aeson >= 0.8 && < 1.6,
387
+ -- scientific >= 0.3 && < 0.4,
388
vector >= 0.10 && < 0.13,
389
containers >= 0.5 && < 0.7,
390
time >= 1.5 && < 1.10,
391
- hashable >= 1.2 && < 1.4,
392
- unordered-containers >= 0.2 && < 0.3,
393
- attoparsec >= 0.11 && < 0.15,
394
+ -- hashable >= 1.2 && < 1.4,
395
+ -- unordered-containers >= 0.2 && < 0.3,
396
+ -- attoparsec >= 0.11 && < 0.15,
397
transformers >= 0.3 && < 0.6,
398
primitive >= 0.5 && < 0.8,
399
deepseq >= 1.3 && < 1.5,
400
@@ -161,37 +161,37 @@ library
401
if !impl(ghcjs) && !os(ghcjs)
402
buildable: False
403
404
-test-suite tests
405
- type: exitcode-stdio-1.0
406
- hs-source-dirs: test
407
- main-is: Tests.hs
408
- other-modules: Tests.Marshal
409
- Tests.Properties
410
- Tests.Properties.Numeric
411
- Tests.SlowFunctions
412
- Tests.QuickCheckUtils
413
- Tests.Regressions
414
- Tests.Utils
415
- ghc-options:
416
- -Wall -rtsopts
417
- build-depends:
418
- HUnit >= 1.2,
419
- QuickCheck >= 2.7,
420
- array,
421
- text,
422
- base,
423
- bytestring,
424
- deepseq,
425
- directory,
426
- ghc-prim,
427
- ghcjs-prim,
428
- ghcjs-base,
429
- primitive,
430
- quickcheck-unicode,
431
- random,
432
- test-framework >= 0.4,
433
- test-framework-hunit >= 0.2,
434
- test-framework-quickcheck2 >= 0.2
435
- default-language: Haskell2010
436
- if !impl(ghcjs) && !os(ghcjs)
437
- buildable: False
438
+-- test-suite tests
439
+-- type: exitcode-stdio-1.0
440
+-- hs-source-dirs: test
441
+-- main-is: Tests.hs
442
+-- other-modules: Tests.Marshal
443
+-- Tests.Properties
444
+-- Tests.Properties.Numeric
445
+-- Tests.SlowFunctions
446
+-- Tests.QuickCheckUtils
447
+-- Tests.Regressions
448
+-- Tests.Utils
449
+-- ghc-options:
450
+-- -Wall -rtsopts
451
+-- build-depends:
452
+-- HUnit >= 1.2,
453
+-- QuickCheck >= 2.7,
454
+-- array,
455
+-- text,
456
+-- base,
457
+-- bytestring,
458
+-- deepseq,
459
+-- directory,
460
+-- ghc-prim,
461
+-- ghcjs-prim,
462
+-- ghcjs-base,
463
+-- primitive,
464
+-- quickcheck-unicode,
465
+-- random,
466
+-- test-framework >= 0.4,
467
+-- test-framework-hunit >= 0.2,
468
+-- test-framework-quickcheck2 >= 0.2
469
+-- default-language: Haskell2010
470
+-- if !impl(ghcjs) && !os(ghcjs)
471
+-- buildable: False
472
473