{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
module Data.Vector.Fusion.Bundle (
Step(..), Chunk(..), Bundle, MBundle,
inplace,
size, sized,
length, null,
empty, singleton, cons, snoc, replicate, generate, (++),
head, last, (!!), (!?),
slice, init, tail, take, drop,
map, concatMap, flatten, unbox,
indexed, indexedR,
zipWith, zipWith3, zipWith4, zipWith5, zipWith6,
zip, zip3, zip4, zip5, zip6,
filter, takeWhile, dropWhile,
elem, notElem, find, findIndex,
foldl, foldl1, foldl', foldl1', foldr, foldr1,
and, or,
unfoldr, unfoldrN, unfoldrExactN, iterateN,
prescanl, prescanl',
postscanl, postscanl',
scanl, scanl',
scanl1, scanl1',
enumFromStepN, enumFromTo, enumFromThenTo,
toList, fromList, fromListN, unsafeFromList, lift,
fromVector, reVector, fromVectors, concatVectors,
mapM, mapM_, zipWithM, zipWithM_, filterM, mapMaybeM, foldM, fold1M, foldM', fold1M',
eq, cmp, eqBy, cmpBy
) where
import Data.Vector.Generic.Base ( Vector )
import Data.Vector.Fusion.Bundle.Size
import Data.Vector.Fusion.Util
import Data.Vector.Fusion.Stream.Monadic ( Stream(..), Step(..) )
import Data.Vector.Fusion.Bundle.Monadic ( Chunk(..), lift )
import qualified Data.Vector.Fusion.Bundle.Monadic as M
import qualified Data.Vector.Fusion.Stream.Monadic as S
import Prelude
( Eq, Ord, Num, Enum, Monad, Bool, Ordering, Int, Maybe
, compare, return, seq
, (==), (.) )
import Data.Functor.Classes (Eq1 (..), Ord1 (..))
import GHC.Base ( build )
#define NOT_VECTOR_MODULE
#include "vector.h"
type Bundle = M.Bundle Id
type MBundle = M.Bundle
inplace :: (forall m. Monad m => S.Stream m a -> S.Stream m b)
-> (Size -> Size) -> Bundle v a -> Bundle v b
{-# INLINE_FUSED inplace #-}
inplace :: forall a b (v :: * -> *).
(forall (m :: * -> *). Monad m => Stream m a -> Stream m b)
-> (Size -> Size) -> Bundle v a -> Bundle v b
inplace forall (m :: * -> *). Monad m => Stream m a -> Stream m b
f Size -> Size
g Bundle v a
b = Bundle v a
b seq :: forall a b. a -> b -> b
`seq` forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
M.fromStream (forall (m :: * -> *). Monad m => Stream m a -> Stream m b
f (forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
M.elements Bundle v a
b)) (Size -> Size
g (forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
M.size Bundle v a
b))
{-# RULES
"inplace/inplace [Vector]"
forall (f1 :: forall m. Monad m => S.Stream m a -> S.Stream m a)
(f2 :: forall m. Monad m => S.Stream m a -> S.Stream m a)
g1 g2 s.
inplace f1 g1 (inplace f2 g2 s) = inplace (f1 . f2) (g1 . g2) s #-}
size :: Bundle v a -> Size
{-# INLINE size #-}
size :: forall (v :: * -> *) a. Bundle v a -> Size
size = forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
M.size
sized :: Bundle v a -> Size -> Bundle v a
{-# INLINE sized #-}
sized :: forall (v :: * -> *) a. Bundle v a -> Size -> Bundle v a
sized = forall (m :: * -> *) (v :: * -> *) a.
Bundle m v a -> Size -> Bundle m v a
M.sized
length :: Bundle v a -> Int
{-# INLINE length #-}
length :: forall (v :: * -> *) a. Bundle v a -> Int
length = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> m Int
M.length
null :: Bundle v a -> Bool
{-# INLINE null #-}
null :: forall (v :: * -> *) a. Bundle v a -> Bool
null = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> m Bool
M.null
empty :: Bundle v a
{-# INLINE empty #-}
empty :: forall (v :: * -> *) a. Bundle v a
empty = forall (m :: * -> *) (v :: * -> *) a. Monad m => Bundle m v a
M.empty
singleton :: a -> Bundle v a
{-# INLINE singleton #-}
singleton :: forall a (v :: * -> *). a -> Bundle v a
singleton = forall (m :: * -> *) a (v :: * -> *). Monad m => a -> Bundle m v a
M.singleton
replicate :: Int -> a -> Bundle v a
{-# INLINE replicate #-}
replicate :: forall a (v :: * -> *). Int -> a -> Bundle v a
replicate = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Int -> a -> Bundle m v a
M.replicate
generate :: Int -> (Int -> a) -> Bundle v a
{-# INLINE generate #-}
generate :: forall a (v :: * -> *). Int -> (Int -> a) -> Bundle v a
generate = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Int -> (Int -> a) -> Bundle m v a
M.generate
cons :: a -> Bundle v a -> Bundle v a
{-# INLINE cons #-}
cons :: forall a (v :: * -> *). a -> Bundle v a -> Bundle v a
cons = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
a -> Bundle m v a -> Bundle m v a
M.cons
snoc :: Bundle v a -> a -> Bundle v a
{-# INLINE snoc #-}
snoc :: forall (v :: * -> *) a. Bundle v a -> a -> Bundle v a
snoc = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> a -> Bundle m v a
M.snoc
infixr 5 ++
(++) :: Bundle v a -> Bundle v a -> Bundle v a
{-# INLINE (++) #-}
++ :: forall (v :: * -> *) a. Bundle v a -> Bundle v a -> Bundle v a
(++) = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> Bundle m v a -> Bundle m v a
(M.++)
head :: Bundle v a -> a
{-# INLINE head #-}
head :: forall (v :: * -> *) a. Bundle v a -> a
head = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> m a
M.head
last :: Bundle v a -> a
{-# INLINE last #-}
last :: forall (v :: * -> *) a. Bundle v a -> a
last = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> m a
M.last
infixl 9 !!
(!!) :: Bundle v a -> Int -> a
{-# INLINE (!!) #-}
Bundle v a
s !! :: forall (v :: * -> *) a. Bundle v a -> Int -> a
!! Int
i = forall a. Id a -> a
unId (Bundle v a
s forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> Int -> m a
M.!! Int
i)
infixl 9 !?
(!?) :: Bundle v a -> Int -> Maybe a
{-# INLINE (!?) #-}
Bundle v a
s !? :: forall (v :: * -> *) a. Bundle v a -> Int -> Maybe a
!? Int
i = forall a. Id a -> a
unId (Bundle v a
s forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> Int -> m (Maybe a)
M.!? Int
i)
slice :: Int
-> Int
-> Bundle v a
-> Bundle v a
{-# INLINE slice #-}
slice :: forall (v :: * -> *) a. Int -> Int -> Bundle v a -> Bundle v a
slice = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Int -> Int -> Bundle m v a -> Bundle m v a
M.slice
init :: Bundle v a -> Bundle v a
{-# INLINE init #-}
init :: forall (v :: * -> *) a. Bundle v a -> Bundle v a
init = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> Bundle m v a
M.init
tail :: Bundle v a -> Bundle v a
{-# INLINE tail #-}
tail :: forall (v :: * -> *) a. Bundle v a -> Bundle v a
tail = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> Bundle m v a
M.tail
take :: Int -> Bundle v a -> Bundle v a
{-# INLINE take #-}
take :: forall (v :: * -> *) a. Int -> Bundle v a -> Bundle v a
take = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Int -> Bundle m v a -> Bundle m v a
M.take
drop :: Int -> Bundle v a -> Bundle v a
{-# INLINE drop #-}
drop :: forall (v :: * -> *) a. Int -> Bundle v a -> Bundle v a
drop = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Int -> Bundle m v a -> Bundle m v a
M.drop
map :: (a -> b) -> Bundle v a -> Bundle v b
{-# INLINE map #-}
map :: forall a b (v :: * -> *). (a -> b) -> Bundle v a -> Bundle v b
map = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b) -> Bundle m v a -> Bundle m v b
M.map
unbox :: Bundle v (Box a) -> Bundle v a
{-# INLINE unbox #-}
unbox :: forall (v :: * -> *) a. Bundle v (Box a) -> Bundle v a
unbox = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v (Box a) -> Bundle m v a
M.unbox
concatMap :: (a -> Bundle v b) -> Bundle v a -> Bundle v b
{-# INLINE concatMap #-}
concatMap :: forall a (v :: * -> *) b.
(a -> Bundle v b) -> Bundle v a -> Bundle v b
concatMap = forall (m :: * -> *) a (v :: * -> *) b.
Monad m =>
(a -> Bundle m v b) -> Bundle m v a -> Bundle m v b
M.concatMap
indexed :: Bundle v a -> Bundle v (Int,a)
{-# INLINE indexed #-}
indexed :: forall (v :: * -> *) a. Bundle v a -> Bundle v (Int, a)
indexed = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle m v a -> Bundle m v (Int, a)
M.indexed
indexedR :: Int -> Bundle v a -> Bundle v (Int,a)
{-# INLINE_FUSED indexedR #-}
indexedR :: forall (v :: * -> *) a. Int -> Bundle v a -> Bundle v (Int, a)
indexedR = forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Int -> Bundle m v a -> Bundle m v (Int, a)
M.indexedR
zipWith :: (a -> b -> c) -> Bundle v a -> Bundle v b -> Bundle v c
{-# INLINE zipWith #-}
zipWith :: forall a b c (v :: * -> *).
(a -> b -> c) -> Bundle v a -> Bundle v b -> Bundle v c
zipWith = forall (m :: * -> *) a b c (v :: * -> *).
Monad m =>
(a -> b -> c) -> Bundle m v a -> Bundle m v b -> Bundle m v c
M.zipWith
zipWith3 :: (a -> b -> c -> d) -> Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
{-# INLINE zipWith3 #-}
zipWith3 :: forall a b c d (v :: * -> *).
(a -> b -> c -> d)
-> Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
zipWith3 = forall (m :: * -> *) a b c d (v :: * -> *).
Monad m =>
(a -> b -> c -> d)
-> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d
M.zipWith3
zipWith4 :: (a -> b -> c -> d -> e)
-> Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
-> Bundle v e
{-# INLINE zipWith4 #-}
zipWith4 :: forall a b c d e (v :: * -> *).
(a -> b -> c -> d -> e)
-> Bundle v a
-> Bundle v b
-> Bundle v c
-> Bundle v d
-> Bundle v e
zipWith4 = forall (m :: * -> *) a b c d e (v :: * -> *).
Monad m =>
(a -> b -> c -> d -> e)
-> Bundle m v a
-> Bundle m v b
-> Bundle m v c
-> Bundle m v d
-> Bundle m v e
M.zipWith4
zipWith5 :: (a -> b -> c -> d -> e -> f)
-> Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
-> Bundle v e -> Bundle v f
{-# INLINE zipWith5 #-}
zipWith5 :: forall a b c d e f (v :: * -> *).
(a -> b -> c -> d -> e -> f)
-> Bundle v a
-> Bundle v b
-> Bundle v c
-> Bundle v d
-> Bundle v e
-> Bundle v f
zipWith5 = forall (m :: * -> *) a b c d e f (v :: * -> *).
Monad m =>
(a -> b -> c -> d -> e -> f)
-> Bundle m v a
-> Bundle m v b
-> Bundle m v c
-> Bundle m v d
-> Bundle m v e
-> Bundle m v f
M.zipWith5
zipWith6 :: (a -> b -> c -> d -> e -> f -> g)
-> Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
-> Bundle v e -> Bundle v f -> Bundle v g
{-# INLINE zipWith6 #-}
zipWith6 :: forall a b c d e f g (v :: * -> *).
(a -> b -> c -> d -> e -> f -> g)
-> Bundle v a
-> Bundle v b
-> Bundle v c
-> Bundle v d
-> Bundle v e
-> Bundle v f
-> Bundle v g
zipWith6 = forall (m :: * -> *) a b c d e f g (v :: * -> *).
Monad m =>
(a -> b -> c -> d -> e -> f -> g)
-> Bundle m v a
-> Bundle m v b
-> Bundle m v c
-> Bundle m v d
-> Bundle m v e
-> Bundle m v f
-> Bundle m v g
M.zipWith6
zip :: Bundle v a -> Bundle v b -> Bundle v (a,b)
{-# INLINE zip #-}
zip :: forall (v :: * -> *) a b.
Bundle v a -> Bundle v b -> Bundle v (a, b)
zip = forall (m :: * -> *) (v :: * -> *) a b.
Monad m =>
Bundle m v a -> Bundle m v b -> Bundle m v (a, b)
M.zip
zip3 :: Bundle v a -> Bundle v b -> Bundle v c -> Bundle v (a,b,c)
{-# INLINE zip3 #-}
zip3 :: forall (v :: * -> *) a b c.
Bundle v a -> Bundle v b -> Bundle v c -> Bundle v (a, b, c)
zip3 = forall (m :: * -> *) (v :: * -> *) a b c.
Monad m =>
Bundle m v a
-> Bundle m v b -> Bundle m v c -> Bundle m v (a, b, c)
M.zip3
zip4 :: Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
-> Bundle v (a,b,c,d)
{-# INLINE zip4 #-}
zip4 :: forall (v :: * -> *) a b c d.
Bundle v a
-> Bundle v b -> Bundle v c -> Bundle v d -> Bundle v (a, b, c, d)
zip4 = forall (m :: * -> *) (v :: * -> *) a b c d.
Monad m =>
Bundle m v a
-> Bundle m v b
-> Bundle m v c
-> Bundle m v d
-> Bundle m v (a, b, c, d)
M.zip4
zip5 :: Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
-> Bundle v e -> Bundle v (a,b,c,d,e)
{-# INLINE zip5 #-}
zip5 :: forall (v :: * -> *) a b c d e.
Bundle v a
-> Bundle v b
-> Bundle v c
-> Bundle v d
-> Bundle v e
-> Bundle v (a, b, c, d, e)
zip5 = forall (m :: * -> *) (v :: * -> *) a b c d e.
Monad m =>
Bundle m v a
-> Bundle m v b
-> Bundle m v c
-> Bundle m v d
-> Bundle m v e
-> Bundle m v (a, b, c, d, e)
M.zip5
zip6 :: Bundle v a -> Bundle v b -> Bundle v c -> Bundle v d
-> Bundle v e -> Bundle v f -> Bundle v (a,b,c,d,e,f)
{-# INLINE zip6 #-}
zip6 :: forall (v :: * -> *) a b c d e f.
Bundle v a
-> Bundle v b
-> Bundle v c
-> Bundle v d
-> Bundle v e
-> Bundle v f
-> Bundle v (a, b, c, d, e, f)
zip6 = forall (m :: * -> *) (v :: * -> *) a b c d e f.
Monad m =>
Bundle m v a
-> Bundle m v b
-> Bundle m v c
-> Bundle m v d
-> Bundle m v e
-> Bundle m v f
-> Bundle m v (a, b, c, d, e, f)
M.zip6
filter :: (a -> Bool) -> Bundle v a -> Bundle v a
{-# INLINE filter #-}
filter :: forall a (v :: * -> *). (a -> Bool) -> Bundle v a -> Bundle v a
filter = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> Bool) -> Bundle m v a -> Bundle m v a
M.filter
takeWhile :: (a -> Bool) -> Bundle v a -> Bundle v a
{-# INLINE takeWhile #-}
takeWhile :: forall a (v :: * -> *). (a -> Bool) -> Bundle v a -> Bundle v a
takeWhile = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> Bool) -> Bundle m v a -> Bundle m v a
M.takeWhile
dropWhile :: (a -> Bool) -> Bundle v a -> Bundle v a
{-# INLINE dropWhile #-}
dropWhile :: forall a (v :: * -> *). (a -> Bool) -> Bundle v a -> Bundle v a
dropWhile = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> Bool) -> Bundle m v a -> Bundle m v a
M.dropWhile
infix 4 `elem`
elem :: Eq a => a -> Bundle v a -> Bool
{-# INLINE elem #-}
elem :: forall a (v :: * -> *). Eq a => a -> Bundle v a -> Bool
elem a
x = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
(Monad m, Eq a) =>
a -> Bundle m v a -> m Bool
M.elem a
x
infix 4 `notElem`
notElem :: Eq a => a -> Bundle v a -> Bool
{-# INLINE notElem #-}
notElem :: forall a (v :: * -> *). Eq a => a -> Bundle v a -> Bool
notElem a
x = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
(Monad m, Eq a) =>
a -> Bundle m v a -> m Bool
M.notElem a
x
find :: (a -> Bool) -> Bundle v a -> Maybe a
{-# INLINE find #-}
find :: forall a (v :: * -> *). (a -> Bool) -> Bundle v a -> Maybe a
find a -> Bool
f = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> Bool) -> Bundle m v a -> m (Maybe a)
M.find a -> Bool
f
findIndex :: (a -> Bool) -> Bundle v a -> Maybe Int
{-# INLINE findIndex #-}
findIndex :: forall a (v :: * -> *). (a -> Bool) -> Bundle v a -> Maybe Int
findIndex a -> Bool
f = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> Bool) -> Bundle m v a -> m (Maybe Int)
M.findIndex a -> Bool
f
foldl :: (a -> b -> a) -> a -> Bundle v b -> a
{-# INLINE foldl #-}
foldl :: forall a b (v :: * -> *). (a -> b -> a) -> a -> Bundle v b -> a
foldl a -> b -> a
f a
z = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> m a
M.foldl a -> b -> a
f a
z
foldl1 :: (a -> a -> a) -> Bundle v a -> a
{-# INLINE foldl1 #-}
foldl1 :: forall a (v :: * -> *). (a -> a -> a) -> Bundle v a -> a
foldl1 a -> a -> a
f = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> a) -> Bundle m v a -> m a
M.foldl1 a -> a -> a
f
foldl' :: (a -> b -> a) -> a -> Bundle v b -> a
{-# INLINE foldl' #-}
foldl' :: forall a b (v :: * -> *). (a -> b -> a) -> a -> Bundle v b -> a
foldl' a -> b -> a
f a
z = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> m a
M.foldl' a -> b -> a
f a
z
foldl1' :: (a -> a -> a) -> Bundle v a -> a
{-# INLINE foldl1' #-}
foldl1' :: forall a (v :: * -> *). (a -> a -> a) -> Bundle v a -> a
foldl1' a -> a -> a
f = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> a) -> Bundle m v a -> m a
M.foldl1' a -> a -> a
f
foldr :: (a -> b -> b) -> b -> Bundle v a -> b
{-# INLINE foldr #-}
foldr :: forall a b (v :: * -> *). (a -> b -> b) -> b -> Bundle v a -> b
foldr a -> b -> b
f b
z = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> b) -> b -> Bundle m v a -> m b
M.foldr a -> b -> b
f b
z
foldr1 :: (a -> a -> a) -> Bundle v a -> a
{-# INLINE foldr1 #-}
foldr1 :: forall a (v :: * -> *). (a -> a -> a) -> Bundle v a -> a
foldr1 a -> a -> a
f = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> a) -> Bundle m v a -> m a
M.foldr1 a -> a -> a
f
and :: Bundle v Bool -> Bool
{-# INLINE and #-}
and :: forall (v :: * -> *). Bundle v Bool -> Bool
and = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *).
Monad m =>
Bundle m v Bool -> m Bool
M.and
or :: Bundle v Bool -> Bool
{-# INLINE or #-}
or :: forall (v :: * -> *). Bundle v Bool -> Bool
or = forall a. Id a -> a
unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *).
Monad m =>
Bundle m v Bool -> m Bool
M.or
unfoldr :: (s -> Maybe (a, s)) -> s -> Bundle v a
{-# INLINE unfoldr #-}
unfoldr :: forall s a (v :: * -> *). (s -> Maybe (a, s)) -> s -> Bundle v a
unfoldr = forall (m :: * -> *) s a (u :: * -> *).
Monad m =>
(s -> Maybe (a, s)) -> s -> Bundle m u a
M.unfoldr
unfoldrN :: Int -> (s -> Maybe (a, s)) -> s -> Bundle v a
{-# INLINE unfoldrN #-}
unfoldrN :: forall s a (v :: * -> *).
Int -> (s -> Maybe (a, s)) -> s -> Bundle v a
unfoldrN = forall (m :: * -> *) s a (u :: * -> *).
Monad m =>
Int -> (s -> Maybe (a, s)) -> s -> Bundle m u a
M.unfoldrN
unfoldrExactN :: Int -> (s -> (a, s)) -> s -> Bundle v a
{-# INLINE unfoldrExactN #-}
unfoldrExactN :: forall s a (v :: * -> *). Int -> (s -> (a, s)) -> s -> Bundle v a
unfoldrExactN = forall (m :: * -> *) s a (u :: * -> *).
Monad m =>
Int -> (s -> (a, s)) -> s -> Bundle m u a
M.unfoldrExactN
iterateN :: Int -> (a -> a) -> a -> Bundle v a
{-# INLINE iterateN #-}
iterateN :: forall a (v :: * -> *). Int -> (a -> a) -> a -> Bundle v a
iterateN = forall (m :: * -> *) a (u :: * -> *).
Monad m =>
Int -> (a -> a) -> a -> Bundle m u a
M.iterateN
prescanl :: (a -> b -> a) -> a -> Bundle v b -> Bundle v a
{-# INLINE prescanl #-}
prescanl :: forall a b (v :: * -> *).
(a -> b -> a) -> a -> Bundle v b -> Bundle v a
prescanl = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
M.prescanl
prescanl' :: (a -> b -> a) -> a -> Bundle v b -> Bundle v a
{-# INLINE prescanl' #-}
prescanl' :: forall a b (v :: * -> *).
(a -> b -> a) -> a -> Bundle v b -> Bundle v a
prescanl' = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
M.prescanl'
postscanl :: (a -> b -> a) -> a -> Bundle v b -> Bundle v a
{-# INLINE postscanl #-}
postscanl :: forall a b (v :: * -> *).
(a -> b -> a) -> a -> Bundle v b -> Bundle v a
postscanl = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
M.postscanl
postscanl' :: (a -> b -> a) -> a -> Bundle v b -> Bundle v a
{-# INLINE postscanl' #-}
postscanl' :: forall a b (v :: * -> *).
(a -> b -> a) -> a -> Bundle v b -> Bundle v a
postscanl' = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
M.postscanl'
scanl :: (a -> b -> a) -> a -> Bundle v b -> Bundle v a
{-# INLINE scanl #-}
scanl :: forall a b (v :: * -> *).
(a -> b -> a) -> a -> Bundle v b -> Bundle v a
scanl = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
M.scanl
scanl' :: (a -> b -> a) -> a -> Bundle v b -> Bundle v a
{-# INLINE scanl' #-}
scanl' :: forall a b (v :: * -> *).
(a -> b -> a) -> a -> Bundle v b -> Bundle v a
scanl' = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
M.scanl'
scanl1 :: (a -> a -> a) -> Bundle v a -> Bundle v a
{-# INLINE scanl1 #-}
scanl1 :: forall a (v :: * -> *). (a -> a -> a) -> Bundle v a -> Bundle v a
scanl1 = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> a) -> Bundle m v a -> Bundle m v a
M.scanl1
scanl1' :: (a -> a -> a) -> Bundle v a -> Bundle v a
{-# INLINE scanl1' #-}
scanl1' :: forall a (v :: * -> *). (a -> a -> a) -> Bundle v a -> Bundle v a
scanl1' = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> a) -> Bundle m v a -> Bundle m v a
M.scanl1'
eq :: (Eq a) => Bundle v a -> Bundle v a -> Bool
{-# INLINE eq #-}
eq :: forall a (v :: * -> *). Eq a => Bundle v a -> Bundle v a -> Bool
eq = forall a b (v :: * -> *).
(a -> b -> Bool) -> Bundle v a -> Bundle v b -> Bool
eqBy forall a. Eq a => a -> a -> Bool
(==)
eqBy :: (a -> b -> Bool) -> Bundle v a -> Bundle v b -> Bool
{-# INLINE eqBy #-}
eqBy :: forall a b (v :: * -> *).
(a -> b -> Bool) -> Bundle v a -> Bundle v b -> Bool
eqBy a -> b -> Bool
e Bundle v a
x Bundle v b
y = forall a. Id a -> a
unId (forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> Bool) -> Bundle m v a -> Bundle m v b -> m Bool
M.eqBy a -> b -> Bool
e Bundle v a
x Bundle v b
y)
cmp :: (Ord a) => Bundle v a -> Bundle v a -> Ordering
{-# INLINE cmp #-}
cmp :: forall a (v :: * -> *).
Ord a =>
Bundle v a -> Bundle v a -> Ordering
cmp = forall a b (v :: * -> *).
(a -> b -> Ordering) -> Bundle v a -> Bundle v b -> Ordering
cmpBy forall a. Ord a => a -> a -> Ordering
compare
cmpBy :: (a -> b -> Ordering) -> Bundle v a -> Bundle v b -> Ordering
{-# INLINE cmpBy #-}
cmpBy :: forall a b (v :: * -> *).
(a -> b -> Ordering) -> Bundle v a -> Bundle v b -> Ordering
cmpBy a -> b -> Ordering
c Bundle v a
x Bundle v b
y = forall a. Id a -> a
unId (forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> Ordering) -> Bundle m v a -> Bundle m v b -> m Ordering
M.cmpBy a -> b -> Ordering
c Bundle v a
x Bundle v b
y)
instance Eq a => Eq (M.Bundle Id v a) where
{-# INLINE (==) #-}
== :: Bundle Id v a -> Bundle Id v a -> Bool
(==) = forall a (v :: * -> *). Eq a => Bundle v a -> Bundle v a -> Bool
eq
instance Ord a => Ord (M.Bundle Id v a) where
{-# INLINE compare #-}
compare :: Bundle Id v a -> Bundle Id v a -> Ordering
compare = forall a (v :: * -> *).
Ord a =>
Bundle v a -> Bundle v a -> Ordering
cmp
instance Eq1 (M.Bundle Id v) where
{-# INLINE liftEq #-}
liftEq :: forall a b.
(a -> b -> Bool) -> Bundle Id v a -> Bundle Id v b -> Bool
liftEq = forall a b (v :: * -> *).
(a -> b -> Bool) -> Bundle v a -> Bundle v b -> Bool
eqBy
instance Ord1 (M.Bundle Id v) where
{-# INLINE liftCompare #-}
liftCompare :: forall a b.
(a -> b -> Ordering) -> Bundle Id v a -> Bundle Id v b -> Ordering
liftCompare = forall a b (v :: * -> *).
(a -> b -> Ordering) -> Bundle v a -> Bundle v b -> Ordering
cmpBy
mapM :: Monad m => (a -> m b) -> Bundle v a -> M.Bundle m v b
{-# INLINE mapM #-}
mapM :: forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> m b) -> Bundle v a -> Bundle m v b
mapM a -> m b
f = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> m b) -> Bundle m v a -> Bundle m v b
M.mapM a -> m b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
mapM_ :: Monad m => (a -> m b) -> Bundle v a -> m ()
{-# INLINE mapM_ #-}
mapM_ :: forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> m b) -> Bundle v a -> m ()
mapM_ a -> m b
f = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> m b) -> Bundle m v a -> m ()
M.mapM_ a -> m b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
zipWithM :: Monad m => (a -> b -> m c) -> Bundle v a -> Bundle v b -> M.Bundle m v c
{-# INLINE zipWithM #-}
zipWithM :: forall (m :: * -> *) a b c (v :: * -> *).
Monad m =>
(a -> b -> m c) -> Bundle v a -> Bundle v b -> Bundle m v c
zipWithM a -> b -> m c
f Bundle v a
as Bundle v b
bs = forall (m :: * -> *) a b c (v :: * -> *).
Monad m =>
(a -> b -> m c) -> Bundle m v a -> Bundle m v b -> Bundle m v c
M.zipWithM a -> b -> m c
f (forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift Bundle v a
as) (forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift Bundle v b
bs)
zipWithM_ :: Monad m => (a -> b -> m c) -> Bundle v a -> Bundle v b -> m ()
{-# INLINE zipWithM_ #-}
zipWithM_ :: forall (m :: * -> *) a b c (v :: * -> *).
Monad m =>
(a -> b -> m c) -> Bundle v a -> Bundle v b -> m ()
zipWithM_ a -> b -> m c
f Bundle v a
as Bundle v b
bs = forall (m :: * -> *) a b c (v :: * -> *).
Monad m =>
(a -> b -> m c) -> Bundle m v a -> Bundle m v b -> m ()
M.zipWithM_ a -> b -> m c
f (forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift Bundle v a
as) (forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift Bundle v b
bs)
filterM :: Monad m => (a -> m Bool) -> Bundle v a -> M.Bundle m v a
{-# INLINE filterM #-}
filterM :: forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> m Bool) -> Bundle v a -> Bundle m v a
filterM a -> m Bool
f = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> m Bool) -> Bundle m v a -> Bundle m v a
M.filterM a -> m Bool
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> Bundle v a -> M.Bundle m v b
{-# INLINE mapMaybeM #-}
mapMaybeM :: forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> m (Maybe b)) -> Bundle v a -> Bundle m v b
mapMaybeM a -> m (Maybe b)
f = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> m (Maybe b)) -> Bundle m v a -> Bundle m v b
M.mapMaybeM a -> m (Maybe b)
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
foldM :: Monad m => (a -> b -> m a) -> a -> Bundle v b -> m a
{-# INLINE foldM #-}
foldM :: forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> m a) -> a -> Bundle v b -> m a
foldM a -> b -> m a
m a
z = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> m a) -> a -> Bundle m v b -> m a
M.foldM a -> b -> m a
m a
z forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
fold1M :: Monad m => (a -> a -> m a) -> Bundle v a -> m a
{-# INLINE fold1M #-}
fold1M :: forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> m a) -> Bundle v a -> m a
fold1M a -> a -> m a
m = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> m a) -> Bundle m v a -> m a
M.fold1M a -> a -> m a
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
foldM' :: Monad m => (a -> b -> m a) -> a -> Bundle v b -> m a
{-# INLINE foldM' #-}
foldM' :: forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> m a) -> a -> Bundle v b -> m a
foldM' a -> b -> m a
m a
z = forall (m :: * -> *) a b (v :: * -> *).
Monad m =>
(a -> b -> m a) -> a -> Bundle m v b -> m a
M.foldM' a -> b -> m a
m a
z forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
fold1M' :: Monad m => (a -> a -> m a) -> Bundle v a -> m a
{-# INLINE fold1M' #-}
fold1M' :: forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> m a) -> Bundle v a -> m a
fold1M' a -> a -> m a
m = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
(a -> a -> m a) -> Bundle m v a -> m a
M.fold1M' a -> a -> m a
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift
enumFromStepN :: Num a => a -> a -> Int -> Bundle v a
{-# INLINE enumFromStepN #-}
enumFromStepN :: forall a (v :: * -> *). Num a => a -> a -> Int -> Bundle v a
enumFromStepN = forall a (m :: * -> *) (v :: * -> *).
(Num a, Monad m) =>
a -> a -> Int -> Bundle m v a
M.enumFromStepN
enumFromTo :: Enum a => a -> a -> Bundle v a
{-# INLINE enumFromTo #-}
enumFromTo :: forall a (v :: * -> *). Enum a => a -> a -> Bundle v a
enumFromTo = forall a (m :: * -> *) (v :: * -> *).
(Enum a, Monad m) =>
a -> a -> Bundle m v a
M.enumFromTo
enumFromThenTo :: Enum a => a -> a -> a -> Bundle v a
{-# INLINE enumFromThenTo #-}
enumFromThenTo :: forall a (v :: * -> *). Enum a => a -> a -> a -> Bundle v a
enumFromThenTo = forall a (m :: * -> *) (v :: * -> *).
(Enum a, Monad m) =>
a -> a -> a -> Bundle m v a
M.enumFromThenTo
toList :: Bundle v a -> [a]
{-# INLINE toList #-}
toList :: forall (v :: * -> *) a. Bundle v a -> [a]
toList Bundle v a
s = forall a. (forall b. (a -> b -> b) -> b -> b) -> [a]
build (\a -> b -> b
c b
n -> forall a b (v :: * -> *). (a -> b -> b) -> b -> Bundle v a -> b
toListFB a -> b -> b
c b
n Bundle v a
s)
toListFB :: (a -> b -> b) -> b -> Bundle v a -> b
{-# INLINE [0] toListFB #-}
toListFB :: forall a b (v :: * -> *). (a -> b -> b) -> b -> Bundle v a -> b
toListFB a -> b -> b
c b
n M.Bundle{sElems :: forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
M.sElems = Stream s -> Id (Step s a)
step s
t} = s -> b
go s
t
where
go :: s -> b
go s
s = case forall a. Id a -> a
unId (s -> Id (Step s a)
step s
s) of
Yield a
x s
s' -> a
x a -> b -> b
`c` s -> b
go s
s'
Skip s
s' -> s -> b
go s
s'
Step s a
Done -> b
n
fromList :: [a] -> Bundle v a
{-# INLINE fromList #-}
fromList :: forall a (v :: * -> *). [a] -> Bundle v a
fromList = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
[a] -> Bundle m v a
M.fromList
fromListN :: Int -> [a] -> Bundle v a
{-# INLINE fromListN #-}
fromListN :: forall a (v :: * -> *). Int -> [a] -> Bundle v a
fromListN = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Int -> [a] -> Bundle m v a
M.fromListN
unsafeFromList :: Size -> [a] -> Bundle v a
{-# INLINE unsafeFromList #-}
unsafeFromList :: forall a (v :: * -> *). Size -> [a] -> Bundle v a
unsafeFromList = forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Size -> [a] -> Bundle m v a
M.unsafeFromList
fromVector :: Vector v a => v a -> Bundle v a
{-# INLINE fromVector #-}
fromVector :: forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
fromVector = forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
v a -> Bundle m v a
M.fromVector
reVector :: Bundle u a -> Bundle v a
{-# INLINE reVector #-}
reVector :: forall (u :: * -> *) a (v :: * -> *). Bundle u a -> Bundle v a
reVector = forall (m :: * -> *) (u :: * -> *) a (v :: * -> *).
Monad m =>
Bundle m u a -> Bundle m v a
M.reVector
fromVectors :: Vector v a => [v a] -> Bundle v a
{-# INLINE fromVectors #-}
fromVectors :: forall (v :: * -> *) a. Vector v a => [v a] -> Bundle v a
fromVectors = forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
[v a] -> Bundle m v a
M.fromVectors
concatVectors :: Vector v a => Bundle u (v a) -> Bundle v a
{-# INLINE concatVectors #-}
concatVectors :: forall (v :: * -> *) a (u :: * -> *).
Vector v a =>
Bundle u (v a) -> Bundle v a
concatVectors = forall (m :: * -> *) (v :: * -> *) a (u :: * -> *).
(Monad m, Vector v a) =>
Bundle m u (v a) -> Bundle m v a
M.concatVectors
flatten :: (a -> s) -> (s -> Step s b) -> Size -> Bundle v a -> Bundle v b
{-# INLINE_FUSED flatten #-}
flatten :: forall a s b (v :: * -> *).
(a -> s) -> (s -> Step s b) -> Size -> Bundle v a -> Bundle v b
flatten a -> s
mk s -> Step s b
istep Size
sz = forall (m :: * -> *) a s b (v :: * -> *).
Monad m =>
(a -> m s)
-> (s -> m (Step s b)) -> Size -> Bundle m v a -> Bundle m v b
M.flatten (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> s
mk) (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. s -> Step s b
istep) Size
sz forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle Id v a -> Bundle m v a
lift