diff --git a/src/Data/Text/Internal/IsAscii.hs b/src/Data/Text/Internal/IsAscii.hs index c848e54f..761f08b5 100644 --- a/src/Data/Text/Internal/IsAscii.hs +++ b/src/Data/Text/Internal/IsAscii.hs @@ -13,6 +13,7 @@ module Data.Text.Internal.IsAscii where import Prelude (Bool(..), Int) import qualified Data.Char as Char import {-# SOURCE #-} Data.Text (all) +import qualified Data.ByteString as BS #else import Data.Text.Internal.ByteStringCompat (withBS) import Data.Text.Internal.Unsafe (unsafeWithForeignPtr) @@ -64,7 +65,7 @@ isAscii (Text (A.ByteArray arr) off len) = -- | Length of the longest ASCII prefix. asciiPrefixLength :: ByteString -> Int #if defined(PURE_HASKELL) -asciiPrefixLength = P.const 0 +asciiPrefixLength = BS.length P.. BS.takeWhile (P.< 0x80) #else asciiPrefixLength bs = unsafeDupablePerformIO $ withBS bs $ \ fp len -> unsafeWithForeignPtr fp $ \src -> do