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

module Data.GenValidity.Map
( genMapOf,
shrinkMapOf,
)
where

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

instance (Show k, Ord k, GenValid k, GenValid v) => GenValid (Map k v) where
genValid :: Gen (Map k v)
genValid = forall k v. Ord k => Gen (k, v) -> Gen (Map k v)
genMapOf forall a. GenValid a => Gen a
genValid
shrinkValid :: Map k v -> [Map k v]
shrinkValid = forall k v. Ord k => ((k, v) -> [(k, v)]) -> Map k v -> [Map k v]
shrinkMapOf forall a. GenValid a => a -> [a]
shrinkValid

genMapOf :: Ord k => Gen (k, v) -> Gen (Map k v)
genMapOf :: forall k v. Ord k => Gen (k, v) -> Gen (Map k v)
genMapOf Gen (k, v)
g = forall k a. Ord k => [(k, a)] -> Map k a
M.fromList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<\$> forall a. Gen a -> Gen [a]
genListOf Gen (k, v)
g

shrinkMapOf :: Ord k => ((k, v) -> [(k, v)]) -> Map k v -> [Map k v]
shrinkMapOf :: forall k v. Ord k => ((k, v) -> [(k, v)]) -> Map k v -> [Map k v]
shrinkMapOf (k, v) -> [(k, v)]
shrinker = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall k a. Ord k => [(k, a)] -> Map k a
M.fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> [a]) -> [a] -> [[a]]
shrinkList (k, v) -> [(k, v)]
shrinker forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. Map k a -> [(k, a)]
M.toList
```