{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
#endif
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Test.QuickCheck.Instances.Tagged () where
import Prelude ()
import Test.QuickCheck.Instances.CustomPrelude
import Data.Proxy (Proxy (Proxy))
import Test.QuickCheck
import qualified Data.Tagged as Tagged (Tagged (..))
instance Arbitrary2 Tagged.Tagged where
liftArbitrary2 :: Gen a -> Gen b -> Gen (Tagged a b)
liftArbitrary2 Gen a
_ Gen b
arb = b -> Tagged a b
forall k (s :: k) b. b -> Tagged s b
Tagged.Tagged (b -> Tagged a b) -> Gen b -> Gen (Tagged a b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen b
arb
liftShrink2 :: (a -> [a]) -> (b -> [b]) -> Tagged a b -> [Tagged a b]
liftShrink2 a -> [a]
_ b -> [b]
shr = (b -> Tagged a b) -> [b] -> [Tagged a b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap b -> Tagged a b
forall k (s :: k) b. b -> Tagged s b
Tagged.Tagged ([b] -> [Tagged a b])
-> (Tagged a b -> [b]) -> Tagged a b -> [Tagged a b]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> [b]
shr (b -> [b]) -> (Tagged a b -> b) -> Tagged a b -> [b]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tagged a b -> b
forall k (s :: k) b. Tagged s b -> b
Tagged.unTagged
instance Arbitrary1 (Tagged.Tagged a) where
liftArbitrary :: Gen a -> Gen (Tagged a a)
liftArbitrary Gen a
arb = a -> Tagged a a
forall k (s :: k) b. b -> Tagged s b
Tagged.Tagged (a -> Tagged a a) -> Gen a -> Gen (Tagged a a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen a
arb
liftShrink :: (a -> [a]) -> Tagged a a -> [Tagged a a]
liftShrink a -> [a]
shr = (a -> Tagged a a) -> [a] -> [Tagged a a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> Tagged a a
forall k (s :: k) b. b -> Tagged s b
Tagged.Tagged ([a] -> [Tagged a a])
-> (Tagged a a -> [a]) -> Tagged a a -> [Tagged a a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> [a]
shr (a -> [a]) -> (Tagged a a -> a) -> Tagged a a -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tagged a a -> a
forall k (s :: k) b. Tagged s b -> b
Tagged.unTagged
instance Arbitrary b => Arbitrary (Tagged.Tagged a b) where
arbitrary :: Gen (Tagged a b)
arbitrary = Gen (Tagged a b)
forall (f :: * -> *) a. (Arbitrary1 f, Arbitrary a) => Gen (f a)
arbitrary1
shrink :: Tagged a b -> [Tagged a b]
shrink = Tagged a b -> [Tagged a b]
forall (f :: * -> *) a. (Arbitrary1 f, Arbitrary a) => f a -> [f a]
shrink1
instance CoArbitrary b => CoArbitrary (Tagged.Tagged a b) where
coarbitrary :: Tagged a b -> Gen b -> Gen b
coarbitrary = b -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
coarbitrary (b -> Gen b -> Gen b)
-> (Tagged a b -> b) -> Tagged a b -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tagged a b -> b
forall k (s :: k) b. Tagged s b -> b
Tagged.unTagged
instance Function b => Function (Tagged.Tagged a b) where
function :: (Tagged a b -> b) -> Tagged a b :-> b
function = (Tagged a b -> b)
-> (b -> Tagged a b) -> (Tagged a b -> b) -> Tagged a b :-> b
forall b a c.
Function b =>
(a -> b) -> (b -> a) -> (a -> c) -> a :-> c
functionMap Tagged a b -> b
forall k (s :: k) b. Tagged s b -> b
Tagged.unTagged b -> Tagged a b
forall k (s :: k) b. b -> Tagged s b
Tagged.Tagged
instance Arbitrary1 Proxy where
liftArbitrary :: Gen a -> Gen (Proxy a)
liftArbitrary Gen a
_ = Proxy a -> Gen (Proxy a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Proxy a
forall k (t :: k). Proxy t
Proxy
liftShrink :: (a -> [a]) -> Proxy a -> [Proxy a]
liftShrink a -> [a]
_ Proxy a
_ = []
instance Arbitrary (Proxy a) where
arbitrary :: Gen (Proxy a)
arbitrary = Proxy a -> Gen (Proxy a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Proxy a
forall k (t :: k). Proxy t
Proxy
shrink :: Proxy a -> [Proxy a]
shrink Proxy a
_ = []
instance CoArbitrary (Proxy a) where
coarbitrary :: Proxy a -> Gen b -> Gen b
coarbitrary Proxy a
_ = Gen b -> Gen b
forall a. a -> a
id
instance Function (Proxy a) where
function :: (Proxy a -> b) -> Proxy a :-> b
function = (Proxy a -> ())
-> (() -> Proxy a) -> (Proxy a -> b) -> Proxy a :-> b
forall b a c.
Function b =>
(a -> b) -> (b -> a) -> (a -> c) -> a :-> c
functionMap (() -> Proxy a -> ()
forall a b. a -> b -> a
const ()) (Proxy a -> () -> Proxy a
forall a b. a -> b -> a
const Proxy a
forall k (t :: k). Proxy t
Proxy)