Haskell: Check if Int is in a list of Int’s

First find the type of the function you need.

To “Check if” means to return either True or False, a Bool.

So the function takes an Int, a list of Int (aka [Int]) and returns Bool:

Int -> [Int] -> Bool

Now ask hoogle.

elem :: Eq a => a -> [a] -> Bool

Hoogle is a very useful tool. You can integrate it with ghci.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)