Commits

Bryan O'Sullivan committed d7dc6d4

Document isPrefixOf

  • Participants
  • Parent commits e795aa8

Comments (0)

Files changed (2)

File Data/Text.hs

 unwords = intercalate (singleton ' ')
 {-# INLINE unwords #-}
 
+-- | /O(n)/ The 'isPrefixOf' function takes two 'Text's and returns
+-- 'True' iff the first is a prefix of the second.  This function is
+-- subject to fusion.
 isPrefixOf :: Text -> Text -> Bool
 isPrefixOf a@(Text _ _ alen) b@(Text _ _ blen) =
     alen <= blen && S.isPrefixOf (stream a) (stream b)

File Data/Text/Fusion.hs

       Yield x s' -> Yield x (S2 :!: s')
 {-# INLINE [0] dropWhile #-}
 
+-- | /O(n)/ The 'isPrefixOf' function takes two 'Stream's and returns
+-- 'True' iff the first is a prefix of the second.
 isPrefixOf :: (Eq a) => Stream a -> Stream a -> Bool
 isPrefixOf (Stream next1 s1 _) (Stream next2 s2 _) = loop (next1 s1) (next2 s2)
     where