@@ -8,9 +8,6 @@
8module Test.Hedgehog.TypeLits where
8module Test.Hedgehog.TypeLits where
10import Data.Constraint
10import Data.Constraint
11−#if __GLASGOW_HASKELL__ < 800
14import Data.Singletons
11import Data.Singletons
16import Hedgehog (Gen)
13import Hedgehog (Gen)
@@ -19,7 +16,7 @@ import qualified Hedgehog.Gen as Gen
19import Grenade
16import Grenade
21import GHC.TypeLits
18import GHC.TypeLits
22−import GHC.TypeLits.Witnesses
19+import GHC.TypeLits.Witnesses hiding (SNat)
23import Test.Hedgehog.Compat
20import Test.Hedgehog.Compat
25genNat :: Gen SomeNat
22genNat :: Gen SomeNat
@@ -27,13 +24,7 @@ genNat = do
27 ~(Just n) <- someNatVal <$> choose 1 10
24 ~(Just n) <- someNatVal <$> choose 1 10
30−#if __GLASGOW_HASKELL__ < 800
31−type Shape' = ('KProxy :: KProxy Shape)
36−genShape :: Gen (SomeSing Shape')
27+genShape :: Gen (SomeSing Shape)
38 = Gen.choice [
29 = Gen.choice [
@@ -41,20 +32,20 @@ genShape
44−genD1 :: Gen (SomeSing Shape')
35+genD1 :: Gen (SomeSing Shape)
46 n <- genNat
37 n <- genNat
47 return $ case n of
38 return $ case n of
48 SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x))
39 SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x))
50−genD2 :: Gen (SomeSing Shape')
41+genD2 :: Gen (SomeSing Shape)
52 n <- genNat
43 n <- genNat
53 m <- genNat
44 m <- genNat
54 return $ case (n, m) of
45 return $ case (n, m) of
55 (SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y))
46 (SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y))
57−genD3 :: Gen (SomeSing Shape')
48+genD3 :: Gen (SomeSing Shape)
59 n <- genNat
50 n <- genNat
60 m <- genNat
51 m <- genNat
@@ -64,7 +55,7 @@ genD3 = do
64 case natDict px %* natDict pz of
55 case natDict px %* natDict pz of
65 Dict -> SomeSing (sing :: Sing ('D3 x y z))
56 Dict -> SomeSing (sing :: Sing ('D3 x y z))
67−rss :: SomeSing Shape' -> String
58+rss :: SomeSing Shape -> String
68rss (SomeSing (r :: Sing s)) = case r of
59rss (SomeSing (r :: Sing s)) = case r of
69 (D1Sing a@SNat) -> "D1 " ++ show (natVal a)
60 (D1Sing a@SNat) -> "D1 " ++ show (natVal a)
70 (D2Sing a@SNat b@SNat) -> "D2 " ++ show (natVal a) ++ " " ++ show (natVal b)
61 (D2Sing a@SNat b@SNat) -> "D2 " ++ show (natVal a) ++ " " ++ show (natVal b)