>>> "ld!" `isSuffixOf` "Hello World!" True
>>> "World" `isSuffixOf` "Hello World!" FalseThe second list must be finite; however the first list may be infinite:
>>> [0..] `isSuffixOf` [0..99] False
>>> [0..99] `isSuffixOf` [0..] * Hangs forever *
isSuffixOf x y == reverse x `isPrefixOf` reverse yHowever, the real implementation uses memcmp to compare the end of the string only, with no reverse required..
isSuffixOf x y == reverse x `isPrefixOf` reverse y
isSuffixOf x y == reverse x `isPrefixOf` reverse y
isSuffixOf x y == reverse x `isPrefixOf` reverse yHowever, the real implemenation uses memcmp to compare the end of the string only, with no reverse required..
>>> "ld!" `isSuffixOf` "Hello World!" True
>>> "World" `isSuffixOf` "Hello World!" False
>>> Stream.isSuffixOf (Stream.fromList "hello") (Stream.fromList "hello" :: SerialT IO Char) TrueSpace: O(n), buffers entire input stream and the suffix. Pre-release Suboptimal - Help wanted.
>>> "ld!" `isSuffixOf` "Hello World!" True >>> "World" `isSuffixOf` "Hello World!" FalseThe second list must be finite; however the first list may be infinite:
>>> [0..] `isSuffixOf` [0..99] False >>> [0..99] `isSuffixOf` [0..] * Hangs forever *
isSuffixOf x y == reverse x `isPrefixOf` reverse y
isSuffixOf x y == reverse x `isPrefixOf` reverse y
isSuffixOf x y == reverse x `isPrefixOf` reverse y
isSuffixOf x y == reverse x `isPrefixOf` reverse y
>>> Stream.isSuffixOf (Stream.fromList "hello") (Stream.fromList "hello" :: Stream IO Char) TrueSpace: O(n), buffers entire input stream and the suffix. Pre-release Suboptimal - Help wanted.
>>> prove $ \(l1 :: SList Word16) l2 -> l2 `isSuffixOf` (l1 ++ l2) Q.E.D. >>> prove $ \(l1 :: SList Word16) l2 -> l1 `isSuffixOf` l2 .=> subList l2 (length l2 - length l1) (length l1) .== l1 Q.E.D. >>> prove $ \(s1 :: SString) s2 -> s2 `isSuffixOf` (s1 ++ s2) Q.E.D. >>> prove $ \(s1 :: SString) s2 -> s1 `isSuffixOf` s2 .=> subList s2 (length s2 - length s1) (length s1) .== s1 Q.E.D.