Path: blob/develop/haskell-overlays/text-jsstring-8.10/conduit-extra-text-jsstring.patch
1 views
diff --git a/Data/Conduit/Attoparsec.hs b/Data/Conduit/Attoparsec.hs1index bd889f8..a620675 1006442--- a/Data/Conduit/Attoparsec.hs3+++ b/Data/Conduit/Attoparsec.hs4@@ -1,4 +1,5 @@5{-# LANGUAGE BangPatterns #-}6+{-# LANGUAGE CPP #-}7{-# LANGUAGE DeriveDataTypeable #-}8{-# LANGUAGE FlexibleContexts #-}9{-# LANGUAGE RankNTypes #-}10@@ -33,6 +34,9 @@ import qualified Data.Text as T11import qualified Data.Text.Internal as TI12import Data.Typeable (Typeable)13import Prelude hiding (lines)14+#ifdef __GHCJS__15+import qualified Data.JSString.Raw as JSS16+#endif1718import qualified Data.Attoparsec.ByteString19import qualified Data.Attoparsec.Text20@@ -105,8 +109,13 @@ instance AttoparsecInput T.Text where21f (Position l c o) ch22| ch == '\n' = Position (l + 1) 0 (o + 1)23| otherwise = Position l (c + 1) (o + 1)24+#ifndef __GHCJS__25stripFromEnd (TI.Text arr1 off1 len1) (TI.Text _ _ len2) =26TI.text arr1 off1 (len1 - len2)27+#else28+ stripFromEnd (TI.Text str1) (TI.Text str2) =29+ TI.Text $ JSS.rawDropEnd (JSS.rawLength str1 - JSS.rawLength str2) str130+#endif3132-- | Convert an Attoparsec 'A.Parser' into a 'Sink'. The parser will33-- be streamed bytes until it returns 'A.Done' or 'A.Fail'.34diff --git a/conduit-extra.cabal b/conduit-extra.cabal35index f6dfe7a..b5b2515 10064436--- a/conduit-extra.cabal37+++ b/conduit-extra.cabal38@@ -58,6 +58,9 @@ Library39, unliftio-core40, typed-process >= 0.24142+ if impl(ghcjs)43+ Build-depends: ghcjs-base44+45ghc-options: -Wall4647test-suite test484950