@@ -0,0 +1,30 @@
1+{-# LANGUAGE NumDecimals #-}
2+{-# LANGUAGE DerivingStrategies #-}
3+{-# LANGUAGE DerivingVia #-}
4+{-# LANGUAGE DeriveAnyClass #-}
5+
6+module LimitationDemo where
7+
8+import Control.DeepSeq
9+import GHC.Generics (Generic)
10+import Test.QuickCheck
11+import Test.QuickCheck.Arbitrary.Generic
12+
13+-- As you can see, we have this instance generated, but it will definitely lead
14+-- to generating an infinite term (and the only term). The recursion detection
15+-- doesn't work here
16+data R1 = R1 R2
17+ deriving (Eq, Ord, Show, Generic)
18+ deriving anyclass NFData
19+ deriving Arbitrary via (GenericArbitrary R1)
20+
21+data R2 = R2 R1
22+ deriving (Eq, Ord, Show, Generic)
23+ deriving anyclass NFData
24+ deriving Arbitrary via (GenericArbitrary R2)
25+
26+-- To force the instance realy be generated
27+usage :: IO ()
28+usage = do
29+ r1 :: R1 <- generate arbitrary
30+ print r1 -- haha