    {-# OPTIONS_GHC -fno-warn-orphans #-}

    module Data.GenValidity.IntMap
      ( genIntMapOf,
        shrinkIntMapOf,
      )
    where

    import Data.GenValidity
    import Data.IntMap (IntMap)
    import qualified Data.IntMap as M
    import Data.Validity.IntMap ()
    import Test.QuickCheck

    instance (GenValid v) => GenValid (IntMap v) where
      genValid :: Gen (IntMap v)
    genValid = Gen (Int, v) -> Gen (IntMap v)
    forall v. Gen (Int, v) -> Gen (IntMap v)
    genIntMapOf Gen (Int, v)
    forall a. GenValid a => Gen a
    genValid
      shrinkValid :: IntMap v -> [IntMap v]
    shrinkValid = ((Int, v) -> [(Int, v)]) -> IntMap v -> [IntMap v]
    forall v. ((Int, v) -> [(Int, v)]) -> IntMap v -> [IntMap v]
    shrinkIntMapOf (Int, v) -> [(Int, v)]
    forall a. GenValid a => a -> [a]
    shrinkValid

    genIntMapOf :: Gen (Int, v) -> Gen (IntMap v)
    genIntMapOf :: forall v. Gen (Int, v) -> Gen (IntMap v)
    genIntMapOf Gen (Int, v)
    g = [(Int, v)] -> IntMap v
    forall a. [(Int, a)] -> IntMap a
    M.fromList ([(Int, v)] -> IntMap v) -> Gen [(Int, v)] -> Gen (IntMap v)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen (Int, v) -> Gen [(Int, v)]
    forall a. Gen a -> Gen [a]
    genListOf Gen (Int, v)
    g

    shrinkIntMapOf :: ((Int, v) -> [(Int, v)]) -> IntMap v -> [IntMap v]
    shrinkIntMapOf :: forall v. ((Int, v) -> [(Int, v)]) -> IntMap v -> [IntMap v]
    shrinkIntMapOf (Int, v) -> [(Int, v)]
    shrinker = ([(Int, v)] -> IntMap v) -> [[(Int, v)]] -> [IntMap v]
    forall a b. (a -> b) -> [a] -> [b]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [(Int, v)] -> IntMap v
    forall a. [(Int, a)] -> IntMap a
    M.fromList ([[(Int, v)]] -> [IntMap v])
    -> (IntMap v -> [[(Int, v)]]) -> IntMap v -> [IntMap v]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((Int, v) -> [(Int, v)]) -> [(Int, v)] -> [[(Int, v)]]
    forall a. (a -> [a]) -> [a] -> [[a]]
    shrinkList (Int, v) -> [(Int, v)]
    shrinker ([(Int, v)] -> [[(Int, v)]])
    -> (IntMap v -> [(Int, v)]) -> IntMap v -> [[(Int, v)]]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntMap v -> [(Int, v)]
    forall a. IntMap a -> [(Int, a)]
    M.toList