Since you are using IO internally choseRandom, you need to change the type signature:
choseRandom :: [a] -> IO a
secondly, you do not need to use >>=to get the length of the list. >>=has type
Monad m => m a -> (a -> m b) -> m b
The type lengthis equal [a] -> Int, so the type length listis equal Int, which is not a monad.
You can calculate it directly by calling randomInt:
choseRandom :: [a] -> IO a
choseRandom list =
randomInt(0, length list) >>= (\num -> return (list !! num))
which coincides with
choseRandom :: [a] -> IO a
choseRandom list = fmap (\num -> (list !! num)) (randomInt(0, length list))