\(Shape xs) (List ys) -> equalLength xs ys == (length xs == length ys)but equalLength is more efficient.
>>> lessOrEqualLength "" undefined Truewhereas compareLength [] undefined <= EQ = undefined.
>>> "Hello" `isPrefixOf` "Hello World!" True
>>> "Hello" `isPrefixOf` "Wello Horld!" FalseFor the result to be True, the first list must be finite; False, however, results from any mismatch:
>>> [0..] `isPrefixOf` [1..] False
>>> [0..] `isPrefixOf` [0..99] False
>>> [0..99] `isPrefixOf` [0..] True
>>> [0..] `isPrefixOf` [0..] * Hangs forever *isPrefixOf shortcuts when the first argument is empty:
>>> isPrefixOf [] undefined True
>>> "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 *
>>> isInfixOf "Haskell" "I really like Haskell." True
>>> isInfixOf "Ial" "I really like Haskell." FalseFor the result to be True, the first list must be finite; for the result to be False, the second list must be finite:
>>> [20..50] `isInfixOf` [0..] True
>>> [0..] `isInfixOf` [20..50] False
>>> [0..] `isInfixOf` [0..] * Hangs forever *
>>> "GHC" `isSubsequenceOf` "The Glorious Haskell Compiler" True
>>> ['a','d'..'z'] `isSubsequenceOf` ['a'..'z'] True
>>> [1..10] `isSubsequenceOf` [10,9..0] FalseFor the result to be True, the first list must be finite; for the result to be False, the second list must be finite:
>>> [0,2..10] `isSubsequenceOf` [0..] True
>>> [0..] `isSubsequenceOf` [0,2..10] False
>>> [0,2..] `isSubsequenceOf` [0..] * Hangs forever*
>>> isInfixOf "Haskell" "I really like Haskell." True >>> isInfixOf "Ial" "I really like Haskell." FalseFor the result to be True, the first list must be finite; for the result to be False, the second list must be finite:
>>> [20..50] `isInfixOf` [0..] True >>> [0..] `isInfixOf` [20..50] False >>> [0..] `isInfixOf` [0..] * Hangs forever *
disjoint [1,2,3] [4,5] == True disjoint [1,2,3] [4,1] == False
startswith "He" "Hello" -> True
endswith "lo" "Hello" -> True
contains "Haskell" "I really like Haskell." -> True contains "Haskell" "OCaml is great." -> False
>>> "Hello" `isPrefixOf` "Hello World!" True
>>> "Hello" `isPrefixOf` "Wello Horld!" False
>>> "ld!" `isSuffixOf` "Hello World!" True
>>> "World" `isSuffixOf` "Hello World!" False
>>> isSubsequenceOf "GHC" "The Glorious Haskell Compiler" True >>> isSubsequenceOf ['a','d'..'z'] ['a'..'z'] True >>> isSubsequenceOf [1..10] [10,9..0] False
>>> "Hello" `isPrefixOf` "Hello World!" True >>> "Hello" `isPrefixOf` "Wello Horld!" FalseFor the result to be True, the first list must be finite; False, however, results from any mismatch:
>>> [0..] `isPrefixOf` [1..] False >>> [0..] `isPrefixOf` [0..99] False >>> [0..99] `isPrefixOf` [0..] True >>> [0..] `isPrefixOf` [0..] * Hangs forever *
>>> "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 *
>>> isSubsequenceOf "GHC" "The Glorious Haskell Compiler" True >>> isSubsequenceOf ['a','d'..'z'] ['a'..'z'] True >>> isSubsequenceOf [1..10] [10,9..0] FalseFor the result to be True, the first list must be finite; for the result to be False, the second list must be finite:
>>> [0,2..10] `isSubsequenceOf` [0..] True >>> [0..] `isSubsequenceOf` [0,2..10] False >>> [0,2..] `isSubsequenceOf` [0..] * Hangs forever*