Added a check for an empty list to oneofL
This commit is contained in:
parent
416e385017
commit
c001455fc2
|
@ -459,6 +459,7 @@ nextIdT = modify' incId
|
||||||
|
|
||||||
-- | A function similar to the QuickCheck oneof function, that works on GenL stuff rather than Gen.
|
-- | A function similar to the QuickCheck oneof function, that works on GenL stuff rather than Gen.
|
||||||
oneofL :: [GenL a] -> GenL a
|
oneofL :: [GenL a] -> GenL a
|
||||||
|
oneofL [] = fail "Empty list fed to oneofL"
|
||||||
oneofL gs = do i <- lift $ choose (0,length gs-1)
|
oneofL gs = do i <- lift $ choose (0,length gs-1)
|
||||||
gs !! i
|
gs !! i
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user