{-# OPTIONS_GHC -fno-warn-orphans #-}
module Thrift.Arbitraries where
import Data.Bits()
import Test.QuickCheck.Arbitrary
import Control.Applicative ((<$>))
import Data.Map (Map)
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Data.Vector as Vector
import qualified Data.Text.Lazy as Text
import qualified Data.HashSet as HSet
import qualified Data.HashMap.Strict as HMap
import Data.Hashable (Hashable)
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as BS
instance Arbitrary ByteString where
arbitrary = BS.pack . filter (/= 0) <$> arbitrary
instance (Arbitrary k) => Arbitrary (Vector.Vector k) where
arbitrary = Vector.fromList <$> arbitrary
instance Arbitrary Text.Text where
arbitrary = Text.pack . filter (/= '\0') <$> arbitrary
instance (Eq k, Hashable k, Arbitrary k) => Arbitrary (HSet.HashSet k) where
arbitrary = HSet.fromList <$> arbitrary
instance (Eq k, Hashable k, Arbitrary k, Arbitrary v) =>
Arbitrary (HMap.HashMap k v) where
arbitrary = HMap.fromList <$> arbitrary