Path: blob/develop/haskell-overlays/ghcjs-text-jsstring-8.6/ghcjs-base-text-jsstring.patch
1 views
diff --git a/Data/JSString.hs b/Data/JSString.hs1index 176aad4..9ca6693 1006442--- a/Data/JSString.hs3+++ b/Data/JSString.hs4@@ -99,6 +99,7 @@ module Data.JSString ( JSString5, breakOnEnd6, break7, span8+ , span_9, group10, group'11, groupBy12@@ -1231,19 +1232,23 @@ splitAt (I# n) x = case js_splitAt n x of (# y, z #) -> (y, z)13-- of @t@ of elements that satisfy @p@, and whose second is the14-- remainder of the list.15span :: (Char -> Bool) -> JSString -> (JSString, JSString)16-span p x = case js_length x of17- 0# -> (empty, empty)18- l -> let c0 = js_uncheckedIndex 0# x19- in if p (C# (chr# c0)) then loop 0# l else (empty, x)20+span p x = let (# a, b #) = span_ p x in (a, b)21+{-# INLINE span #-}22+23+span_ :: (Char -> Bool) -> JSString -> (# JSString, JSString #)24+span_ p x = case js_length x of25+ 0# -> (# empty, empty #)26+ l -> let c0 = js_uncheckedIndex 0# x27+ in if p (C# (chr# c0)) then loop 0# l else (# empty, x #)28where29loop i l30- | isTrue# (i >=# l) = (x, empty)31+ | isTrue# (i >=# l) = (# x, empty #)32| otherwise =33let c = js_uncheckedIndex i x34in if p (C# (chr# c))35then loop (i +# charWidth c) l36- else (js_substr 0# i x, js_substr1 i x)37-{-# INLINE span #-}38+ else (# js_substr 0# i x, js_substr1 i x #)39+{-# INLINE span_ #-}4041-- | /O(n)/ 'break' is like 'span', but the prefix returned is42-- over elements that fail the predicate @p@.43diff --git a/GHCJS/Foreign.hs b/GHCJS/Foreign.hs44index 5bbc5c5..b128f24 10064445--- a/GHCJS/Foreign.hs46+++ b/GHCJS/Foreign.hs47@@ -82,7 +82,7 @@ import GHCJS.Marshal48import GHCJS.Marshal.Pure49-}50import Data.String (IsString(..))51-import qualified Data.Text as T52+-- import qualified Data.Text as T535455class ToJSString a where56diff --git a/GHCJS/Foreign/Internal.hs b/GHCJS/Foreign/Internal.hs57index 5ac81f0..449bfe4 10064458--- a/GHCJS/Foreign/Internal.hs59+++ b/GHCJS/Foreign/Internal.hs60@@ -100,10 +100,10 @@ import Data.Typeable (Typeable)61import Data.ByteString (ByteString)62import Data.ByteString.Unsafe (unsafePackAddressLen)6364-import qualified Data.Text.Array as A65-import qualified Data.Text as T66-import qualified Data.Text.Internal as T67-import qualified Data.Text.Lazy as TL (Text, toStrict, fromStrict)68+-- import qualified Data.Text.Array as A69+-- import qualified Data.Text as T70+-- import qualified Data.Text.Internal as T71+-- import qualified Data.Text.Lazy as TL (Text, toStrict, fromStrict)7273import Unsafe.Coerce7475diff --git a/GHCJS/Marshal.hs b/GHCJS/Marshal.hs76index a36aca2..6256a73 10064477--- a/GHCJS/Marshal.hs78+++ b/GHCJS/Marshal.hs79@@ -16,7 +16,7 @@8081module GHCJS.Marshal ( FromJSVal(..)82, ToJSVal(..)83- , toJSVal_aeson84+ -- , toJSVal_aeson85, toJSVal_pure86) where8788@@ -24,17 +24,17 @@ import Control.Applicative89import Control.Monad90import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)9192-import qualified Data.Aeson as AE93-import Data.Attoparsec.Number (Number(..))94+-- import qualified Data.Aeson as AE95+-- import Data.Attoparsec.Number (Number(..))96import Data.Bits ((.&.))97import Data.Char (chr, ord)98-import qualified Data.HashMap.Strict as H99+-- import qualified Data.HashMap.Strict as H100import Data.Int (Int8, Int16, Int32)101import qualified Data.JSString as JSS102-import qualified Data.JSString.Text as JSS103+-- import qualified Data.JSString.Text as JSS104import Data.Maybe105-import Data.Scientific (Scientific, scientific, fromFloatDigits)106-import Data.Text (Text)107+-- import Data.Scientific (Scientific, scientific, fromFloatDigits)108+-- import Data.Text (Text)109import qualified Data.Vector as V110import Data.Word (Word8, Word16, Word32, Word)111import Data.Primitive.ByteArray112@@ -85,11 +85,11 @@ instance FromJSVal JSString where113{-# INLINE fromJSValUnchecked #-}114fromJSVal = fromJSVal_pure115{-# INLINE fromJSVal #-}116-instance FromJSVal Text where117- fromJSValUnchecked = fromJSValUnchecked_pure118- {-# INLINE fromJSValUnchecked #-}119- fromJSVal = fromJSVal_pure120- {-# INLINE fromJSVal #-}121+-- instance FromJSVal Text where122+-- fromJSValUnchecked = fromJSValUnchecked_pure123+-- {-# INLINE fromJSValUnchecked #-}124+-- fromJSVal = fromJSVal_pure125+-- {-# INLINE fromJSVal #-}126instance FromJSVal Char where127fromJSValUnchecked = fromJSValUnchecked_pure128{-# INLINE fromJSValUnchecked #-}129@@ -154,24 +154,24 @@ instance FromJSVal Double where130{-# INLINE fromJSValUnchecked #-}131fromJSVal = fromJSVal_pure132{-# INLINE fromJSVal #-}133-instance FromJSVal AE.Value where134- fromJSVal r = case jsonTypeOf r of135- JSONNull -> return (Just AE.Null)136- JSONInteger -> liftM (AE.Number . flip scientific 0 . (toInteger :: Int -> Integer))137- <$> fromJSVal r138- JSONFloat -> liftM (AE.Number . (fromFloatDigits :: Double -> Scientific))139- <$> fromJSVal r140- JSONBool -> liftM AE.Bool <$> fromJSVal r141- JSONString -> liftM AE.String <$> fromJSVal r142- JSONArray -> liftM (AE.Array . V.fromList) <$> fromJSVal r143- JSONObject -> do144- props <- OI.listProps (OI.Object r)145- runMaybeT $ do146- propVals <- forM props $ \p -> do147- v <- MaybeT (fromJSVal =<< OI.getProp p (OI.Object r))148- return (JSS.textFromJSString p, v)149- return (AE.Object (H.fromList propVals))150- {-# INLINE fromJSVal #-}151+-- instance FromJSVal AE.Value where152+-- fromJSVal r = case jsonTypeOf r of153+-- JSONNull -> return (Just AE.Null)154+-- JSONInteger -> liftM (AE.Number . flip scientific 0 . (toInteger :: Int -> Integer))155+-- <$> fromJSVal r156+-- JSONFloat -> liftM (AE.Number . (fromFloatDigits :: Double -> Scientific))157+-- <$> fromJSVal r158+-- JSONBool -> liftM AE.Bool <$> fromJSVal r159+-- JSONString -> liftM AE.String <$> fromJSVal r160+-- JSONArray -> liftM (AE.Array . V.fromList) <$> fromJSVal r161+-- JSONObject -> do162+-- props <- OI.listProps (OI.Object r)163+-- runMaybeT $ do164+-- propVals <- forM props $ \p -> do165+-- v <- MaybeT (fromJSVal =<< OI.getProp p (OI.Object r))166+-- return (JSS.textFromJSString p, v)167+-- return (AE.Object (H.fromList propVals))168+-- {-# INLINE fromJSVal #-}169instance (FromJSVal a, FromJSVal b) => FromJSVal (a,b) where170fromJSVal r = runMaybeT $ (,) <$> jf r 0 <*> jf r 1171{-# INLINE fromJSVal #-}172@@ -204,15 +204,15 @@ jf r n = MaybeT $ do173instance ToJSVal JSVal where174toJSVal = toJSVal_pure175{-# INLINE toJSVal #-}176-instance ToJSVal AE.Value where177- toJSVal = toJSVal_aeson178- {-# INLINE toJSVal #-}179+-- instance ToJSVal AE.Value where180+-- toJSVal = toJSVal_aeson181+-- {-# INLINE toJSVal #-}182instance ToJSVal JSString where183toJSVal = toJSVal_pure184{-# INLINE toJSVal #-}185-instance ToJSVal Text where186- toJSVal = toJSVal_pure187- {-# INLINE toJSVal #-}188+-- instance ToJSVal Text where189+-- toJSVal = toJSVal_pure190+-- {-# INLINE toJSVal #-}191instance ToJSVal Char where192toJSVal = return . pToJSVal193{-# INLINE toJSVal #-}194@@ -285,21 +285,21 @@ foreign import javascript unsafe "[$1,$2,$3,$4,$5]" arr5 :: JSVal -> J195foreign import javascript unsafe "[$1,$2,$3,$4,$5,$6]" arr6 :: JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> IO JSVal196foreign import javascript unsafe "[$1,$2,$3,$4,$5,$6,$7]" arr7 :: JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> IO JSVal197198-toJSVal_aeson :: AE.ToJSON a => a -> IO JSVal199-toJSVal_aeson x = cv (AE.toJSON x)200- where201- cv = convertValue202+-- toJSVal_aeson :: AE.ToJSON a => a -> IO JSVal203+-- toJSVal_aeson x = cv (AE.toJSON x)204+-- where205+-- cv = convertValue206207- convertValue :: AE.Value -> IO JSVal208- convertValue AE.Null = return jsNull209- convertValue (AE.String t) = return (pToJSVal t)210- convertValue (AE.Array a) = (\(AI.SomeJSArray x) -> x) <$>211- (AI.fromListIO =<< mapM convertValue (V.toList a))212- convertValue (AE.Number n) = toJSVal (realToFrac n :: Double)213- convertValue (AE.Bool b) = return (toJSBool b)214- convertValue (AE.Object o) = do215- obj@(OI.Object obj') <- OI.create216- mapM_ (\(k,v) -> convertValue v >>= \v' -> OI.setProp (JSS.textToJSString k) v' obj) (H.toList o)217- return obj'218+-- convertValue :: AE.Value -> IO JSVal219+-- convertValue AE.Null = return jsNull220+-- convertValue (AE.String t) = return (pToJSVal t)221+-- convertValue (AE.Array a) = (\(AI.SomeJSArray x) -> x) <$>222+-- (AI.fromListIO =<< mapM convertValue (V.toList a))223+-- convertValue (AE.Number n) = toJSVal (realToFrac n :: Double)224+-- convertValue (AE.Bool b) = return (toJSBool b)225+-- convertValue (AE.Object o) = do226+-- obj@(OI.Object obj') <- OI.create227+-- mapM_ (\(k,v) -> convertValue v >>= \v' -> OI.setProp (JSS.textToJSString k) v' obj) (H.toList o)228+-- return obj'229230231diff --git a/GHCJS/Marshal/Pure.hs b/GHCJS/Marshal/Pure.hs232index 902fa20..268489d 100644233--- a/GHCJS/Marshal/Pure.hs234+++ b/GHCJS/Marshal/Pure.hs235@@ -28,11 +28,11 @@ import Data.Data236import Data.Int (Int8, Int16, Int32)237import Data.JSString.Internal.Type238import Data.Maybe239-import Data.Text (Text)240+-- import Data.Text (Text)241import Data.Typeable242import Data.Word (Word8, Word16, Word32, Word)243import Data.JSString244-import Data.JSString.Text245+-- import Data.JSString.Text246import Data.Bits ((.&.))247import Unsafe.Coerce (unsafeCoerce)248import GHC.Int249@@ -65,8 +65,8 @@ instance PFromJSVal JSString where pFromJSVal = JSString250{-# INLINE pFromJSVal #-}251instance PFromJSVal [Char] where pFromJSVal = Prim.fromJSString252{-# INLINE pFromJSVal #-}253-instance PFromJSVal Text where pFromJSVal = textFromJSVal254- {-# INLINE pFromJSVal #-}255+-- instance PFromJSVal Text where pFromJSVal = textFromJSVal256+-- {-# INLINE pFromJSVal #-}257instance PFromJSVal Char where pFromJSVal x = C# (jsvalToChar x)258{-# INLINE pFromJSVal #-}259instance PFromJSVal Bool where pFromJSVal = isTruthy260@@ -103,8 +103,8 @@ instance PToJSVal JSString where pToJSVal = jsval261{-# INLINE pToJSVal #-}262instance PToJSVal [Char] where pToJSVal = Prim.toJSString263{-# INLINE pToJSVal #-}264-instance PToJSVal Text where pToJSVal = jsval . textToJSString265- {-# INLINE pToJSVal #-}266+-- instance PToJSVal Text where pToJSVal = jsval . textToJSString267+-- {-# INLINE pToJSVal #-}268instance PToJSVal Char where pToJSVal (C# c) = charToJSVal c269{-# INLINE pToJSVal #-}270instance PToJSVal Bool where pToJSVal True = jsTrue271diff --git a/JavaScript/JSON/Types/Instances.hs b/JavaScript/JSON/Types/Instances.hs272index 2b288ec..6d7074c 100644273--- a/JavaScript/JSON/Types/Instances.hs274+++ b/JavaScript/JSON/Types/Instances.hs275@@ -57,7 +57,7 @@ import Control.Applicative ((<$>), (<*>), (<|>), pure, empty)276277import Data.JSString (JSString)278import qualified Data.JSString as JSS279-import qualified Data.JSString.Text as JSS280+-- import qualified Data.JSString.Text as JSS281282import JavaScript.Array (JSArray)283import qualified JavaScript.Array as JSA284@@ -335,21 +335,21 @@ instance FromJSON JSString where285parseJSON = withJSString "JSString" pure286{-# INLINE parseJSON #-}287288-instance ToJSON Text where289- toJSON = stringValue . JSS.textToJSString290- {-# INLINE toJSON #-}291+-- instance ToJSON Text where292+-- toJSON = stringValue . JSS.textToJSString293+-- {-# INLINE toJSON #-}294295-instance FromJSON Text where296- parseJSON = withJSString "Text" ( pure . JSS.textFromJSString )297- {-# INLINE parseJSON #-}298+-- instance FromJSON Text where299+-- parseJSON = withJSString "Text" ( pure . JSS.textFromJSString )300+-- {-# INLINE parseJSON #-}301302-instance ToJSON LT.Text where303- toJSON = stringValue . JSS.textToJSString . LT.toStrict304- {-# INLINE toJSON #-}305+-- instance ToJSON LT.Text where306+-- toJSON = stringValue . JSS.textToJSString . LT.toStrict307+-- {-# INLINE toJSON #-}308309-instance FromJSON LT.Text where310- parseJSON = withJSString "Lazy Text" $ pure . LT.fromStrict . JSS.textFromJSString311- {-# INLINE parseJSON #-}312+-- instance FromJSON LT.Text where313+-- parseJSON = withJSString "Lazy Text" $ pure . LT.fromStrict . JSS.textFromJSString314+-- {-# INLINE parseJSON #-}315316instance (ToJSON a) => ToJSON [a] where317toJSON = arrayValue . arrayValueList . map toJSON318diff --git a/JavaScript/Web/Canvas.hs b/JavaScript/Web/Canvas.hs319index 0a7684c..74490c2 100644320--- a/JavaScript/Web/Canvas.hs321+++ b/JavaScript/Web/Canvas.hs322@@ -69,7 +69,7 @@ import Control.Monad323324import Data.Data325import Data.Maybe (fromJust)326-import Data.Text (Text)327+-- import Data.Text (Text)328import Data.Typeable329330import GHCJS.Foreign331diff --git a/ghcjs-base.cabal b/ghcjs-base.cabal332index 4a64694..acf8806 100644333--- a/ghcjs-base.cabal334+++ b/ghcjs-base.cabal335@@ -55,7 +55,7 @@ library336Data.JSString.RealFloat337Data.JSString.RegExp338Data.JSString.Internal339- Data.JSString.Text340+ -- Data.JSString.Text341Data.JSString.Internal.Fusion342Data.JSString.Internal.Fusion.Types343Data.JSString.Internal.Fusion.Common344@@ -78,12 +78,12 @@ library345JavaScript.Array.Internal346JavaScript.Array.ST347JavaScript.Cast348- JavaScript.JSON349- JavaScript.JSON.Types350- JavaScript.JSON.Types.Class351- JavaScript.JSON.Types.Generic352- JavaScript.JSON.Types.Instances353- JavaScript.JSON.Types.Internal354+ -- JavaScript.JSON355+ -- JavaScript.JSON.Types356+ -- JavaScript.JSON.Types.Class357+ -- JavaScript.JSON.Types.Generic358+ -- JavaScript.JSON.Types.Instances359+ -- JavaScript.JSON.Types.Internal360JavaScript.Number361JavaScript.Object362JavaScript.Object.Internal363@@ -115,11 +115,11 @@ library364JavaScript.Web.Storage365JavaScript.Web.Storage.Internal366JavaScript.Web.StorageEvent367- JavaScript.Web.XMLHttpRequest368+ -- JavaScript.Web.XMLHttpRequest369JavaScript.Web.WebSocket370JavaScript.Web.Worker371- other-modules: GHCJS.Internal.Types372Data.JSString.Internal.Type373+ other-modules: GHCJS.Internal.Types374JavaScript.TypedArray.Internal.Types375JavaScript.TypedArray.ArrayBuffer.Internal376JavaScript.TypedArray.DataView.Internal377@@ -144,15 +144,15 @@ library378integer-gmp,379binary >= 0.8 && < 0.11,380bytestring >= 0.10 && < 0.11,381- text >= 1.1 && < 1.3,382- aeson >= 0.8 && < 1.6,383- scientific >= 0.3 && < 0.4,384+ -- text >= 1.1 && < 1.3,385+ -- aeson >= 0.8 && < 1.6,386+ -- scientific >= 0.3 && < 0.4,387vector >= 0.10 && < 0.13,388containers >= 0.5 && < 0.7,389time >= 1.5 && < 1.10,390- hashable >= 1.2 && < 1.4,391- unordered-containers >= 0.2 && < 0.3,392- attoparsec >= 0.11 && < 0.15,393+ -- hashable >= 1.2 && < 1.4,394+ -- unordered-containers >= 0.2 && < 0.3,395+ -- attoparsec >= 0.11 && < 0.15,396transformers >= 0.3 && < 0.6,397primitive >= 0.5 && < 0.8,398deepseq >= 1.3 && < 1.5,399@@ -161,37 +161,37 @@ library400if !impl(ghcjs) && !os(ghcjs)401buildable: False402403-test-suite tests404- type: exitcode-stdio-1.0405- hs-source-dirs: test406- main-is: Tests.hs407- other-modules: Tests.Marshal408- Tests.Properties409- Tests.Properties.Numeric410- Tests.SlowFunctions411- Tests.QuickCheckUtils412- Tests.Regressions413- Tests.Utils414- ghc-options:415- -Wall -rtsopts416- build-depends:417- HUnit >= 1.2,418- QuickCheck >= 2.7,419- array,420- text,421- base,422- bytestring,423- deepseq,424- directory,425- ghc-prim,426- ghcjs-prim,427- ghcjs-base,428- primitive,429- quickcheck-unicode,430- random,431- test-framework >= 0.4,432- test-framework-hunit >= 0.2,433- test-framework-quickcheck2 >= 0.2434- default-language: Haskell2010435- if !impl(ghcjs) && !os(ghcjs)436- buildable: False437+-- test-suite tests438+-- type: exitcode-stdio-1.0439+-- hs-source-dirs: test440+-- main-is: Tests.hs441+-- other-modules: Tests.Marshal442+-- Tests.Properties443+-- Tests.Properties.Numeric444+-- Tests.SlowFunctions445+-- Tests.QuickCheckUtils446+-- Tests.Regressions447+-- Tests.Utils448+-- ghc-options:449+-- -Wall -rtsopts450+-- build-depends:451+-- HUnit >= 1.2,452+-- QuickCheck >= 2.7,453+-- array,454+-- text,455+-- base,456+-- bytestring,457+-- deepseq,458+-- directory,459+-- ghc-prim,460+-- ghcjs-prim,461+-- ghcjs-base,462+-- primitive,463+-- quickcheck-unicode,464+-- random,465+-- test-framework >= 0.4,466+-- test-framework-hunit >= 0.2,467+-- test-framework-quickcheck2 >= 0.2468+-- default-language: Haskell2010469+-- if !impl(ghcjs) && !os(ghcjs)470+-- buildable: False471472473