1. Bryan O'Sullivan
  2. text

Commits

Bryan O'Sullivan  committed e8fb641

Fix bad performance of Data.Text.Lazy.uncons

  • Participants
  • Parent commits 83667e3
  • Branches default

Comments (0)

Files changed (1)

File Data/Text/Lazy.hs

View file
     ) where
 
 import Prelude (Char, Bool(..), Maybe(..), String,
-                Eq(..), Ord(..), Ordering, Read(..), Show(..),
+                Eq(..), Ord(..), Ordering(..), Read(..), Show(..),
                 (&&), (+), (-), (.), ($), (++),
                 div, error, flip, fromIntegral, not, otherwise)
 import qualified Prelude as P
 uncons Empty = Nothing
 uncons (Chunk t ts) =
     Just (T.unsafeHead t,
-          if T.length t == 1 then ts else Chunk (T.unsafeTail t) ts)
+          if T.compareLength t 1 == EQ then ts else Chunk (T.unsafeTail t) ts)
 {-# INLINE uncons #-}
 
 -- | /O(1)/ Returns the first character of a 'Text', which must be