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