I want to sample from an infinite list of floats for QuickCheck consumption. However, as I intend to use division, I want to remove zero from that list. It is such a conceptually simple problem I was wondering if I could do it with a list comprehension, and if not, which would be the simplest way to achieve this in Haskell?
[x | x <- floats, x /= 0] -- this seems reasonable, but where do I get floats from?
My current workaround (yuck):
import Test.QuickTest
divGen :: Gen (Maybe Float)
divGen = do
x <- arbitrary
if x /= 0
then return $ Just x
else return Nothing