From 115f2822388b798fb2adb8946a40d55782b0d0a8 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Fri, 1 Sep 2006 14:36:54 +0000 Subject: [PATCH] Cleaner isInfixOf suggestion from Ross Paterson --- Data/List.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/List.hs b/Data/List.hs index 8b504f7..7c3cede 100644 --- a/Data/List.hs +++ b/Data/List.hs @@ -276,7 +276,7 @@ isSuffixOf x y = reverse x `isPrefixOf` reverse y -- >isInfixOf "Haskell" "I really like Haskell." -> True -- >isInfixOf "Ial" "I really like Haskell." -> False isInfixOf :: (Eq a) => [a] -> [a] -> Bool -isInfixOf needle haystack = isJust $ find (isPrefixOf needle) (tails haystack) +isInfixOf needle haystack = any (isPrefixOf needle) (tails haystack) -- | The 'nub' function removes duplicate elements from a list. -- In particular, it keeps only the first occurrence of each element. -- 1.7.10.4