on master help sign in
Document lazy init
5f86c68Bryan O'Sullivan
Data/Text/Lazy.hs+2
@@ -265,6 +265,8 @@ tail Empty = emptyError "tail"
265 unstream (S.tail (stream t)) = tail t
265 unstream (S.tail (stream t)) = tail t
266 #-}
266 #-}
267
267
268+-- | /O(1)/ Returns all but the last character of a 'Text', which must
269+-- be non-empty. Subject to array fusion.
268init :: Text -> Text
270init :: Text -> Text
269init (Chunk t0 ts0) = go t0 ts0
271init (Chunk t0 ts0) = go t0 ts0
270 where go t (Chunk t' ts) = Chunk t (go t' ts)
272 where go t (Chunk t' ts) = Chunk t (go t' ts)