Added a check for an empty list to oneofL

This commit is contained in:
Neil Brown 2008-02-05 22:18:22 +00:00
parent 416e385017
commit c001455fc2

View File

@ -459,6 +459,7 @@ nextIdT = modify' incId
-- | A function similar to the QuickCheck oneof function, that works on GenL stuff rather than Gen.
oneofL :: [GenL a] -> GenL a
oneofL [] = fail "Empty list fed to oneofL"
oneofL gs = do i <- lift $ choose (0,length gs-1)
gs !! i