@@ -13,7 +13,7 @@ import SourceSyntax.Pattern
1313
1414instance Arbitrary Literal where
1515 arbitrary = oneof [ IntNum <$> arbitrary
16− , FloatNum <$> arbitrary
16+ , FloatNum <$> (arbitrary `suchThat` noE)
1717 , Chr <$> arbitrary
1818 -- This is too permissive
1919 , Str <$> arbitrary
@@ -22,11 +22,15 @@ instance Arbitrary Literal where
2222 ]
2323 shrink l = case l of
2424 IntNum n -> IntNum <$> shrink n
25− FloatNum f -> FloatNum <$> shrink f
25+ FloatNum f -> FloatNum <$> (filter noE . shrink $ f)
2626 Chr c -> Chr <$> shrink c
2727 Str s -> Str <$> shrink s
2828 Boolean b -> Boolean <$> shrink b
2929
30+noE :: Double -> Bool
31+noE = notElem 'e' . show
32+
33+
3034instance Arbitrary Pattern where
3135 arbitrary = sized pat
3236 where pat :: Int -> Gen Pattern
@@ -66,7 +70,6 @@ notReserved :: Gen String -> Gen String
6670notReserved = flip exceptFor Parse.Helpers.reserveds
6771
6872exceptFor :: (Ord a) => Gen a -> [a] -> Gen a
69−exceptFor g xs = suchThat g notAnX
73+exceptFor g xs = g `suchThat` notAnX
7074 where notAnX = flip Set.notMember xset
7175 xset = Set.fromList xs
72−