semigroupoids-6.0.1: Semigroupoids: Category sans id

Copyright | (C) 2011-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Trustworthy
Language | Haskell2010

Data.Functor.Plus

Description

Synopsis

- class Alt f => Plus (f :: Type -> Type) where
  - zero :: f a
- psum :: (Foldable t, Plus f) => t (f a) -> f a
- gzero :: (Plus (Rep1 f), Generic1 f) => f a
- module Data.Functor.Alt

# Documentation

class Alt f => Plus (f :: Type -> Type) where Source #

Laws:

    zero <!> m = m
    m <!> zero = m

If extended to an `Alternative` then `zero` should equal `empty`.

Methods

zero :: f a Source #

#### Instances

Instances details

Plus IntMap Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: IntMap a Source #
Plus Seq Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Seq a Source #
Plus First Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: First a Source #
Plus Last Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Last a Source #
Plus IO Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: IO a Source #
Plus Maybe Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Maybe a Source #
Plus [] Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: [a] Source #
MonadPlus m => Plus (WrappedMonad m) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: WrappedMonad m a Source #
Ord k => Plus (Map k) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Map k a Source #
Plus (Proxy :: Type -> Type) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Proxy a Source #
Plus (U1 :: Type -> Type) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: U1 a Source #
Alternative f => Plus (WrappedApplicative f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: WrappedApplicative f a Source #
Plus f => Plus (Lift f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Lift f a Source #
(Functor f, Monad f) => Plus (MaybeT f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: MaybeT f a Source #
(Hashable k, Eq k) => Plus (HashMap k) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: HashMap k a Source #
ArrowPlus a => Plus (WrappedArrow a b) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: WrappedArrow a b a0 Source #
Plus f => Plus (Rec1 f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Rec1 f a Source #
Plus f => Plus (Static f a) Source # |
Instance details Defined in Data.Semigroupoid.Static Methods zero :: Static f a a0 Source #
Plus f => Plus (Backwards f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Backwards f a Source #
(Functor f, Monad f, Semigroup e, Monoid e) => Plus (ExceptT e f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: ExceptT e f a Source #
Plus f => Plus (IdentityT f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: IdentityT f a Source #
Plus f => Plus (ReaderT e f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: ReaderT e f a Source #
Plus f => Plus (StateT e f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: StateT e f a Source #
Plus f => Plus (StateT e f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: StateT e f a Source #
Plus f => Plus (WriterT w f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Plus Methods zero :: WriterT w f a Source #
Plus f => Plus (WriterT w f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: WriterT w f a Source #
Plus f => Plus (WriterT w f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: WriterT w f a Source #
Plus f => Plus (Reverse f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Reverse f a Source #
(Plus f, Plus g) => Plus (Product f g) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Product f g a Source #
(Plus f, Plus g) => Plus (f :*: g) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: (f :*: g) a Source #
Monoid c => Plus (K1 i c :: Type -> Type) Source # | Since: 5.3.8
Instance details Defined in Data.Functor.Plus Methods zero :: K1 i c a Source #
(Plus f, Functor g) => Plus (Compose f g) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: Compose f g a Source #
(Plus f, Functor g) => Plus (f :.: g) Source # | Since: 5.3.8
Instance details Defined in Data.Functor.Plus Methods zero :: (f :.: g) a Source #
Plus f => Plus (M1 i c f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: M1 i c f a Source #
Plus f => Plus (RWST r w s f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Plus Methods zero :: RWST r w s f a Source #
Plus f => Plus (RWST r w s f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: RWST r w s f a Source #
Plus f => Plus (RWST r w s f) Source # |
Instance details Defined in Data.Functor.Plus Methods zero :: RWST r w s f a Source #

psum :: (Foldable t, Plus f) => t (f a) -> f a Source #

The sum of a collection of actions, generalizing `concat`.

    >>> psum [Just "Hello", Nothing, Just "World"]
    Just "Hello"

Since: 5.3.6

gzero :: (Plus (Rep1 f), Generic1 f) => f a Source #

Generic `zero`. Caveats:

1. Will not compile if `f` is a sum type.
2. Any types where the `a` does not appear must have a `Monoid` instance.

Since: 5.3.8

module Data.Functor.Alt