@@ -0,0 +1,25 @@
1+{-# OPTIONS_GHC -fdefer-type-errors #-}
2+
3+-- | Test that infinite types has no Arbitrary instance
4+
5+module NoTypecheckTest where
6+
7+import Control.Exception
8+import GHC.Generics (Generic)
9+import Test.QuickCheck
10+import Test.QuickCheck.Arbitrary.Generic
11+
12+
13+data R = R R
14+ deriving (Eq, Show, Generic)
15+
16+-- | Instance which must not be valid
17+instance Arbitrary R where
18+ arbitrary = genericArbitrary
19+ shrink = genericShrink
20+
21+unit_mustFail :: IO ()
22+unit_mustFail = do
23+ try (generate (arbitrary :: Gen R) >>= print) >>= \case
24+ Left (_ :: SomeException) -> pure ()
25+ Right _ -> error "Error expected"