{-# LANGUAGE
BangPatterns
, CPP
, RankNTypes
, UnicodeSyntax
#-}
module Data.Bitstream.Generic
(
Bitstream(..)
, empty
, (∅)
, singleton
, pack
, unpack
, fromBits
, fromNBits
, toBits
, stream
, unstream
, cons
, cons'
, snoc
, append
, (⧺)
, head
, last
, tail
, init
, null
, length
, map
, reverse
, foldl
, foldl'
, foldl1
, foldl1'
, foldr
, foldr1
, concat
, concatMap
, and
, or
, any
, all
, scanl
, scanl1
, scanr
, scanr1
, replicate
, unfoldr
, unfoldrN
, take
, drop
, takeWhile
, dropWhile
, span
, break
, elem
, (∈)
, (∋)
, notElem
, (∉)
, (∌)
, find
, filter
, partition
, (!!)
, elemIndex
, elemIndices
, findIndex
, findIndices
, zip
, zip3
, zip4
, zip5
, zip6
, zipWith
, zipWith3
, zipWith4
, zipWith5
, zipWith6
, unzip
, unzip3
, unzip4
, unzip5
, unzip6
)
where
import qualified Data.List as L
import Data.Bits
import Data.Bitstream.Fusion
import Data.Maybe
#if MIN_VERSION_vector(0,11,0)
import Data.Vector.Fusion.Bundle (Bundle)
import qualified Data.Vector.Fusion.Bundle as S
import qualified Data.Vector.Storable as SV
#else
import Data.Vector.Fusion.Stream (Stream)
import qualified Data.Vector.Fusion.Stream as S
#endif
import Prelude ( Bool(..), Integer, Integral(..), Num(..), Show(..), ($)
, fst, flip, otherwise, snd
)
import Prelude.Unicode hiding ((∈), (∉), (⧺))
infix 4 ∈, ∋, ∉, ∌, `elem`, `notElem`
infixr 5 ⧺, `append`
infixl 9 !!
class Bitstream α where
#if MIN_VERSION_vector(0,11,0)
basicStream ∷ α → Bundle SV.Vector Bool
basicUnstream ∷ Bundle SV.Vector Bool → α
#else
basicStream ∷ α → Stream Bool
basicUnstream ∷ Stream Bool → α
#endif
basicCons ∷ Bool → α → α
basicCons' ∷ Bool → α → α
{-# INLINE basicCons' #-}
basicCons' = basicCons
basicSnoc ∷ α → Bool → α
basicAppend ∷ α → α → α
basicTail ∷ α → α
basicInit ∷ α → α
basicMap ∷ (Bool → Bool) → α → α
basicReverse ∷ α → α
basicConcat ∷ [α] → α
{-# INLINE basicConcat #-}
basicConcat [] = (∅)
basicConcat (α:αs) = α ⧺ concat αs
basicScanl ∷ (Bool → Bool → Bool) → Bool → α → α
basicTake ∷ Integral n ⇒ n → α → α
basicDrop ∷ Integral n ⇒ n → α → α
basicTakeWhile ∷ (Bool → Bool) → α → α
basicDropWhile ∷ (Bool → Bool) → α → α
basicFilter ∷ (Bool → Bool) → α → α
basicPartition ∷ (Bool → Bool) → α → (α, α)
{-# INLINE basicPartition #-}
basicPartition f α = (filter f α, filter ((¬) ∘ f) α)
basicFromNBits ∷ (Integral n, Integral β, Bits β) ⇒ n → β → α
basicToBits ∷ (Integral β, Bits β) ⇒ α → β
empty ∷ Bitstream α ⇒ α
{-# INLINE empty #-}
empty = unstream S.empty
{-# INLINE (∅) #-}
(∅) ∷ Bitstream α ⇒ α
(∅) = empty
singleton ∷ Bitstream α ⇒ Bool → α
{-# INLINE singleton #-}
singleton = unstream ∘ S.singleton
{-# INLINE pack #-}
pack ∷ Bitstream α ⇒ [Bool] → α
pack = unstream ∘ S.fromList
unpack ∷ Bitstream α ⇒ α → [Bool]
{-# RULES "Bitstream unpack/unstream fusion"
∀s. unpack (unstream s) = S.toList s
#-}
{-# INLINE [0] unpack #-}
unpack = S.toList ∘ stream
#if MIN_VERSION_vector(0,11,0)
stream ∷ Bitstream α ⇒ α → Bundle SV.Vector Bool
#else
stream ∷ Bitstream α ⇒ α → Stream Bool
#endif
{-# NOINLINE stream #-}
stream = basicStream
#if MIN_VERSION_vector(0,11,0)
unstream ∷ Bitstream α ⇒ Bundle SV.Vector Bool → α
#else
unstream ∷ Bitstream α ⇒ Stream Bool → α
#endif
{-# NOINLINE unstream #-}
unstream = basicUnstream
{-# RULES
"Bitstream stream/unstream fusion"
∀s. stream (unstream s) = s
"Bitstream unstream/stream fusion"
∀v. unstream (stream v) = v
#-}
#if MIN_VERSION_base(4,7,0)
fromBits ∷ (Integral β, FiniteBits β, Bitstream α) ⇒ β → α
{-# INLINE fromBits #-}
fromBits β = basicFromNBits (finiteBitSize β) β
#else
fromBits ∷ (Integral β, Bits β, Bitstream α) ⇒ β → α
{-# INLINE fromBits #-}
fromBits β = basicFromNBits (bitSize β) β
#endif
fromNBits ∷ (Integral n, Integral β, Bits β, Bitstream α) ⇒ n → β → α
{-# INLINE fromNBits #-}
fromNBits = basicFromNBits
toBits ∷ (Bitstream α, Integral β, Bits β) ⇒ α → β
{-# INLINE [0] toBits #-}
toBits = basicToBits
cons ∷ Bitstream α ⇒ Bool → α → α
{-# RULES
"Bitstream cons/unstream fusion"
∀b s. cons b (unstream s) = unstream (S.cons b s)
#-}
{-# INLINE [0] cons #-}
cons = basicCons
cons' ∷ Bitstream α ⇒ Bool → α → α
{-# RULES
"Bitstream cons'/unstream fusion"
∀b s. cons' b (unstream s) = unstream (S.cons b s)
#-}
{-# INLINE [0] cons' #-}
cons' = basicCons'
snoc ∷ Bitstream α ⇒ α → Bool → α
{-# RULES
"Bitstream snoc/unstream fusion"
∀s b. snoc (unstream s) b = unstream (S.snoc s b)
#-}
{-# INLINE [0] snoc #-}
snoc = basicSnoc
append ∷ Bitstream α ⇒ α → α → α
{-# RULES
"Bitstream append/unstream fusion"
∀s1 s2. append (unstream s1) (unstream s2) = unstream (s1 S.++ s2)
#-}
{-# INLINE [0] append #-}
append = basicAppend
(⧺) ∷ Bitstream α ⇒ α → α → α
{-# INLINE (⧺) #-}
(⧺) = append
head ∷ Bitstream α ⇒ α → Bool
{-# RULES "Bitstream head/unstream fusion"
∀s. head (unstream s) = S.head s
#-}
{-# INLINE [0] head #-}
head = S.head ∘ stream
last ∷ Bitstream α ⇒ α → Bool
{-# RULES "Bitstream last/unstream fusion"
∀s. last (unstream s) = S.last s
#-}
{-# INLINE [0] last #-}
last = S.last ∘ stream
tail ∷ Bitstream α ⇒ α → α
{-# RULES
"Bitstream tail/unstream fusion"
∀s. tail (unstream s) = unstream (S.tail s)
#-}
{-# INLINE [0] tail #-}
tail = basicTail
init ∷ Bitstream α ⇒ α → α
{-# RULES
"Bitstream init/unstream fusion"
∀s. init (unstream s) = unstream (S.init s)
#-}
{-# INLINE [0] init #-}
init = basicInit
null ∷ Bitstream α ⇒ α → Bool
{-# RULES "Bitstream null/unstream fusion"
∀s. null (unstream s) = S.null s
#-}
{-# INLINE [0] null #-}
null = S.null ∘ stream
length ∷ Bitstream α ⇒ Num n ⇒ α → n
{-# RULES "Bitstream length/unstream fusion"
∀s. length (unstream s) = genericLength s
#-}
{-# INLINE [0] length #-}
length = genericLength ∘ stream
map ∷ Bitstream α ⇒ (Bool → Bool) → α → α
{-# RULES
"Bitstream map/unstream fusion"
∀f s. map f (unstream s) = unstream (S.map f s)
#-}
{-# INLINE [0] map #-}
map = basicMap
reverse ∷ Bitstream α ⇒ α → α
{-# INLINE [0] reverse #-}
reverse = basicReverse
foldl ∷ Bitstream α ⇒ (β → Bool → β) → β → α → β
{-# RULES "Bitstream foldl/unstream fusion"
∀f β s. foldl f β (unstream s) = S.foldl f β s
#-}
{-# INLINE [0] foldl #-}
foldl f β = S.foldl f β ∘ stream
foldl' ∷ Bitstream α ⇒ (β → Bool → β) → β → α → β
{-# RULES "Bitstream foldl'/unstream fusion"
∀f β s. foldl' f β (unstream s) = S.foldl' f β s
#-}
{-# INLINE [0] foldl' #-}
foldl' f β = S.foldl' f β ∘ stream
foldl1 ∷ Bitstream α ⇒ (Bool → Bool → Bool) → α → Bool
{-# RULES "Bitstream foldl1/unstream fusion"
∀f s. foldl1 f (unstream s) = S.foldl1 f s
#-}
{-# INLINE [0] foldl1 #-}
foldl1 f = S.foldl1 f ∘ stream
foldl1' ∷ Bitstream α ⇒ (Bool → Bool → Bool) → α → Bool
{-# RULES "Bitstream foldl1'/unstream fusion"
∀f s. foldl1' f (unstream s) = S.foldl1' f s
#-}
{-# INLINE [0] foldl1' #-}
foldl1' f = S.foldl1' f ∘ stream
foldr ∷ Bitstream α ⇒ (Bool → β → β) → β → α → β
{-# RULES "Bitstream foldr/unstream fusion"
∀f β s. foldr f β (unstream s) = S.foldr f β s
#-}
{-# INLINE [0] foldr #-}
foldr f β = S.foldr f β ∘ stream
foldr1 ∷ Bitstream α ⇒ (Bool → Bool → Bool) → α → Bool
{-# RULES "Bitstream foldr1/unstream fusion"
∀f s. foldr1 f (unstream s) = S.foldr1 f s
#-}
{-# INLINE [0] foldr1 #-}
foldr1 f = S.foldr1 f ∘ stream
concat ∷ Bitstream α ⇒ [α] → α
{-# INLINE [0] concat #-}
concat = basicConcat
concatMap ∷ Bitstream α ⇒ (Bool → α) → α → α
{-# RULES "Bitstream concatMap/unstream fusion"
∀f s. concatMap f (unstream s) = unstream (S.concatMap f s)
#-}
{-# INLINE [0] concatMap #-}
concatMap f = concat ∘ L.map f ∘ unpack
and ∷ Bitstream α ⇒ α → Bool
{-# RULES "Bitstream and/unstream fusion"
∀s. and (unstream s) = S.and s
#-}
{-# INLINE [0] and #-}
and = S.and ∘ stream
or ∷ Bitstream α ⇒ α → Bool
{-# RULES "Bitstream or/unstream fusion"
∀s. or (unstream s) = S.or s
#-}
{-# INLINE [0] or #-}
or = S.or ∘ stream
any ∷ Bitstream α ⇒ (Bool → Bool) → α → Bool
{-# RULES "Bitstream any/unstream fusion"
∀f s. any f (unstream s) = S.or (S.map f s)
#-}
{-# INLINE [0] any #-}
any f = S.or ∘ S.map f ∘ stream
all ∷ Bitstream α ⇒ (Bool → Bool) → α → Bool
{-# RULES "Bitstream all/unstream fusion"
∀f s. all f (unstream s) = S.and (S.map f s)
#-}
{-# INLINE [0] all #-}
all f = S.and ∘ S.map f ∘ stream
scanl ∷ Bitstream α ⇒ (Bool → Bool → Bool) → Bool → α → α
{-# RULES
"Bitstream scanl/unstream fusion"
∀f b s. scanl f b (unstream s) = unstream (S.scanl f b s)
#-}
{-# INLINE [0] scanl #-}
scanl = basicScanl
scanl1 ∷ Bitstream α ⇒ (Bool → Bool → Bool) → α → α
{-# INLINE [0] scanl1 #-}
scanl1 f α
| null α = α
| otherwise = scanl f (head α) (tail α)
scanr ∷ Bitstream α ⇒ (Bool → Bool → Bool) → Bool → α → α
{-# INLINE [0] scanr #-}
scanr f b = reverse ∘ scanl (flip f) b ∘ reverse
scanr1 ∷ Bitstream α ⇒ (Bool → Bool → Bool) → α → α
{-# INLINE [0] scanr1 #-}
scanr1 f = reverse ∘ scanl1 (flip f) ∘ reverse
replicate ∷ (Integral n, Bitstream α) ⇒ n → Bool → α
{-# INLINE replicate #-}
replicate n = unstream ∘ genericReplicate n
unfoldr ∷ Bitstream α ⇒ (β → Maybe (Bool, β)) → β → α
{-# INLINE unfoldr #-}
unfoldr f = unstream ∘ S.unfoldr f
unfoldrN ∷ (Integral n, Bitstream α) ⇒ n → (β → Maybe (Bool, β)) → β → α
{-# INLINE unfoldrN #-}
unfoldrN n f = unstream ∘ genericUnfoldrN n f
take ∷ (Integral n, Bitstream α) ⇒ n → α → α
{-# RULES
"Bitstream take/unstream fusion"
∀n s. take n (unstream s) = unstream (genericTake n s)
#-}
{-# INLINE [0] take #-}
take = basicTake
drop ∷ (Integral n, Bitstream α) ⇒ n → α → α
{-# RULES
"Bitstream drop/unstream fusion"
∀n s. drop n (unstream s) = unstream (genericDrop n s)
#-}
{-# INLINE [0] drop #-}
drop = basicDrop
takeWhile ∷ Bitstream α ⇒ (Bool → Bool) → α → α
{-# RULES
"Bitstream takeWhile/unstream fusion"
∀f s. takeWhile f (unstream s) = unstream (S.takeWhile f s)
#-}
{-# INLINE [0] takeWhile #-}
takeWhile = basicTakeWhile
dropWhile ∷ Bitstream α ⇒ (Bool → Bool) → α → α
{-# RULES
"Bitstream dropWhile/unstream fusion"
∀f s. dropWhile f (unstream s) = unstream (S.dropWhile f s)
#-}
{-# INLINE [0] dropWhile #-}
dropWhile = basicDropWhile
span ∷ Bitstream α ⇒ (Bool → Bool) → α → (α, α)
{-# INLINE span #-}
span f α
= let hd = takeWhile f α
tl = drop (length hd ∷ Integer) α
in
(hd, tl)
break ∷ Bitstream α ⇒ (Bool → Bool) → α → (α, α)
{-# INLINE break #-}
break f = span ((¬) ∘ f)
elem ∷ Bitstream α ⇒ Bool → α → Bool
{-# RULES "Bitstream elem/unstream fusion"
∀b s. elem b (unstream s) = S.elem b s
#-}
{-# INLINE [0] elem #-}
elem True = or
elem False = (¬) ∘ and
(∈) ∷ Bitstream α ⇒ Bool → α → Bool
{-# INLINE (∈) #-}
(∈) = elem
(∋) ∷ Bitstream α ⇒ α → Bool → Bool
{-# INLINE (∋) #-}
(∋) = flip elem
notElem ∷ Bitstream α ⇒ Bool → α → Bool
{-# RULES "Bitstream notElem/unstream fusion"
∀b s. notElem b (unstream s) = S.notElem b s
#-}
{-# INLINE [0] notElem #-}
notElem = ((¬) ∘) ∘ (∈)
(∉) ∷ Bitstream α ⇒ Bool → α → Bool
{-# INLINE (∉) #-}
(∉) = notElem
(∌) ∷ Bitstream α ⇒ α → Bool → Bool
(∌) = flip notElem
{-# INLINE (∌) #-}
find ∷ Bitstream α ⇒ (Bool → Bool) → α → Maybe Bool
{-# RULES "Bitstream find/unstream fusion"
∀f s. find f (unstream s) = S.find f s
#-}
{-# INLINE [0] find #-}
find f = S.find f ∘ stream
filter ∷ Bitstream α ⇒ (Bool → Bool) → α → α
{-# RULES
"Bitstream filter/unstream fusion"
∀f s. filter f (unstream s) = unstream (S.filter f s)
#-}
{-# INLINE [0] filter #-}
filter = basicFilter
partition ∷ Bitstream α ⇒ (Bool → Bool) → α → (α, α)
{-# INLINE [0] partition #-}
partition = basicPartition
(!!) ∷ (Bitstream α, Integral n, Show n) ⇒ α → n → Bool
{-# RULES "Bitstream (!!)/unstream fusion"
∀s n. (unstream s) !! n = genericIndex s n
#-}
{-# INLINE [0] (!!) #-}
α !! n = genericIndex (stream α) n
elemIndex ∷ (Bitstream α, Integral n) ⇒ Bool → α → Maybe n
{-# RULES "Bitstream elemIndex/unstream fusion"
∀b s. elemIndex b (unstream s) = genericFindIndex (≡ b) s
#-}
{-# INLINE [0] elemIndex #-}
elemIndex = findIndex ∘ (≡)
elemIndices ∷ (Bitstream α, Integral n) ⇒ Bool → α → [n]
{-# RULES "Bitstream elemIndices/unstream fusion"
∀b s. elemIndices b (unstream s)
= S.toList
$ S.map fst
$ S.filter ((≡ b) ∘ snd)
$ genericIndexed s
#-}
{-# INLINE [0] elemIndices #-}
elemIndices = findIndices ∘ (≡)
findIndex ∷ (Bitstream α, Integral n) ⇒ (Bool → Bool) → α → Maybe n
{-# RULES "Bitstream findIndex/unstream fusion"
∀f s. findIndex f (unstream s) = genericFindIndex f s
#-}
{-# INLINE [0] findIndex #-}
findIndex f = genericFindIndex f ∘ stream
findIndices ∷ (Bitstream α, Integral n) ⇒ (Bool → Bool) → α → [n]
{-# RULES "Bitstream findIndices/unstream fusion"
∀f s. findIndices f (unstream s)
= S.toList
$ S.map fst
$ S.filter (f ∘ snd)
$ genericIndexed s
#-}
{-# INLINE [0] findIndices #-}
findIndices f
= S.toList
∘ S.map fst
∘ S.filter (f ∘ snd)
∘ genericIndexed
∘ stream
zip ∷ Bitstream α ⇒ α → α → [(Bool, Bool)]
{-# RULES "Bitstream zip/unstream fusion" ∀s1 s2.
zip (unstream s1) (unstream s2)
= S.toList (S.zip s1 s2)
#-}
{-# INLINE [0] zip #-}
zip = zipWith (,)
zip3 ∷ Bitstream α ⇒ α → α → α → [(Bool, Bool, Bool)]
{-# RULES "Bitstream zip3/unstream fusion" ∀s1 s2 s3.
zip3 (unstream s1) (unstream s2) (unstream s3)
= S.toList (S.zip3 s1 s2 s3)
#-}
{-# INLINE [0] zip3 #-}
zip3 = zipWith3 (,,)
zip4 ∷ Bitstream α ⇒ α → α → α → α → [(Bool, Bool, Bool, Bool)]
{-# RULES "Bitstream zip4/unstream fusion" ∀s1 s2 s3 s4.
zip4 (unstream s1) (unstream s2) (unstream s3) (unstream s4)
= S.toList (S.zip4 s1 s2 s3 s4)
#-}
{-# INLINE [0] zip4 #-}
zip4 = zipWith4 (,,,)
zip5 ∷ Bitstream α ⇒ α → α → α → α → α → [(Bool, Bool, Bool, Bool, Bool)]
{-# RULES "Bitstream zip5/unstream fusion" ∀s1 s2 s3 s4 s5.
zip5 (unstream s1) (unstream s2) (unstream s3) (unstream s4) (unstream s5)
= S.toList (S.zip5 s1 s2 s3 s4 s5)
#-}
{-# INLINE [0] zip5 #-}
zip5 = zipWith5 (,,,,)
zip6 ∷ Bitstream α ⇒ α → α → α → α → α → α → [(Bool, Bool, Bool, Bool, Bool, Bool)]
{-# RULES "Bitstream zip6/unstream fusion" ∀s1 s2 s3 s4 s5 s6.
zip6 (unstream s1) (unstream s2) (unstream s3) (unstream s4) (unstream s5) (unstream s6)
= S.toList (S.zip6 s1 s2 s3 s4 s5 s6)
#-}
{-# INLINE [0] zip6 #-}
zip6 = zipWith6 (,,,,,)
zipWith ∷ Bitstream α ⇒ (Bool → Bool → β) → α → α → [β]
{-# RULES "Bitstream zipWith/unstream fusion" ∀f s1 s2.
zipWith f (unstream s1) (unstream s2)
= S.toList (S.zipWith f s1 s2)
#-}
{-# INLINEABLE [0] zipWith #-}
zipWith f α β = S.toList $
S.zipWith f
(stream α)
(stream β)
zipWith3 ∷ Bitstream α ⇒ (Bool → Bool → Bool → β) → α → α → α → [β]
{-# RULES "Bitstream zipWith3/unstream fusion" ∀f s1 s2 s3.
zipWith3 f (unstream s1) (unstream s2) (unstream s3)
= S.toList (S.zipWith3 f s1 s2 s3)
#-}
{-# INLINEABLE [0] zipWith3 #-}
zipWith3 f α β γ = S.toList $
S.zipWith3 f
(stream α)
(stream β)
(stream γ)
zipWith4 ∷ Bitstream α ⇒ (Bool → Bool → Bool → Bool → β) → α → α → α → α → [β]
{-# RULES "Bitstream zipWith4/unstream fusion" ∀f s1 s2 s3 s4.
zipWith4 f (unstream s1) (unstream s2) (unstream s3) (unstream s4)
= S.toList (S.zipWith4 f s1 s2 s3 s4)
#-}
{-# INLINEABLE [0] zipWith4 #-}
zipWith4 f α β γ δ = S.toList $
S.zipWith4 f
(stream α)
(stream β)
(stream γ)
(stream δ)
zipWith5 ∷ Bitstream α ⇒ (Bool → Bool → Bool → Bool → Bool → β) → α → α → α → α → α → [β]
{-# RULES "Bitstream zipWith5/unstream fusion" ∀f s1 s2 s3 s4 s5.
zipWith5 f (unstream s1) (unstream s2) (unstream s3) (unstream s4) (unstream s5)
= S.toList (S.zipWith5 f s1 s2 s3 s4 s5)
#-}
{-# INLINEABLE [0] zipWith5 #-}
zipWith5 f α β γ δ ε = S.toList $
S.zipWith5 f
(stream α)
(stream β)
(stream γ)
(stream δ)
(stream ε)
zipWith6 ∷ Bitstream α ⇒ (Bool → Bool → Bool → Bool → Bool → Bool → β) → α → α → α → α → α → α → [β]
{-# RULES "Bitstream zipWith6/unstream fusion" ∀f s1 s2 s3 s4 s5 s6.
zipWith6 f (unstream s1) (unstream s2) (unstream s3) (unstream s4) (unstream s5) (unstream s6)
= S.toList (S.zipWith6 f s1 s2 s3 s4 s5 s6)
#-}
{-# INLINEABLE [0] zipWith6 #-}
zipWith6 f α β γ δ ε ζ = S.toList $
S.zipWith6 f
(stream α)
(stream β)
(stream γ)
(stream δ)
(stream ε)
(stream ζ)
unzip ∷ Bitstream α ⇒ [(Bool, Bool)] → (α, α)
{-# INLINEABLE unzip #-}
unzip xs = ( unstream $ S.map fst $ S.fromList xs
, unstream $ S.map snd $ S.fromList xs )
unzip3 ∷ Bitstream α ⇒ [(Bool, Bool, Bool)] → (α, α, α)
{-# INLINEABLE unzip3 #-}
unzip3 xs = ( unstream $ S.map (\(α, _, _) → α) $ S.fromList xs
, unstream $ S.map (\(_, β, _) → β) $ S.fromList xs
, unstream $ S.map (\(_, _, γ) → γ) $ S.fromList xs )
unzip4 ∷ Bitstream α ⇒ [(Bool, Bool, Bool, Bool)] → (α, α, α, α)
{-# INLINEABLE unzip4 #-}
unzip4 xs = ( unstream $ S.map (\(α, _, _, _) → α) $ S.fromList xs
, unstream $ S.map (\(_, β, _, _) → β) $ S.fromList xs
, unstream $ S.map (\(_, _, γ, _) → γ) $ S.fromList xs
, unstream $ S.map (\(_, _, _, δ) → δ) $ S.fromList xs )
unzip5 ∷ Bitstream α ⇒ [(Bool, Bool, Bool, Bool, Bool)] → (α, α, α, α, α)
{-# INLINEABLE unzip5 #-}
unzip5 xs = ( unstream $ S.map (\(α, _, _, _, _) → α) $ S.fromList xs
, unstream $ S.map (\(_, β, _, _, _) → β) $ S.fromList xs
, unstream $ S.map (\(_, _, γ, _, _) → γ) $ S.fromList xs
, unstream $ S.map (\(_, _, _, δ, _) → δ) $ S.fromList xs
, unstream $ S.map (\(_, _, _, _, ε) → ε) $ S.fromList xs )
unzip6 ∷ Bitstream α ⇒ [(Bool, Bool, Bool, Bool, Bool, Bool)] → (α, α, α, α, α, α)
{-# INLINEABLE unzip6 #-}
unzip6 xs = ( unstream $ S.map (\(α, _, _, _, _, _) → α) $ S.fromList xs
, unstream $ S.map (\(_, β, _, _, _, _) → β) $ S.fromList xs
, unstream $ S.map (\(_, _, γ, _, _, _) → γ) $ S.fromList xs
, unstream $ S.map (\(_, _, _, δ, _, _) → δ) $ S.fromList xs
, unstream $ S.map (\(_, _, _, _, ε, _) → ε) $ S.fromList xs
, unstream $ S.map (\(_, _, _, _, _, ζ) → ζ) $ S.fromList xs )