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 #

Laws:

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

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

Methods

zero :: f a #

#### Instances

Instances details

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

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

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 #

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