@@ -8,9 +8,6 @@
88module Test.Hedgehog.TypeLits where
99
1010import Data.Constraint
11−#if __GLASGOW_HASKELL__ < 800
12−import Data.Proxy
13−#endif
1411import Data.Singletons
1512
1613import Hedgehog (Gen)
@@ -19,7 +16,7 @@ import qualified Hedgehog.Gen as Gen
1916import Grenade
2017
2118import GHC.TypeLits
22−import GHC.TypeLits.Witnesses
19+import GHC.TypeLits.Witnesses hiding (SNat)
2320import Test.Hedgehog.Compat
2421
2522genNat :: Gen SomeNat
@@ -27,13 +24,7 @@ genNat = do
2724 ~(Just n) <- someNatVal <$> choose 1 10
2825 return n
2926
30−#if __GLASGOW_HASKELL__ < 800
31−type Shape' = ('KProxy :: KProxy Shape)
32−#else
33−type Shape' = Shape
34−#endif
35−
36−genShape :: Gen (SomeSing Shape')
27+genShape :: Gen (SomeSing Shape)
3728genShape
3829 = Gen.choice [
3930 genD1
@@ -41,20 +32,20 @@ genShape
4132 , genD3
4233 ]
4334
44−genD1 :: Gen (SomeSing Shape')
35+genD1 :: Gen (SomeSing Shape)
4536genD1 = do
4637 n <- genNat
4738 return $ case n of
4839 SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x))
4940
50−genD2 :: Gen (SomeSing Shape')
41+genD2 :: Gen (SomeSing Shape)
5142genD2 = do
5243 n <- genNat
5344 m <- genNat
5445 return $ case (n, m) of
5546 (SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y))
5647
57−genD3 :: Gen (SomeSing Shape')
48+genD3 :: Gen (SomeSing Shape)
5849genD3 = do
5950 n <- genNat
6051 m <- genNat
@@ -64,7 +55,7 @@ genD3 = do
6455 case natDict px %* natDict pz of
6556 Dict -> SomeSing (sing :: Sing ('D3 x y z))
6657
67−rss :: SomeSing Shape' -> String
58+rss :: SomeSing Shape -> String
6859rss (SomeSing (r :: Sing s)) = case r of
6960 (D1Sing a@SNat) -> "D1 " ++ show (natVal a)
7061 (D2Sing a@SNat b@SNat) -> "D2 " ++ show (natVal a) ++ " " ++ show (natVal b)