{-# LANGUAGE UndecidableInstances #-}
module Streamly.Internal.Data.List
(
List (.., Nil, Cons)
, ZipList (..)
, fromZipList
, toZipList
)
where
import Control.Arrow (second)
import Control.DeepSeq (NFData(..))
#if MIN_VERSION_deepseq(1,4,3)
import Control.DeepSeq (NFData1(..))
#endif
import Data.Functor.Identity (Identity, runIdentity)
#if __GLASGOW_HASKELL__ < 808
import Data.Semigroup (Semigroup(..))
#endif
import GHC.Exts (IsList(..), IsString(..))
import Streamly.Internal.Data.Stream.Serial (SerialT(..))
import Streamly.Internal.Data.Stream.Zip (ZipSerialM(..))
import qualified Streamly.Internal.Data.Stream.Serial as Serial
import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
newtype List a = List { List a -> SerialT Identity a
toSerial :: SerialT Identity a }
deriving (Int -> List a -> ShowS
[List a] -> ShowS
List a -> String
(Int -> List a -> ShowS)
-> (List a -> String) -> ([List a] -> ShowS) -> Show (List a)
forall a. Show a => Int -> List a -> ShowS
forall a. Show a => [List a] -> ShowS
forall a. Show a => List a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [List a] -> ShowS
$cshowList :: forall a. Show a => [List a] -> ShowS
show :: List a -> String
$cshow :: forall a. Show a => List a -> String
showsPrec :: Int -> List a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> List a -> ShowS
Show, ReadPrec [List a]
ReadPrec (List a)
Int -> ReadS (List a)
ReadS [List a]
(Int -> ReadS (List a))
-> ReadS [List a]
-> ReadPrec (List a)
-> ReadPrec [List a]
-> Read (List a)
forall a. Read a => ReadPrec [List a]
forall a. Read a => ReadPrec (List a)
forall a. Read a => Int -> ReadS (List a)
forall a. Read a => ReadS [List a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [List a]
$creadListPrec :: forall a. Read a => ReadPrec [List a]
readPrec :: ReadPrec (List a)
$creadPrec :: forall a. Read a => ReadPrec (List a)
readList :: ReadS [List a]
$creadList :: forall a. Read a => ReadS [List a]
readsPrec :: Int -> ReadS (List a)
$creadsPrec :: forall a. Read a => Int -> ReadS (List a)
Read, List a -> List a -> Bool
(List a -> List a -> Bool)
-> (List a -> List a -> Bool) -> Eq (List a)
forall a. Eq a => List a -> List a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: List a -> List a -> Bool
$c/= :: forall a. Eq a => List a -> List a -> Bool
== :: List a -> List a -> Bool
$c== :: forall a. Eq a => List a -> List a -> Bool
Eq, Eq (List a)
Eq (List a)
-> (List a -> List a -> Ordering)
-> (List a -> List a -> Bool)
-> (List a -> List a -> Bool)
-> (List a -> List a -> Bool)
-> (List a -> List a -> Bool)
-> (List a -> List a -> List a)
-> (List a -> List a -> List a)
-> Ord (List a)
List a -> List a -> Bool
List a -> List a -> Ordering
List a -> List a -> List a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (List a)
forall a. Ord a => List a -> List a -> Bool
forall a. Ord a => List a -> List a -> Ordering
forall a. Ord a => List a -> List a -> List a
min :: List a -> List a -> List a
$cmin :: forall a. Ord a => List a -> List a -> List a
max :: List a -> List a -> List a
$cmax :: forall a. Ord a => List a -> List a -> List a
>= :: List a -> List a -> Bool
$c>= :: forall a. Ord a => List a -> List a -> Bool
> :: List a -> List a -> Bool
$c> :: forall a. Ord a => List a -> List a -> Bool
<= :: List a -> List a -> Bool
$c<= :: forall a. Ord a => List a -> List a -> Bool
< :: List a -> List a -> Bool
$c< :: forall a. Ord a => List a -> List a -> Bool
compare :: List a -> List a -> Ordering
$ccompare :: forall a. Ord a => List a -> List a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (List a)
Ord, List a -> ()
(List a -> ()) -> NFData (List a)
forall a. NFData a => List a -> ()
forall a. (a -> ()) -> NFData a
rnf :: List a -> ()
$crnf :: forall a. NFData a => List a -> ()
NFData
#if MIN_VERSION_deepseq(1,4,3)
, (a -> ()) -> List a -> ()
(forall a. (a -> ()) -> List a -> ()) -> NFData1 List
forall a. (a -> ()) -> List a -> ()
forall (f :: * -> *).
(forall a. (a -> ()) -> f a -> ()) -> NFData1 f
liftRnf :: (a -> ()) -> List a -> ()
$cliftRnf :: forall a. (a -> ()) -> List a -> ()
NFData1
#endif
, b -> List a -> List a
NonEmpty (List a) -> List a
List a -> List a -> List a
(List a -> List a -> List a)
-> (NonEmpty (List a) -> List a)
-> (forall b. Integral b => b -> List a -> List a)
-> Semigroup (List a)
forall b. Integral b => b -> List a -> List a
forall a. NonEmpty (List a) -> List a
forall a. List a -> List a -> List a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall a b. Integral b => b -> List a -> List a
stimes :: b -> List a -> List a
$cstimes :: forall a b. Integral b => b -> List a -> List a
sconcat :: NonEmpty (List a) -> List a
$csconcat :: forall a. NonEmpty (List a) -> List a
<> :: List a -> List a -> List a
$c<> :: forall a. List a -> List a -> List a
Semigroup, Semigroup (List a)
List a
Semigroup (List a)
-> List a
-> (List a -> List a -> List a)
-> ([List a] -> List a)
-> Monoid (List a)
[List a] -> List a
List a -> List a -> List a
forall a. Semigroup (List a)
forall a. List a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall a. [List a] -> List a
forall a. List a -> List a -> List a
mconcat :: [List a] -> List a
$cmconcat :: forall a. [List a] -> List a
mappend :: List a -> List a -> List a
$cmappend :: forall a. List a -> List a -> List a
mempty :: List a
$cmempty :: forall a. List a
$cp1Monoid :: forall a. Semigroup (List a)
Monoid, a -> List b -> List a
(a -> b) -> List a -> List b
(forall a b. (a -> b) -> List a -> List b)
-> (forall a b. a -> List b -> List a) -> Functor List
forall a b. a -> List b -> List a
forall a b. (a -> b) -> List a -> List b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> List b -> List a
$c<$ :: forall a b. a -> List b -> List a
fmap :: (a -> b) -> List a -> List b
$cfmap :: forall a b. (a -> b) -> List a -> List b
Functor, a -> List a -> Bool
List m -> m
List a -> [a]
List a -> Bool
List a -> Int
List a -> a
List a -> a
List a -> a
List a -> a
(a -> m) -> List a -> m
(a -> m) -> List a -> m
(a -> b -> b) -> b -> List a -> b
(a -> b -> b) -> b -> List a -> b
(b -> a -> b) -> b -> List a -> b
(b -> a -> b) -> b -> List a -> b
(a -> a -> a) -> List a -> a
(a -> a -> a) -> List a -> a
(forall m. Monoid m => List m -> m)
-> (forall m a. Monoid m => (a -> m) -> List a -> m)
-> (forall m a. Monoid m => (a -> m) -> List a -> m)
-> (forall a b. (a -> b -> b) -> b -> List a -> b)
-> (forall a b. (a -> b -> b) -> b -> List a -> b)
-> (forall b a. (b -> a -> b) -> b -> List a -> b)
-> (forall b a. (b -> a -> b) -> b -> List a -> b)
-> (forall a. (a -> a -> a) -> List a -> a)
-> (forall a. (a -> a -> a) -> List a -> a)
-> (forall a. List a -> [a])
-> (forall a. List a -> Bool)
-> (forall a. List a -> Int)
-> (forall a. Eq a => a -> List a -> Bool)
-> (forall a. Ord a => List a -> a)
-> (forall a. Ord a => List a -> a)
-> (forall a. Num a => List a -> a)
-> (forall a. Num a => List a -> a)
-> Foldable List
forall a. Eq a => a -> List a -> Bool
forall a. Num a => List a -> a
forall a. Ord a => List a -> a
forall m. Monoid m => List m -> m
forall a. List a -> Bool
forall a. List a -> Int
forall a. List a -> [a]
forall a. (a -> a -> a) -> List a -> a
forall m a. Monoid m => (a -> m) -> List a -> m
forall b a. (b -> a -> b) -> b -> List a -> b
forall a b. (a -> b -> b) -> b -> List a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: List a -> a
$cproduct :: forall a. Num a => List a -> a
sum :: List a -> a
$csum :: forall a. Num a => List a -> a
minimum :: List a -> a
$cminimum :: forall a. Ord a => List a -> a
maximum :: List a -> a
$cmaximum :: forall a. Ord a => List a -> a
elem :: a -> List a -> Bool
$celem :: forall a. Eq a => a -> List a -> Bool
length :: List a -> Int
$clength :: forall a. List a -> Int
null :: List a -> Bool
$cnull :: forall a. List a -> Bool
toList :: List a -> [a]
$ctoList :: forall a. List a -> [a]
foldl1 :: (a -> a -> a) -> List a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> List a -> a
foldr1 :: (a -> a -> a) -> List a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> List a -> a
foldl' :: (b -> a -> b) -> b -> List a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> List a -> b
foldl :: (b -> a -> b) -> b -> List a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> List a -> b
foldr' :: (a -> b -> b) -> b -> List a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> List a -> b
foldr :: (a -> b -> b) -> b -> List a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> List a -> b
foldMap' :: (a -> m) -> List a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> List a -> m
foldMap :: (a -> m) -> List a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> List a -> m
fold :: List m -> m
$cfold :: forall m. Monoid m => List m -> m
Foldable
, Functor List
a -> List a
Functor List
-> (forall a. a -> List a)
-> (forall a b. List (a -> b) -> List a -> List b)
-> (forall a b c. (a -> b -> c) -> List a -> List b -> List c)
-> (forall a b. List a -> List b -> List b)
-> (forall a b. List a -> List b -> List a)
-> Applicative List
List a -> List b -> List b
List a -> List b -> List a
List (a -> b) -> List a -> List b
(a -> b -> c) -> List a -> List b -> List c
forall a. a -> List a
forall a b. List a -> List b -> List a
forall a b. List a -> List b -> List b
forall a b. List (a -> b) -> List a -> List b
forall a b c. (a -> b -> c) -> List a -> List b -> List c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: List a -> List b -> List a
$c<* :: forall a b. List a -> List b -> List a
*> :: List a -> List b -> List b
$c*> :: forall a b. List a -> List b -> List b
liftA2 :: (a -> b -> c) -> List a -> List b -> List c
$cliftA2 :: forall a b c. (a -> b -> c) -> List a -> List b -> List c
<*> :: List (a -> b) -> List a -> List b
$c<*> :: forall a b. List (a -> b) -> List a -> List b
pure :: a -> List a
$cpure :: forall a. a -> List a
$cp1Applicative :: Functor List
Applicative, Functor List
Foldable List
Functor List
-> Foldable List
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> List a -> f (List b))
-> (forall (f :: * -> *) a.
Applicative f =>
List (f a) -> f (List a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> List a -> m (List b))
-> (forall (m :: * -> *) a. Monad m => List (m a) -> m (List a))
-> Traversable List
(a -> f b) -> List a -> f (List b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => List (m a) -> m (List a)
forall (f :: * -> *) a. Applicative f => List (f a) -> f (List a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> List a -> m (List b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> List a -> f (List b)
sequence :: List (m a) -> m (List a)
$csequence :: forall (m :: * -> *) a. Monad m => List (m a) -> m (List a)
mapM :: (a -> m b) -> List a -> m (List b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> List a -> m (List b)
sequenceA :: List (f a) -> f (List a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => List (f a) -> f (List a)
traverse :: (a -> f b) -> List a -> f (List b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> List a -> f (List b)
$cp2Traversable :: Foldable List
$cp1Traversable :: Functor List
Traversable, Applicative List
a -> List a
Applicative List
-> (forall a b. List a -> (a -> List b) -> List b)
-> (forall a b. List a -> List b -> List b)
-> (forall a. a -> List a)
-> Monad List
List a -> (a -> List b) -> List b
List a -> List b -> List b
forall a. a -> List a
forall a b. List a -> List b -> List b
forall a b. List a -> (a -> List b) -> List b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> List a
$creturn :: forall a. a -> List a
>> :: List a -> List b -> List b
$c>> :: forall a b. List a -> List b -> List b
>>= :: List a -> (a -> List b) -> List b
$c>>= :: forall a b. List a -> (a -> List b) -> List b
$cp1Monad :: Applicative List
Monad)
instance (a ~ Char) => IsString (List a) where
{-# INLINE fromString #-}
fromString :: String -> List a
fromString = SerialT Identity a -> List a
forall a. SerialT Identity a -> List a
List (SerialT Identity a -> List a)
-> (String -> SerialT Identity a) -> String -> List a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> SerialT Identity a
forall l. IsList l => [Item l] -> l
fromList
instance IsList (List a) where
type (Item (List a)) = a
{-# INLINE fromList #-}
fromList :: [Item (List a)] -> List a
fromList = SerialT Identity a -> List a
forall a. SerialT Identity a -> List a
List (SerialT Identity a -> List a)
-> ([a] -> SerialT Identity a) -> [a] -> List a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> SerialT Identity a
forall l. IsList l => [Item l] -> l
fromList
{-# INLINE toList #-}
toList :: List a -> [Item (List a)]
toList = SerialT Identity a -> [a]
forall l. IsList l => l -> [Item l]
toList (SerialT Identity a -> [a])
-> (List a -> SerialT Identity a) -> List a -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. List a -> SerialT Identity a
forall a. List a -> SerialT Identity a
toSerial
pattern Nil :: List a
pattern $bNil :: List a
$mNil :: forall r a. List a -> (Void# -> r) -> (Void# -> r) -> r
Nil <- (runIdentity . K.null . getSerialT . toSerial -> True) where
Nil = SerialT Identity a -> List a
forall a. SerialT Identity a -> List a
List (SerialT Identity a -> List a) -> SerialT Identity a -> List a
forall a b. (a -> b) -> a -> b
$ Stream Identity a -> SerialT Identity a
forall (m :: * -> *) a. Stream m a -> SerialT m a
SerialT Stream Identity a
forall (m :: * -> *) a. Stream m a
K.nil
infixr 5 `Cons`
pattern Cons :: a -> List a -> List a
pattern $bCons :: a -> List a -> List a
$mCons :: forall r a. List a -> (a -> List a -> r) -> (Void# -> r) -> r
Cons x xs <-
(fmap (second (List . SerialT))
. runIdentity . K.uncons . getSerialT . toSerial
-> Just (x, xs)
)
where
Cons a
x List a
xs = SerialT Identity a -> List a
forall a. SerialT Identity a -> List a
List (SerialT Identity a -> List a) -> SerialT Identity a -> List a
forall a b. (a -> b) -> a -> b
$ a -> SerialT Identity a -> SerialT Identity a
forall a (m :: * -> *). a -> SerialT m a -> SerialT m a
Serial.cons a
x (List a -> SerialT Identity a
forall a. List a -> SerialT Identity a
toSerial List a
xs)
#if __GLASGOW_HASKELL__ >= 802
{-# COMPLETE Nil, Cons #-}
#endif
newtype ZipList a = ZipList { ZipList a -> ZipSerialM Identity a
toZipSerial :: ZipSerialM Identity a }
deriving (Int -> ZipList a -> ShowS
[ZipList a] -> ShowS
ZipList a -> String
(Int -> ZipList a -> ShowS)
-> (ZipList a -> String)
-> ([ZipList a] -> ShowS)
-> Show (ZipList a)
forall a. Show a => Int -> ZipList a -> ShowS
forall a. Show a => [ZipList a] -> ShowS
forall a. Show a => ZipList a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ZipList a] -> ShowS
$cshowList :: forall a. Show a => [ZipList a] -> ShowS
show :: ZipList a -> String
$cshow :: forall a. Show a => ZipList a -> String
showsPrec :: Int -> ZipList a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> ZipList a -> ShowS
Show, ReadPrec [ZipList a]
ReadPrec (ZipList a)
Int -> ReadS (ZipList a)
ReadS [ZipList a]
(Int -> ReadS (ZipList a))
-> ReadS [ZipList a]
-> ReadPrec (ZipList a)
-> ReadPrec [ZipList a]
-> Read (ZipList a)
forall a. Read a => ReadPrec [ZipList a]
forall a. Read a => ReadPrec (ZipList a)
forall a. Read a => Int -> ReadS (ZipList a)
forall a. Read a => ReadS [ZipList a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ZipList a]
$creadListPrec :: forall a. Read a => ReadPrec [ZipList a]
readPrec :: ReadPrec (ZipList a)
$creadPrec :: forall a. Read a => ReadPrec (ZipList a)
readList :: ReadS [ZipList a]
$creadList :: forall a. Read a => ReadS [ZipList a]
readsPrec :: Int -> ReadS (ZipList a)
$creadsPrec :: forall a. Read a => Int -> ReadS (ZipList a)
Read, ZipList a -> ZipList a -> Bool
(ZipList a -> ZipList a -> Bool)
-> (ZipList a -> ZipList a -> Bool) -> Eq (ZipList a)
forall a. Eq a => ZipList a -> ZipList a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ZipList a -> ZipList a -> Bool
$c/= :: forall a. Eq a => ZipList a -> ZipList a -> Bool
== :: ZipList a -> ZipList a -> Bool
$c== :: forall a. Eq a => ZipList a -> ZipList a -> Bool
Eq, Eq (ZipList a)
Eq (ZipList a)
-> (ZipList a -> ZipList a -> Ordering)
-> (ZipList a -> ZipList a -> Bool)
-> (ZipList a -> ZipList a -> Bool)
-> (ZipList a -> ZipList a -> Bool)
-> (ZipList a -> ZipList a -> Bool)
-> (ZipList a -> ZipList a -> ZipList a)
-> (ZipList a -> ZipList a -> ZipList a)
-> Ord (ZipList a)
ZipList a -> ZipList a -> Bool
ZipList a -> ZipList a -> Ordering
ZipList a -> ZipList a -> ZipList a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (ZipList a)
forall a. Ord a => ZipList a -> ZipList a -> Bool
forall a. Ord a => ZipList a -> ZipList a -> Ordering
forall a. Ord a => ZipList a -> ZipList a -> ZipList a
min :: ZipList a -> ZipList a -> ZipList a
$cmin :: forall a. Ord a => ZipList a -> ZipList a -> ZipList a
max :: ZipList a -> ZipList a -> ZipList a
$cmax :: forall a. Ord a => ZipList a -> ZipList a -> ZipList a
>= :: ZipList a -> ZipList a -> Bool
$c>= :: forall a. Ord a => ZipList a -> ZipList a -> Bool
> :: ZipList a -> ZipList a -> Bool
$c> :: forall a. Ord a => ZipList a -> ZipList a -> Bool
<= :: ZipList a -> ZipList a -> Bool
$c<= :: forall a. Ord a => ZipList a -> ZipList a -> Bool
< :: ZipList a -> ZipList a -> Bool
$c< :: forall a. Ord a => ZipList a -> ZipList a -> Bool
compare :: ZipList a -> ZipList a -> Ordering
$ccompare :: forall a. Ord a => ZipList a -> ZipList a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (ZipList a)
Ord, ZipList a -> ()
(ZipList a -> ()) -> NFData (ZipList a)
forall a. NFData a => ZipList a -> ()
forall a. (a -> ()) -> NFData a
rnf :: ZipList a -> ()
$crnf :: forall a. NFData a => ZipList a -> ()
NFData
#if MIN_VERSION_deepseq(1,4,3)
, (a -> ()) -> ZipList a -> ()
(forall a. (a -> ()) -> ZipList a -> ()) -> NFData1 ZipList
forall a. (a -> ()) -> ZipList a -> ()
forall (f :: * -> *).
(forall a. (a -> ()) -> f a -> ()) -> NFData1 f
liftRnf :: (a -> ()) -> ZipList a -> ()
$cliftRnf :: forall a. (a -> ()) -> ZipList a -> ()
NFData1
#endif
, b -> ZipList a -> ZipList a
NonEmpty (ZipList a) -> ZipList a
ZipList a -> ZipList a -> ZipList a
(ZipList a -> ZipList a -> ZipList a)
-> (NonEmpty (ZipList a) -> ZipList a)
-> (forall b. Integral b => b -> ZipList a -> ZipList a)
-> Semigroup (ZipList a)
forall b. Integral b => b -> ZipList a -> ZipList a
forall a. NonEmpty (ZipList a) -> ZipList a
forall a. ZipList a -> ZipList a -> ZipList a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall a b. Integral b => b -> ZipList a -> ZipList a
stimes :: b -> ZipList a -> ZipList a
$cstimes :: forall a b. Integral b => b -> ZipList a -> ZipList a
sconcat :: NonEmpty (ZipList a) -> ZipList a
$csconcat :: forall a. NonEmpty (ZipList a) -> ZipList a
<> :: ZipList a -> ZipList a -> ZipList a
$c<> :: forall a. ZipList a -> ZipList a -> ZipList a
Semigroup, Semigroup (ZipList a)
ZipList a
Semigroup (ZipList a)
-> ZipList a
-> (ZipList a -> ZipList a -> ZipList a)
-> ([ZipList a] -> ZipList a)
-> Monoid (ZipList a)
[ZipList a] -> ZipList a
ZipList a -> ZipList a -> ZipList a
forall a. Semigroup (ZipList a)
forall a. ZipList a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall a. [ZipList a] -> ZipList a
forall a. ZipList a -> ZipList a -> ZipList a
mconcat :: [ZipList a] -> ZipList a
$cmconcat :: forall a. [ZipList a] -> ZipList a
mappend :: ZipList a -> ZipList a -> ZipList a
$cmappend :: forall a. ZipList a -> ZipList a -> ZipList a
mempty :: ZipList a
$cmempty :: forall a. ZipList a
$cp1Monoid :: forall a. Semigroup (ZipList a)
Monoid, a -> ZipList b -> ZipList a
(a -> b) -> ZipList a -> ZipList b
(forall a b. (a -> b) -> ZipList a -> ZipList b)
-> (forall a b. a -> ZipList b -> ZipList a) -> Functor ZipList
forall a b. a -> ZipList b -> ZipList a
forall a b. (a -> b) -> ZipList a -> ZipList b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> ZipList b -> ZipList a
$c<$ :: forall a b. a -> ZipList b -> ZipList a
fmap :: (a -> b) -> ZipList a -> ZipList b
$cfmap :: forall a b. (a -> b) -> ZipList a -> ZipList b
Functor, a -> ZipList a -> Bool
ZipList m -> m
ZipList a -> [a]
ZipList a -> Bool
ZipList a -> Int
ZipList a -> a
ZipList a -> a
ZipList a -> a
ZipList a -> a
(a -> m) -> ZipList a -> m
(a -> m) -> ZipList a -> m
(a -> b -> b) -> b -> ZipList a -> b
(a -> b -> b) -> b -> ZipList a -> b
(b -> a -> b) -> b -> ZipList a -> b
(b -> a -> b) -> b -> ZipList a -> b
(a -> a -> a) -> ZipList a -> a
(a -> a -> a) -> ZipList a -> a
(forall m. Monoid m => ZipList m -> m)
-> (forall m a. Monoid m => (a -> m) -> ZipList a -> m)
-> (forall m a. Monoid m => (a -> m) -> ZipList a -> m)
-> (forall a b. (a -> b -> b) -> b -> ZipList a -> b)
-> (forall a b. (a -> b -> b) -> b -> ZipList a -> b)
-> (forall b a. (b -> a -> b) -> b -> ZipList a -> b)
-> (forall b a. (b -> a -> b) -> b -> ZipList a -> b)
-> (forall a. (a -> a -> a) -> ZipList a -> a)
-> (forall a. (a -> a -> a) -> ZipList a -> a)
-> (forall a. ZipList a -> [a])
-> (forall a. ZipList a -> Bool)
-> (forall a. ZipList a -> Int)
-> (forall a. Eq a => a -> ZipList a -> Bool)
-> (forall a. Ord a => ZipList a -> a)
-> (forall a. Ord a => ZipList a -> a)
-> (forall a. Num a => ZipList a -> a)
-> (forall a. Num a => ZipList a -> a)
-> Foldable ZipList
forall a. Eq a => a -> ZipList a -> Bool
forall a. Num a => ZipList a -> a
forall a. Ord a => ZipList a -> a
forall m. Monoid m => ZipList m -> m
forall a. ZipList a -> Bool
forall a. ZipList a -> Int
forall a. ZipList a -> [a]
forall a. (a -> a -> a) -> ZipList a -> a
forall m a. Monoid m => (a -> m) -> ZipList a -> m
forall b a. (b -> a -> b) -> b -> ZipList a -> b
forall a b. (a -> b -> b) -> b -> ZipList a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: ZipList a -> a
$cproduct :: forall a. Num a => ZipList a -> a
sum :: ZipList a -> a
$csum :: forall a. Num a => ZipList a -> a
minimum :: ZipList a -> a
$cminimum :: forall a. Ord a => ZipList a -> a
maximum :: ZipList a -> a
$cmaximum :: forall a. Ord a => ZipList a -> a
elem :: a -> ZipList a -> Bool
$celem :: forall a. Eq a => a -> ZipList a -> Bool
length :: ZipList a -> Int
$clength :: forall a. ZipList a -> Int
null :: ZipList a -> Bool
$cnull :: forall a. ZipList a -> Bool
toList :: ZipList a -> [a]
$ctoList :: forall a. ZipList a -> [a]
foldl1 :: (a -> a -> a) -> ZipList a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> ZipList a -> a
foldr1 :: (a -> a -> a) -> ZipList a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> ZipList a -> a
foldl' :: (b -> a -> b) -> b -> ZipList a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> ZipList a -> b
foldl :: (b -> a -> b) -> b -> ZipList a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> ZipList a -> b
foldr' :: (a -> b -> b) -> b -> ZipList a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> ZipList a -> b
foldr :: (a -> b -> b) -> b -> ZipList a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> ZipList a -> b
foldMap' :: (a -> m) -> ZipList a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> ZipList a -> m
foldMap :: (a -> m) -> ZipList a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> ZipList a -> m
fold :: ZipList m -> m
$cfold :: forall m. Monoid m => ZipList m -> m
Foldable
, Functor ZipList
a -> ZipList a
Functor ZipList
-> (forall a. a -> ZipList a)
-> (forall a b. ZipList (a -> b) -> ZipList a -> ZipList b)
-> (forall a b c.
(a -> b -> c) -> ZipList a -> ZipList b -> ZipList c)
-> (forall a b. ZipList a -> ZipList b -> ZipList b)
-> (forall a b. ZipList a -> ZipList b -> ZipList a)
-> Applicative ZipList
ZipList a -> ZipList b -> ZipList b
ZipList a -> ZipList b -> ZipList a
ZipList (a -> b) -> ZipList a -> ZipList b
(a -> b -> c) -> ZipList a -> ZipList b -> ZipList c
forall a. a -> ZipList a
forall a b. ZipList a -> ZipList b -> ZipList a
forall a b. ZipList a -> ZipList b -> ZipList b
forall a b. ZipList (a -> b) -> ZipList a -> ZipList b
forall a b c. (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: ZipList a -> ZipList b -> ZipList a
$c<* :: forall a b. ZipList a -> ZipList b -> ZipList a
*> :: ZipList a -> ZipList b -> ZipList b
$c*> :: forall a b. ZipList a -> ZipList b -> ZipList b
liftA2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c
$cliftA2 :: forall a b c. (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c
<*> :: ZipList (a -> b) -> ZipList a -> ZipList b
$c<*> :: forall a b. ZipList (a -> b) -> ZipList a -> ZipList b
pure :: a -> ZipList a
$cpure :: forall a. a -> ZipList a
$cp1Applicative :: Functor ZipList
Applicative, Functor ZipList
Foldable ZipList
Functor ZipList
-> Foldable ZipList
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ZipList a -> f (ZipList b))
-> (forall (f :: * -> *) a.
Applicative f =>
ZipList (f a) -> f (ZipList a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ZipList a -> m (ZipList b))
-> (forall (m :: * -> *) a.
Monad m =>
ZipList (m a) -> m (ZipList a))
-> Traversable ZipList
(a -> f b) -> ZipList a -> f (ZipList b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => ZipList (m a) -> m (ZipList a)
forall (f :: * -> *) a.
Applicative f =>
ZipList (f a) -> f (ZipList a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ZipList a -> m (ZipList b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ZipList a -> f (ZipList b)
sequence :: ZipList (m a) -> m (ZipList a)
$csequence :: forall (m :: * -> *) a. Monad m => ZipList (m a) -> m (ZipList a)
mapM :: (a -> m b) -> ZipList a -> m (ZipList b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ZipList a -> m (ZipList b)
sequenceA :: ZipList (f a) -> f (ZipList a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
ZipList (f a) -> f (ZipList a)
traverse :: (a -> f b) -> ZipList a -> f (ZipList b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ZipList a -> f (ZipList b)
$cp2Traversable :: Foldable ZipList
$cp1Traversable :: Functor ZipList
Traversable)
instance (a ~ Char) => IsString (ZipList a) where
{-# INLINE fromString #-}
fromString :: String -> ZipList a
fromString = ZipSerialM Identity a -> ZipList a
forall a. ZipSerialM Identity a -> ZipList a
ZipList (ZipSerialM Identity a -> ZipList a)
-> (String -> ZipSerialM Identity a) -> String -> ZipList a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ZipSerialM Identity a
forall l. IsList l => [Item l] -> l
fromList
instance IsList (ZipList a) where
type (Item (ZipList a)) = a
{-# INLINE fromList #-}
fromList :: [Item (ZipList a)] -> ZipList a
fromList = ZipSerialM Identity a -> ZipList a
forall a. ZipSerialM Identity a -> ZipList a
ZipList (ZipSerialM Identity a -> ZipList a)
-> ([a] -> ZipSerialM Identity a) -> [a] -> ZipList a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> ZipSerialM Identity a
forall l. IsList l => [Item l] -> l
fromList
{-# INLINE toList #-}
toList :: ZipList a -> [Item (ZipList a)]
toList = ZipSerialM Identity a -> [a]
forall l. IsList l => l -> [Item l]
toList (ZipSerialM Identity a -> [a])
-> (ZipList a -> ZipSerialM Identity a) -> ZipList a -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ZipList a -> ZipSerialM Identity a
forall a. ZipList a -> ZipSerialM Identity a
toZipSerial
fromZipList :: ZipList a -> List a
fromZipList :: ZipList a -> List a
fromZipList (ZipList ZipSerialM Identity a
zs) = SerialT Identity a -> List a
forall a. SerialT Identity a -> List a
List (SerialT Identity a -> List a) -> SerialT Identity a -> List a
forall a b. (a -> b) -> a -> b
$ Stream Identity a -> SerialT Identity a
forall (m :: * -> *) a. Stream m a -> SerialT m a
SerialT (Stream Identity a -> SerialT Identity a)
-> Stream Identity a -> SerialT Identity a
forall a b. (a -> b) -> a -> b
$ ZipSerialM Identity a -> Stream Identity a
forall (m :: * -> *) a. ZipSerialM m a -> Stream m a
getZipSerialM ZipSerialM Identity a
zs
toZipList :: List a -> ZipList a
toZipList :: List a -> ZipList a
toZipList = ZipSerialM Identity a -> ZipList a
forall a. ZipSerialM Identity a -> ZipList a
ZipList (ZipSerialM Identity a -> ZipList a)
-> (List a -> ZipSerialM Identity a) -> List a -> ZipList a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Stream Identity a -> ZipSerialM Identity a
forall (m :: * -> *) a. Stream m a -> ZipSerialM m a
ZipSerialM (Stream Identity a -> ZipSerialM Identity a)
-> (List a -> Stream Identity a) -> List a -> ZipSerialM Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SerialT Identity a -> Stream Identity a
forall (m :: * -> *) a. SerialT m a -> Stream m a
getSerialT (SerialT Identity a -> Stream Identity a)
-> (List a -> SerialT Identity a) -> List a -> Stream Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. List a -> SerialT Identity a
forall a. List a -> SerialT Identity a
toSerial