Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Monad m => MonadIO (m :: Type -> Type) where
- class MonadCatch m => MonadMask (m :: Type -> Type)
- data ByteStream m r
- streamFile :: (MonadIO m, MonadMask m) => FilePath -> (ByteStream m () -> m r) -> m r
- streamHandle :: MonadIO m => Handle -> ByteStream m ()
- streamInput :: (MonadIO m, MonadMask m) => FilePath -> (ByteStream m () -> m r) -> m r
- streamInputs :: MonadIO m => [FilePath] -> (Stream (ByteStream m) m () -> r) -> r
- withOutputFile :: (MonadIO m, MonadMask m) => FilePath -> (Handle -> m a) -> m a
- protectTerm :: (Functor f, MonadIO m) => Stream f m r -> Stream f m r
- psequence :: MonadIO m => Int -> Stream (Of (IO a)) m b -> Stream (Of a) m b
- progressGen :: MonadIO m => (Int -> a -> String) -> Int -> (String -> IO ()) -> Stream (Of a) m r -> Stream (Of a) m r
- progressNum :: MonadIO m => String -> Int -> (String -> IO ()) -> Stream (Of a) m r -> Stream (Of a) m r
- progressPos :: MonadIO m => (a -> (Refseq, Int)) -> String -> Refs -> Int -> (String -> IO ()) -> Stream (Of a) m r -> Stream (Of a) m r
- mergeStreams :: (Monad m, Ord a) => Stream (Of a) m r -> Stream (Of a) m s -> Stream (Of a) m (r, s)
- mergeStreamsBy :: Monad m => (a -> a -> Ordering) -> Stream (Of a) m r -> Stream (Of a) m s -> Stream (Of a) m (r, s)
- mergeStreamsOn :: (Monad m, Ord b) => (a -> b) -> Stream (Of a) m r -> Stream (Of a) m s -> Stream (Of a) m (r, s)
- join :: Monad m => m (m a) -> m a
- liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
- newtype Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) :: forall k k1. (k -> Type) -> (k1 -> k) -> k1 -> Type = Compose {
- getCompose :: f (g a)
- data Sum (f :: k -> Type) (g :: k -> Type) (a :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type
- class Bifunctor (p :: Type -> Type -> Type) where
- class Monad m => MonadIO (m :: Type -> Type) where
- newtype Identity a = Identity {
- runIdentity :: a
- void :: Functor f => f a -> f ()
- liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
- liftM :: Monad m => (a1 -> r) -> m a1 -> m r
- liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
- class Applicative f => Alternative (f :: Type -> Type) where
- (<|>) :: f a -> f a -> f a
- class MonadTrans (t :: (Type -> Type) -> Type -> Type) where
- chunksOf :: (Monad m, Functor f) => Int -> Stream f m r -> Stream (Stream f m) m r
- concats :: (Monad m, Functor f) => Stream (Stream f m) m r -> Stream f m r
- cutoff :: (Monad m, Functor f) => Int -> Stream f m r -> Stream f m (Maybe r)
- decompose :: (Monad m, Functor f) => Stream (Compose m f) m r -> Stream f m r
- delays :: (MonadIO m, Applicative f) => Double -> Stream f m r
- destroy :: (Functor f, Monad m) => Stream f m r -> (f b -> b) -> (m b -> b) -> (r -> b) -> b
- distribute :: (Monad m, Functor f, MonadTrans t, MFunctor t, Monad (t (Stream f m))) => Stream f (t m) r -> t (Stream f m) r
- effect :: (Monad m, Functor f) => m (Stream f m r) -> Stream f m r
- expand :: (Monad m, Functor f) => (forall a b. (g a -> b) -> f a -> h b) -> Stream f m r -> Stream g (Stream h m) r
- expandPost :: (Monad m, Functor g) => (forall a b. (g a -> b) -> f a -> h b) -> Stream f m r -> Stream g (Stream h m) r
- groups :: (Monad m, Functor f, Functor g) => Stream (Sum f g) m r -> Stream (Sum (Stream f m) (Stream g m)) m r
- hoistUnexposed :: (Monad m, Functor f) => (forall a. m a -> n a) -> Stream f m r -> Stream f n r
- inspect :: Monad m => Stream f m r -> m (Either r (f (Stream f m r)))
- intercalates :: (Monad m, Monad (t m), MonadTrans t) => t m x -> Stream (t m) m r -> t m r
- interleaves :: (Monad m, Applicative h) => Stream h m r -> Stream h m r -> Stream h m r
- iterT :: (Functor f, Monad m) => (f (m a) -> m a) -> Stream f m a -> m a
- iterTM :: (Functor f, Monad m, MonadTrans t, Monad (t m)) => (f (t m a) -> t m a) -> Stream f m a -> t m a
- maps :: (Monad m, Functor f) => (forall x. f x -> g x) -> Stream f m r -> Stream g m r
- mapsM :: (Monad m, Functor f) => (forall x. f x -> m (g x)) -> Stream f m r -> Stream g m r
- mapsMPost :: (Monad m, Functor g) => (forall x. f x -> m (g x)) -> Stream f m r -> Stream g m r
- mapsM_ :: (Functor f, Monad m) => (forall x. f x -> m x) -> Stream f m r -> m r
- mapsPost :: (Monad m, Functor g) => (forall x. f x -> g x) -> Stream f m r -> Stream g m r
- never :: (Monad m, Applicative f) => Stream f m r
- repeats :: (Monad m, Functor f) => f () -> Stream f m r
- repeatsM :: (Monad m, Functor f) => m (f ()) -> Stream f m r
- replicates :: (Monad m, Functor f) => Int -> f () -> Stream f m ()
- run :: Monad m => Stream m m r -> m r
- separate :: (Monad m, Functor f, Functor g) => Stream (Sum f g) m r -> Stream f (Stream g m) r
- splitsAt :: (Monad m, Functor f) => Int -> Stream f m r -> Stream f m (Stream f m r)
- streamBuild :: (forall b. (r -> b) -> (m b -> b) -> (f b -> b) -> b) -> Stream f m r
- streamFold :: (Functor f, Monad m) => (r -> b) -> (m b -> b) -> (f b -> b) -> Stream f m r -> b
- takes :: (Monad m, Functor f) => Int -> Stream f m r -> Stream f m ()
- unfold :: (Monad m, Functor f) => (s -> m (Either r (f s))) -> s -> Stream f m r
- unseparate :: (Monad m, Functor f, Functor g) => Stream f (Stream g m) r -> Stream (Sum f g) m r
- untilJust :: (Monad m, Applicative f) => m (Maybe r) -> Stream f m r
- unzips :: (Monad m, Functor f, Functor g) => Stream (Compose f g) m r -> Stream f (Stream g m) r
- wrap :: (Monad m, Functor f) => f (Stream f m r) -> Stream f m r
- yields :: (Monad m, Functor f) => f r -> Stream f m r
- zips :: (Monad m, Functor f, Functor g) => Stream f m r -> Stream g m r -> Stream (Compose f g) m r
- zipsWith :: (Monad m, Functor h) => (forall x y. f x -> g y -> h (x, y)) -> Stream f m r -> Stream g m r -> Stream h m r
- zipsWith' :: Monad m => (forall x y p. (x -> y -> p) -> f x -> g y -> h p) -> Stream f m r -> Stream g m r -> Stream h m r
- lazily :: Of a b -> (a, b)
- mapped :: (Monad m, Functor f) => (forall x. f x -> m (g x)) -> Stream f m r -> Stream g m r
- mappedPost :: (Monad m, Functor g) => (forall x. f x -> m (g x)) -> Stream f m r -> Stream g m r
- strictly :: (a, b) -> Of a b
- class MFunctor (t :: (Type -> Type) -> k -> Type) where
- class (MFunctor t, MonadTrans t) => MMonad (t :: (Type -> Type) -> Type -> Type) where
- data Of a b = !a :> b
- data Stream (f :: Type -> Type) (m :: Type -> Type) r
- each :: (Monad m, Foldable f) => f a -> Stream (Of a) m ()
Documentation
class Monad m => MonadIO (m :: Type -> Type) where Source #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Instances
MonadIO IO | Since: base-4.9.0.0 |
MonadIO Q | |
MonadIO m => MonadIO (ListT m) | |
MonadIO m => MonadIO (MaybeT m) | |
MonadIO m => MonadIO (ByteStream m) Source # | |
Defined in Bio.Streaming.Bytes liftIO :: IO a -> ByteStream m a Source # | |
MonadIO m => MonadIO (IdentityT m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (ExceptT e m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadIO m => MonadIO (StateT s m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) | |
MonadIO m => MonadIO (SelectT r m) | |
(MonadIO m, Functor f) => MonadIO (Stream f m) | |
MonadIO m => MonadIO (Parser r m) Source # | |
MonadIO m => MonadIO (Furrow a m) Source # | |
MonadIO m => MonadIO (ContT r m) | |
MonadIO m => MonadIO (ReaderT r m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
class MonadCatch m => MonadMask (m :: Type -> Type) #
mask, uninterruptibleMask, generalBracket
Instances
MonadMask IO | |
e ~ SomeException => MonadMask (Either e) | |
MonadMask m => MonadMask (MaybeT m) | |
MonadMask m => MonadMask (IdentityT m) | |
Defined in Control.Monad.Catch mask :: ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b uninterruptibleMask :: ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b generalBracket :: IdentityT m a -> (a -> ExitCase b -> IdentityT m c) -> (a -> IdentityT m b) -> IdentityT m (b, c) | |
(Error e, MonadMask m) => MonadMask (ErrorT e m) | |
Defined in Control.Monad.Catch | |
MonadMask m => MonadMask (ExceptT e m) | |
Defined in Control.Monad.Catch mask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b uninterruptibleMask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b generalBracket :: ExceptT e m a -> (a -> ExitCase b -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m (b, c) | |
MonadMask m => MonadMask (StateT s m) | |
Defined in Control.Monad.Catch | |
MonadMask m => MonadMask (StateT s m) | |
Defined in Control.Monad.Catch | |
(MonadMask m, Monoid w) => MonadMask (WriterT w m) | |
Defined in Control.Monad.Catch mask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b uninterruptibleMask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b generalBracket :: WriterT w m a -> (a -> ExitCase b -> WriterT w m c) -> (a -> WriterT w m b) -> WriterT w m (b, c) | |
(MonadMask m, Monoid w) => MonadMask (WriterT w m) | |
Defined in Control.Monad.Catch mask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b uninterruptibleMask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b generalBracket :: WriterT w m a -> (a -> ExitCase b -> WriterT w m c) -> (a -> WriterT w m b) -> WriterT w m (b, c) | |
MonadMask m => MonadMask (ReaderT r m) | |
Defined in Control.Monad.Catch mask :: ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b uninterruptibleMask :: ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b generalBracket :: ReaderT r m a -> (a -> ExitCase b -> ReaderT r m c) -> (a -> ReaderT r m b) -> ReaderT r m (b, c) | |
(MonadMask m, Monoid w) => MonadMask (RWST r w s m) | |
Defined in Control.Monad.Catch mask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b uninterruptibleMask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b generalBracket :: RWST r w s m a -> (a -> ExitCase b -> RWST r w s m c) -> (a -> RWST r w s m b) -> RWST r w s m (b, c) | |
(MonadMask m, Monoid w) => MonadMask (RWST r w s m) | |
Defined in Control.Monad.Catch mask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b uninterruptibleMask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b generalBracket :: RWST r w s m a -> (a -> ExitCase b -> RWST r w s m c) -> (a -> RWST r w s m b) -> RWST r w s m (b, c) |
data ByteStream m r Source #
A space-efficient representation of a succession of Word8
vectors, supporting many
efficient operations.
An effectful ByteStream
contains 8-bit bytes, or by using certain
operations can be interpreted as containing 8-bit characters. It
also contains an offset, which will be needed to track the virtual
offsets in the BGZF decode.
Instances
streamFile :: (MonadIO m, MonadMask m) => FilePath -> (ByteStream m () -> m r) -> m r Source #
streamHandle :: MonadIO m => Handle -> ByteStream m () Source #
streamInput :: (MonadIO m, MonadMask m) => FilePath -> (ByteStream m () -> m r) -> m r Source #
Reads stdin
if the filename is "-", else reads the named file.
streamInputs :: MonadIO m => [FilePath] -> (Stream (ByteStream m) m () -> r) -> r Source #
Reads multiple inputs in sequence.
Only one file is opened at a time, so they must also be consumed in sequence. The filename "-" refers to stdin, if no filenames are given, stdin is read.
progressGen :: MonadIO m => (Int -> a -> String) -> Int -> (String -> IO ()) -> Stream (Of a) m r -> Stream (Of a) m r Source #
A general progress indicator that prints some message after a set number of records have passed through.
progressNum :: MonadIO m => String -> Int -> (String -> IO ()) -> Stream (Of a) m r -> Stream (Of a) m r Source #
A simple progress indicator that prints the number of records.
progressPos :: MonadIO m => (a -> (Refseq, Int)) -> String -> Refs -> Int -> (String -> IO ()) -> Stream (Of a) m r -> Stream (Of a) m r Source #
A simple progress indicator that prints a position every set number of passed records.
mergeStreams :: (Monad m, Ord a) => Stream (Of a) m r -> Stream (Of a) m s -> Stream (Of a) m (r, s) Source #
mergeStreamsBy :: Monad m => (a -> a -> Ordering) -> Stream (Of a) m r -> Stream (Of a) m s -> Stream (Of a) m (r, s) Source #
mergeStreamsOn :: (Monad m, Ord b) => (a -> b) -> Stream (Of a) m r -> Stream (Of a) m s -> Stream (Of a) m (r, s) Source #
join :: Monad m => m (m a) -> m a Source #
The join
function is the conventional monad join operator. It
is used to remove one level of monadic structure, projecting its
bound argument into the outer level.
Examples
A common use of join
is to run an IO
computation returned from
an STM
transaction, since STM
transactions
can't perform IO
directly. Recall that
atomically
:: STM a -> IO a
is used to run STM
transactions atomically. So, by
specializing the types of atomically
and join
to
atomically
:: STM (IO b) -> IO (IO b)join
:: IO (IO b) -> IO b
we can compose them as
join
.atomically
:: STM (IO b) -> IO b
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source #
newtype Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) :: forall k k1. (k -> Type) -> (k1 -> k) -> k1 -> Type infixr 9 Source #
Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.
Compose infixr 9 | |
|
Instances
Functor f => Generic1 (Compose f g :: k -> Type) | |
Functor f => MFunctor (Compose f :: (Type -> Type) -> Type -> Type) | |
(Functor f, Functor g) => Functor (Compose f g) | Since: base-4.9.0.0 |
(Applicative f, Applicative g) => Applicative (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose pure :: a -> Compose f g a Source # (<*>) :: Compose f g (a -> b) -> Compose f g a -> Compose f g b Source # liftA2 :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c Source # (*>) :: Compose f g a -> Compose f g b -> Compose f g b Source # (<*) :: Compose f g a -> Compose f g b -> Compose f g a Source # | |
(Foldable f, Foldable g) => Foldable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose fold :: Monoid m => Compose f g m -> m Source # foldMap :: Monoid m => (a -> m) -> Compose f g a -> m Source # foldr :: (a -> b -> b) -> b -> Compose f g a -> b Source # foldr' :: (a -> b -> b) -> b -> Compose f g a -> b Source # foldl :: (b -> a -> b) -> b -> Compose f g a -> b Source # foldl' :: (b -> a -> b) -> b -> Compose f g a -> b Source # foldr1 :: (a -> a -> a) -> Compose f g a -> a Source # foldl1 :: (a -> a -> a) -> Compose f g a -> a Source # toList :: Compose f g a -> [a] Source # null :: Compose f g a -> Bool Source # length :: Compose f g a -> Int Source # elem :: Eq a => a -> Compose f g a -> Bool Source # maximum :: Ord a => Compose f g a -> a Source # minimum :: Ord a => Compose f g a -> a Source # | |
(Traversable f, Traversable g) => Traversable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose traverse :: Applicative f0 => (a -> f0 b) -> Compose f g a -> f0 (Compose f g b) Source # sequenceA :: Applicative f0 => Compose f g (f0 a) -> f0 (Compose f g a) Source # mapM :: Monad m => (a -> m b) -> Compose f g a -> m (Compose f g b) Source # sequence :: Monad m => Compose f g (m a) -> m (Compose f g a) Source # | |
(Eq1 f, Eq1 g) => Eq1 (Compose f g) | Since: base-4.9.0.0 |
(Ord1 f, Ord1 g) => Ord1 (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
(Read1 f, Read1 g) => Read1 (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Compose f g a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Compose f g a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Compose f g a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Compose f g a] Source # | |
(Show1 f, Show1 g) => Show1 (Compose f g) | Since: base-4.9.0.0 |
(Alternative f, Applicative g) => Alternative (Compose f g) | Since: base-4.9.0.0 |
(Hashable1 f, Hashable1 g) => Hashable1 (Compose f g) | |
Defined in Data.Hashable.Class | |
(Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) | Since: base-4.9.0.0 |
(Typeable a, Typeable f, Typeable g, Typeable k1, Typeable k2, Data (f (g a))) => Data (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Compose f g a -> c (Compose f g a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Compose f g a) Source # toConstr :: Compose f g a -> Constr Source # dataTypeOf :: Compose f g a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Compose f g a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Compose f g a)) Source # gmapT :: (forall b. Data b => b -> b) -> Compose f g a -> Compose f g a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Compose f g a -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Compose f g a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Compose f g a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Compose f g a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Compose f g a -> m (Compose f g a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Compose f g a -> m (Compose f g a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Compose f g a -> m (Compose f g a) Source # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose compare :: Compose f g a -> Compose f g a -> Ordering Source # (<) :: Compose f g a -> Compose f g a -> Bool Source # (<=) :: Compose f g a -> Compose f g a -> Bool Source # (>) :: Compose f g a -> Compose f g a -> Bool Source # (>=) :: Compose f g a -> Compose f g a -> Bool Source # max :: Compose f g a -> Compose f g a -> Compose f g a Source # min :: Compose f g a -> Compose f g a -> Compose f g a Source # | |
(Read1 f, Read1 g, Read a) => Read (Compose f g a) | Since: base-4.9.0.0 |
(Show1 f, Show1 g, Show a) => Show (Compose f g a) | Since: base-4.9.0.0 |
Generic (Compose f g a) | |
(Hashable1 f, Hashable1 g, Hashable a) => Hashable (Compose f g a) | |
Defined in Data.Hashable.Class | |
type Rep1 (Compose f g :: k -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
type Rep (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose |
data Sum (f :: k -> Type) (g :: k -> Type) (a :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type Source #
Lifted sum of functors.
Instances
Generic1 (Sum f g :: k -> Type) | |
(Functor f, Functor g) => Functor (Sum f g) | Since: base-4.9.0.0 |
(Foldable f, Foldable g) => Foldable (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum fold :: Monoid m => Sum f g m -> m Source # foldMap :: Monoid m => (a -> m) -> Sum f g a -> m Source # foldr :: (a -> b -> b) -> b -> Sum f g a -> b Source # foldr' :: (a -> b -> b) -> b -> Sum f g a -> b Source # foldl :: (b -> a -> b) -> b -> Sum f g a -> b Source # foldl' :: (b -> a -> b) -> b -> Sum f g a -> b Source # foldr1 :: (a -> a -> a) -> Sum f g a -> a Source # foldl1 :: (a -> a -> a) -> Sum f g a -> a Source # toList :: Sum f g a -> [a] Source # null :: Sum f g a -> Bool Source # length :: Sum f g a -> Int Source # elem :: Eq a => a -> Sum f g a -> Bool Source # maximum :: Ord a => Sum f g a -> a Source # minimum :: Ord a => Sum f g a -> a Source # | |
(Traversable f, Traversable g) => Traversable (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
(Eq1 f, Eq1 g) => Eq1 (Sum f g) | Since: base-4.9.0.0 |
(Ord1 f, Ord1 g) => Ord1 (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
(Read1 f, Read1 g) => Read1 (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Sum f g a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Sum f g a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Sum f g a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Sum f g a] Source # | |
(Show1 f, Show1 g) => Show1 (Sum f g) | Since: base-4.9.0.0 |
(Hashable1 f, Hashable1 g) => Hashable1 (Sum f g) | |
Defined in Data.Hashable.Class | |
(Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) | Since: base-4.9.0.0 |
(Typeable a, Typeable f, Typeable g, Typeable k, Data (f a), Data (g a)) => Data (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Sum f g a -> c (Sum f g a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Sum f g a) Source # toConstr :: Sum f g a -> Constr Source # dataTypeOf :: Sum f g a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Sum f g a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Sum f g a)) Source # gmapT :: (forall b. Data b => b -> b) -> Sum f g a -> Sum f g a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Sum f g a -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Sum f g a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Sum f g a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Sum f g a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Sum f g a -> m (Sum f g a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum f g a -> m (Sum f g a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum f g a -> m (Sum f g a) Source # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
(Read1 f, Read1 g, Read a) => Read (Sum f g a) | Since: base-4.9.0.0 |
(Show1 f, Show1 g, Show a) => Show (Sum f g a) | Since: base-4.9.0.0 |
Generic (Sum f g a) | |
(Hashable1 f, Hashable1 g, Hashable a) => Hashable (Sum f g a) | |
Defined in Data.Hashable.Class | |
type Rep1 (Sum f g :: k -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum type Rep1 (Sum f g :: k -> Type) = D1 (MetaData "Sum" "Data.Functor.Sum" "base" False) (C1 (MetaCons "InL" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f)) :+: C1 (MetaCons "InR" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g))) | |
type Rep (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum type Rep (Sum f g a) = D1 (MetaData "Sum" "Data.Functor.Sum" "base" False) (C1 (MetaCons "InL" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f a))) :+: C1 (MetaCons "InR" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g a)))) |
class Bifunctor (p :: Type -> Type -> Type) where Source #
A bifunctor is a type constructor that takes
two type arguments and is a functor in both arguments. That
is, unlike with Functor
, a type constructor such as Either
does not need to be partially applied for a Bifunctor
instance, and the methods in this class permit mapping
functions over the Left
value or the Right
value,
or both at the same time.
Formally, the class Bifunctor
represents a bifunctor
from Hask
-> Hask
.
Intuitively it is a bifunctor where both the first and second arguments are covariant.
You can define a Bifunctor
by either defining bimap
or by
defining both first
and second
.
If you supply bimap
, you should ensure that:
bimap
id
id
≡id
If you supply first
and second
, ensure:
first
id
≡id
second
id
≡id
If you supply both, you should also ensure:
bimap
f g ≡first
f.
second
g
These ensure by parametricity:
bimap
(f.
g) (h.
i) ≡bimap
f h.
bimap
g ifirst
(f.
g) ≡first
f.
first
gsecond
(f.
g) ≡second
f.
second
g
Since: base-4.8.0.0
bimap :: (a -> b) -> (c -> d) -> p a c -> p b d Source #
Map over both arguments at the same time.
bimap
f g ≡first
f.
second
g
Examples
>>>
bimap toUpper (+1) ('j', 3)
('J',4)
>>>
bimap toUpper (+1) (Left 'j')
Left 'J'
>>>
bimap toUpper (+1) (Right 3)
Right 4
Instances
Bifunctor Either | Since: base-4.8.0.0 |
Bifunctor (,) | Since: base-4.8.0.0 |
Bifunctor Arg | Since: base-4.9.0.0 |
Bifunctor Of | |
Bifunctor ((,,) x1) | Since: base-4.8.0.0 |
Bifunctor (Const :: Type -> Type -> Type) | Since: base-4.8.0.0 |
Bifunctor (K1 i :: Type -> Type -> Type) | Since: base-4.9.0.0 |
Bifunctor ((,,,) x1 x2) | Since: base-4.8.0.0 |
Bifunctor ((,,,,) x1 x2 x3) | Since: base-4.8.0.0 |
Bifunctor ((,,,,,) x1 x2 x3 x4) | Since: base-4.8.0.0 |
Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) | Since: base-4.8.0.0 |
class Monad m => MonadIO (m :: Type -> Type) where Source #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Instances
MonadIO IO | Since: base-4.9.0.0 |
MonadIO Q | |
MonadIO m => MonadIO (ListT m) | |
MonadIO m => MonadIO (MaybeT m) | |
MonadIO m => MonadIO (ByteStream m) Source # | |
Defined in Bio.Streaming.Bytes liftIO :: IO a -> ByteStream m a Source # | |
MonadIO m => MonadIO (IdentityT m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (ExceptT e m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadIO m => MonadIO (StateT s m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) | |
MonadIO m => MonadIO (SelectT r m) | |
(MonadIO m, Functor f) => MonadIO (Stream f m) | |
MonadIO m => MonadIO (Parser r m) Source # | |
MonadIO m => MonadIO (Furrow a m) Source # | |
MonadIO m => MonadIO (ContT r m) | |
MonadIO m => MonadIO (ReaderT r m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
Identity functor and monad. (a non-strict monad)
Since: base-4.8.0.0
Identity | |
|
Instances
void :: Functor f => f a -> f () Source #
discards or ignores the result of evaluation, such
as the return value of an void
valueIO
action.
Examples
Replace the contents of a
with unit:Maybe
Int
>>>
void Nothing
Nothing>>>
void (Just 3)
Just ()
Replace the contents of an
with unit,
resulting in an Either
Int
Int
:Either
Int
'()'
>>>
void (Left 8675309)
Left 8675309>>>
void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>>
void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>>
void (1,2)
(1,())
Discard the result of an IO
action:
>>>
mapM print [1,2]
1 2 [(),()]>>>
void $ mapM print [1,2]
1 2
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r Source #
Promote a function to a monad, scanning the monadic arguments from left to right. For example,
liftM2 (+) [0,1] [0,2] = [0,2,1,3] liftM2 (+) (Just 1) Nothing = Nothing
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source #
Lift a ternary function to actions.
class Applicative f => Alternative (f :: Type -> Type) where Source #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
Instances
class MonadTrans (t :: (Type -> Type) -> Type -> Type) where Source #
The class of monad transformers. Instances should satisfy the
following laws, which state that lift
is a monad transformation:
lift :: Monad m => m a -> t m a Source #
Lift a computation from the argument monad to the constructed monad.
Instances
MonadTrans ListT | |
MonadTrans MaybeT | |
MonadTrans ByteStream Source # | |
Defined in Bio.Streaming.Bytes lift :: Monad m => m a -> ByteStream m a Source # | |
MonadTrans (IdentityT :: (Type -> Type) -> Type -> Type) | |
MonadTrans (ErrorT e) | |
MonadTrans (ExceptT e) | |
MonadTrans (StateT s) | |
MonadTrans (StateT s) | |
Monoid w => MonadTrans (WriterT w) | |
Monoid w => MonadTrans (WriterT w) | |
Monoid w => MonadTrans (AccumT w) | |
MonadTrans (SelectT r) | |
Functor f => MonadTrans (Stream f) | |
MonadTrans (Parser r) Source # | |
MonadTrans (Furrow a) Source # | |
MonadTrans (ContT r) | |
MonadTrans (ReaderT r :: (Type -> Type) -> Type -> Type) | |
Monoid w => MonadTrans (RWST r w s) | |
Monoid w => MonadTrans (RWST r w s) | |
distribute :: (Monad m, Functor f, MonadTrans t, MFunctor t, Monad (t (Stream f m))) => Stream f (t m) r -> t (Stream f m) r #
expand :: (Monad m, Functor f) => (forall a b. (g a -> b) -> f a -> h b) -> Stream f m r -> Stream g (Stream h m) r #
expandPost :: (Monad m, Functor g) => (forall a b. (g a -> b) -> f a -> h b) -> Stream f m r -> Stream g (Stream h m) r #
groups :: (Monad m, Functor f, Functor g) => Stream (Sum f g) m r -> Stream (Sum (Stream f m) (Stream g m)) m r #
intercalates :: (Monad m, Monad (t m), MonadTrans t) => t m x -> Stream (t m) m r -> t m r #
interleaves :: (Monad m, Applicative h) => Stream h m r -> Stream h m r -> Stream h m r #
iterTM :: (Functor f, Monad m, MonadTrans t, Monad (t m)) => (f (t m a) -> t m a) -> Stream f m a -> t m a #
never :: (Monad m, Applicative f) => Stream f m r #
streamBuild :: (forall b. (r -> b) -> (m b -> b) -> (f b -> b) -> b) -> Stream f m r #
streamFold :: (Functor f, Monad m) => (r -> b) -> (m b -> b) -> (f b -> b) -> Stream f m r -> b #
zips :: (Monad m, Functor f, Functor g) => Stream f m r -> Stream g m r -> Stream (Compose f g) m r #
zipsWith :: (Monad m, Functor h) => (forall x y. f x -> g y -> h (x, y)) -> Stream f m r -> Stream g m r -> Stream h m r #
zipsWith' :: Monad m => (forall x y p. (x -> y -> p) -> f x -> g y -> h p) -> Stream f m r -> Stream g m r -> Stream h m r #
class MFunctor (t :: (Type -> Type) -> k -> Type) where #
Instances
MFunctor ListT | |
MFunctor Lift | |
MFunctor MaybeT | |
MFunctor (IdentityT :: (Type -> Type) -> Type -> Type) | |
MFunctor (ErrorT e :: (Type -> Type) -> Type -> Type) | |
MFunctor (ExceptT e :: (Type -> Type) -> Type -> Type) | |
MFunctor (StateT s :: (Type -> Type) -> Type -> Type) | |
MFunctor (StateT s :: (Type -> Type) -> Type -> Type) | |
MFunctor (WriterT w :: (Type -> Type) -> Type -> Type) | |
MFunctor (WriterT w :: (Type -> Type) -> Type -> Type) | |
MFunctor (Backwards :: (Type -> Type) -> Type -> Type) | |
Functor f => MFunctor (Stream f :: (Type -> Type) -> Type -> Type) | |
MFunctor (Furrow a :: (Type -> Type) -> Type -> Type) Source # | |
MFunctor (Product f :: (Type -> Type) -> Type -> Type) | |
MFunctor (ReaderT r :: (Type -> Type) -> Type -> Type) | |
Functor f => MFunctor (Compose f :: (Type -> Type) -> Type -> Type) | |
MFunctor (RWST r w s :: (Type -> Type) -> Type -> Type) | |
MFunctor (RWST r w s :: (Type -> Type) -> Type -> Type) | |
class (MFunctor t, MonadTrans t) => MMonad (t :: (Type -> Type) -> Type -> Type) where #
Instances
MMonad ListT | |
MMonad MaybeT | |
MMonad (IdentityT :: (Type -> Type) -> Type -> Type) | |
Error e => MMonad (ErrorT e) | |
MMonad (ExceptT e) | |
Monoid w => MMonad (WriterT w) | |
Monoid w => MMonad (WriterT w) | |
Functor f => MMonad (Stream f) | |
MMonad (Furrow a) Source # | |
MMonad (ReaderT r :: (Type -> Type) -> Type -> Type) | |
!a :> b |
Instances
Bifunctor Of | |
Eq2 Of | |
Ord2 Of | |
Defined in Data.Functor.Of | |
Show2 Of | |
Monoid a => Monad (Of a) | |
Functor (Of a) | |
Monoid a => Applicative (Of a) | |
Foldable (Of a) | |
Defined in Data.Functor.Of fold :: Monoid m => Of a m -> m Source # foldMap :: Monoid m => (a0 -> m) -> Of a a0 -> m Source # foldr :: (a0 -> b -> b) -> b -> Of a a0 -> b Source # foldr' :: (a0 -> b -> b) -> b -> Of a a0 -> b Source # foldl :: (b -> a0 -> b) -> b -> Of a a0 -> b Source # foldl' :: (b -> a0 -> b) -> b -> Of a a0 -> b Source # foldr1 :: (a0 -> a0 -> a0) -> Of a a0 -> a0 Source # foldl1 :: (a0 -> a0 -> a0) -> Of a a0 -> a0 Source # toList :: Of a a0 -> [a0] Source # null :: Of a a0 -> Bool Source # length :: Of a a0 -> Int Source # elem :: Eq a0 => a0 -> Of a a0 -> Bool Source # maximum :: Ord a0 => Of a a0 -> a0 Source # minimum :: Ord a0 => Of a a0 -> a0 Source # | |
Traversable (Of a) | |
Eq a => Eq1 (Of a) | |
Ord a => Ord1 (Of a) | |
Defined in Data.Functor.Of | |
Show a => Show1 (Of a) | |
Generic1 (Of a :: Type -> Type) | |
(Eq a, Eq b) => Eq (Of a b) | |
(Data a, Data b) => Data (Of a b) | |
Defined in Data.Functor.Of gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Of a b -> c (Of a b) Source # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Of a b) Source # toConstr :: Of a b -> Constr Source # dataTypeOf :: Of a b -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Of a b)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Of a b)) Source # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Of a b -> Of a b Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Of a b -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Of a b -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Of a b -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Of a b -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Of a b -> m (Of a b) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Of a b -> m (Of a b) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Of a b -> m (Of a b) Source # | |
(Ord a, Ord b) => Ord (Of a b) | |
Defined in Data.Functor.Of | |
(Read a, Read b) => Read (Of a b) | |
(Show a, Show b) => Show (Of a b) | |
Generic (Of a b) | |
(Semigroup a, Semigroup b) => Semigroup (Of a b) | |
(Monoid a, Monoid b) => Monoid (Of a b) | |
type Rep1 (Of a :: Type -> Type) | |
Defined in Data.Functor.Of type Rep1 (Of a :: Type -> Type) = D1 (MetaData "Of" "Data.Functor.Of" "streaming-0.2.2.0-6BC4Zeul6ZYBVIvxn7NEdF" False) (C1 (MetaCons ":>" (InfixI RightAssociative 5) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1)) | |
type Rep (Of a b) | |
Defined in Data.Functor.Of type Rep (Of a b) = D1 (MetaData "Of" "Data.Functor.Of" "streaming-0.2.2.0-6BC4Zeul6ZYBVIvxn7NEdF" False) (C1 (MetaCons ":>" (InfixI RightAssociative 5) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 b))) |
data Stream (f :: Type -> Type) (m :: Type -> Type) r #