on master help sign in
Data.Text.Lazy.cons is O(1) rather than O(n).
commitcb727b35b97389c4c5b9d2821f85d12f6afde832 authorSteven Shaw <steven@steshaw.org> dateSat 17 Jun 2017, 14:10 (9 years ago) parentf127122
1 file changed+1−3
Data/Text/Lazy.hs+1−3
Data/Text/Lazy.hs+1−3
@@ -475,9 +475,7 @@ fromStrict t = chunk t Empty
475475-- -----------------------------------------------------------------------------
476476-- * Basic functions
477477
478−-- | /O(n)/ Adds a character to the front of a 'Text'. This function
479−-- is more costly than its 'List' counterpart because it requires
480−-- copying a new array. Subject to fusion.
478+-- | /O(1)/ Adds a character to the front of a 'Text'. Subject to fusion.
481479cons :: Char -> Text -> Text
482480cons c t = Chunk (T.singleton c) t
483481{-# INLINE [1] cons #-}