-- |
-- Module      : Test.LeanCheck.Instances.ByteString
-- Copyright   : (c) 2018-2022 Rudy Matela
-- License     : 3-Clause BSD  (see the file LICENSE)
-- Maintainer  : Rudy Matela <rudy@matela.com.br>
--
-- Instances of 'Listable' for 'ByteString'.
module Test.LeanCheck.Instances.ByteString () where

import Test.LeanCheck
import Data.ByteString.Lazy as Lazy
import Data.ByteString as Strict
import Data.Word

tiersBytes :: [[ Word8 ]]
tiersBytes :: [[Word8]]
tiersBytes = forall a. [a] -> [[a]]
toTiers forall a b. (a -> b) -> a -> b
$ [Word8
0..Word8
127] forall a. [a] -> [a] -> [a]
+| [Word8
255,Word8
254..Word8
128]

tiersListBytes :: [[ [Word8] ]]
tiersListBytes :: [[[Word8]]]
tiersListBytes = forall a. [[a]] -> [[[a]]]
listsOf [[Word8]]
tiersBytes

instance Listable Lazy.ByteString where
  tiers :: [[ByteString]]
tiers = forall a b. (a -> b) -> [[a]] -> [[b]]
mapT [Word8] -> ByteString
Lazy.pack [[[Word8]]]
tiersListBytes

instance Listable Strict.ByteString where
  tiers :: [[ByteString]]
tiers = forall a b. (a -> b) -> [[a]] -> [[b]]
mapT [Word8] -> ByteString
Strict.pack [[[Word8]]]
tiersListBytes