Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Following the convention from Data.ByteString, this module is intended to be
imported qualified
. For example:
import qualified Test.SmallCheck.Series.ByteString as B.Series
- aaa :: Series m ByteString
- zzz :: Series m ByteString
- replicated :: Word8 -> Series m ByteString
- ascii :: Series m ByteString
- alpha :: Series m ByteString
- enumerated :: [Word8] -> Series m ByteString
- jack :: Series m ByteString
Replication
aaa :: Series m ByteString Source
Create a ByteString
Series
growing with an extra
byte representing the a
Char
in ASCII
.
>>>
list 4 aaa
["","a","aa","aaa","aaaa"]
Use this when you don't care about the byte inside ByteString
.
zzz :: Series m ByteString Source
Create a ByteString
Series
growing with an extra NUL
byte.
>>>
list 4 zzz
["","\NUL","\NUL\NUL","\NUL\NUL\NUL","\NUL\NUL\NUL\NUL"]
replicated :: Word8 -> Series m ByteString Source
Create a ByteString
Series
growing with an extra custom byte.
>>>
list 4 . replicated . fromIntegral $ ord '@'
["","@","@@","@@@","@@@@"]
Enumeration
ascii :: Series m ByteString Source
Create a ByteString
Series
growing by counting bytes.
>>>
list 4 ascii
["","\NUL","\NUL\SOH","\NUL\SOH\STX","\NUL\SOH\STX\ETX"]
alpha :: Series m ByteString Source
Create a ByteString
Series
growing with the ASCII
representation of the alphabet.
>>>
list 4 alpha
["","a","ab","abc","abcd"]
enumerated :: [Word8] -> Series m ByteString Source
Create a ByteString
Series
growing with the given byte set.
>>>
list 4 . enumerated $ fromIntegral . ord <$> "abc"
["","a","ab","abc","abc"]
Printing
jack :: Series m ByteString Source
Create a ByteString
Series
with a dummy ASCII
sentence.
This can be used when you want to print a Series
to the screen.
>>>
let s = list 20 jack
>>>
take 3 s
["","All","All work"]>>>
s !! 10
"All work and no play makes Jack a dull boy"