git.iko.soy/typeable/generic-arbitrary
on warnings help sign in
typeable/generic-arbitrary/test/NoTypecheckTest.hs
23 lines 682 B history raw
1{-# OPTIONS_GHC -fdefer-type-errors #-}
2{-# OPTIONS_GHC -Wno-deferred-type-errors #-}
4-- | Test that infinite types has no Arbitrary instance
6module NoTypecheckTest where
8import Auxiliary
9import GHC.Generics (Generic)
10import Test.QuickCheck
11import Test.QuickCheck.Arbitrary.Generic
13-- | Recursive infinite type which can not have valid Arbitrary instance
14data R = R R
15 deriving (Eq, Show, Generic)
17-- | Instance which must not compile, but we are using deferred type errors
18instance Arbitrary R where
19 arbitrary = genericArbitrary
20 shrink = genericShrink
22unit_mustFail :: IO ()
23unit_mustFail = failGeneration @R