>>> 3 `elem` [] False
>>> 3 `elem` [1,2] False
>>> 3 `elem` [1,2,3,4,5] TrueFor infinite structures, the default implementation of elem terminates if the sought-after value exists at a finite distance from the left side of the structure:
>>> 3 `elem` [1..] True
>>> 3 `elem` ([4..] ++ [3]) * Hangs forever *
>>> 3 `elem` [] False
>>> 3 `elem` [1,2] False
>>> 3 `elem` [1,2,3,4,5] True
>>> 3 `elem` [1..] True
>>> 3 `elem` [4..] * Hangs forever *
>>> elem 'x' ("abc" :: String)
False
>>> elem False (one True :: Set Bool)
...
... Do not use 'elem' and 'notElem' methods from 'Foldable' on Set
Suggestions:
Instead of
elem :: (Foldable t, Eq a) => a -> t a -> Bool
use
member :: Ord a => a -> Set a -> Bool
...
Instead of
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
use
not . member
...