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

    module Data.GenValidity.Sequence
      ( genSeqOf,
        shrinkSeqOf,
      )
    where

    import Data.Foldable (toList)
    import Data.GenValidity
    import Data.Sequence (Seq)
    import qualified Data.Sequence as S
    import Data.Validity.Sequence ()
    import Test.QuickCheck

    instance (GenValid v) => GenValid (Seq v) where
      genValid :: Gen (Seq v)
    genValid = Gen v -> Gen (Seq v)
    forall v. Gen v -> Gen (Seq v)
    genSeqOf Gen v
    forall a. GenValid a => Gen a
    genValid
      shrinkValid :: Seq v -> [Seq v]
    shrinkValid = (v -> [v]) -> Seq v -> [Seq v]
    forall v. (v -> [v]) -> Seq v -> [Seq v]
    shrinkSeqOf v -> [v]
    forall a. GenValid a => a -> [a]
    shrinkValid

    genSeqOf :: Gen v -> Gen (Seq v)
    genSeqOf :: forall v. Gen v -> Gen (Seq v)
    genSeqOf Gen v
    g = [v] -> Seq v
    forall a. [a] -> Seq a
    S.fromList ([v] -> Seq v) -> Gen [v] -> Gen (Seq v)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Gen v -> Gen [v]
    forall a. Gen a -> Gen [a]
    genListOf Gen v
    g

    shrinkSeqOf :: (v -> [v]) -> Seq v -> [Seq v]
    shrinkSeqOf :: forall v. (v -> [v]) -> Seq v -> [Seq v]
    shrinkSeqOf v -> [v]
    shrinker = ([v] -> Seq v) -> [[v]] -> [Seq v]
    forall a b. (a -> b) -> [a] -> [b]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [v] -> Seq v
    forall a. [a] -> Seq a
    S.fromList ([[v]] -> [Seq v]) -> (Seq v -> [[v]]) -> Seq v -> [Seq v]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (v -> [v]) -> [v] -> [[v]]
    forall a. (a -> [a]) -> [a] -> [[a]]
    shrinkList v -> [v]
    shrinker ([v] -> [[v]]) -> (Seq v -> [v]) -> Seq v -> [[v]]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Seq v -> [v]
    forall a. Seq a -> [a]
    forall (t :: * -> *) a. Foldable t => t a -> [a]
    toList