@@ -13,7 +13,7 @@ import SourceSyntax.Pattern
14instance Arbitrary Literal where
14instance Arbitrary Literal where
15 arbitrary = oneof [ IntNum <$> arbitrary
15 arbitrary = oneof [ IntNum <$> arbitrary
16− , FloatNum <$> arbitrary
16+ , FloatNum <$> (arbitrary `suchThat` noE)
17 , Chr <$> arbitrary
17 , Chr <$> arbitrary
18 -- This is too permissive
18 -- This is too permissive
19 , Str <$> arbitrary
19 , Str <$> arbitrary
@@ -22,11 +22,15 @@ instance Arbitrary Literal where
23 shrink l = case l of
23 shrink l = case l of
24 IntNum n -> IntNum <$> shrink n
24 IntNum n -> IntNum <$> shrink n
25− FloatNum f -> FloatNum <$> shrink f
25+ FloatNum f -> FloatNum <$> (filter noE . shrink $ f)
26 Chr c -> Chr <$> shrink c
26 Chr c -> Chr <$> shrink c
27 Str s -> Str <$> shrink s
27 Str s -> Str <$> shrink s
28 Boolean b -> Boolean <$> shrink b
28 Boolean b -> Boolean <$> shrink b
31+noE = notElem 'e' . show
30instance Arbitrary Pattern where
34instance Arbitrary Pattern where
31 arbitrary = sized pat
35 arbitrary = sized pat
32 where pat :: Int -> Gen Pattern
36 where pat :: Int -> Gen Pattern
@@ -66,7 +70,6 @@ notReserved :: Gen String -> Gen String
66notReserved = flip exceptFor Parse.Helpers.reserveds
70notReserved = flip exceptFor Parse.Helpers.reserveds
68exceptFor :: (Ord a) => Gen a -> [a] -> Gen a
72exceptFor :: (Ord a) => Gen a -> [a] -> Gen a
69−exceptFor g xs = suchThat g notAnX
73+exceptFor g xs = g `suchThat` notAnX
70 where notAnX = flip Set.notMember xset
74 where notAnX = flip Set.notMember xset
71 xset = Set.fromList xs
75 xset = Set.fromList xs