Movatterモバイル変換


[0]ホーム

URL:


base-4.12.0.0: Basic libraries

CopyrightConor McBride and Ross Paterson 2005
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Control.Applicative

Contents

Description

This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation>>=, but

  • it has more instances.
  • it is sufficient for many uses, e.g. context-free parsing, or theTraversable class.
  • instances can perform analysis of computations before they are executed, and thus produce shared optimizations.

This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra.

For more details, seeApplicative Programming with Effects, by Conor McBride and Ross Paterson.

Synopsis

Applicative functors

classFunctor f =>Applicative fwhereSource#

A functor with application, providing operations to

  • embed pure expressions (pure), and
  • sequence computations and combine their results (<*> andliftA2).

A minimal complete definition must include implementations ofpure and of either<*> orliftA2. If it defines both, then they must behave the same as their default definitions:

(<*>) =liftA2id
liftA2 f x y = f<$> x<*> y

Further, any definition must satisfy the following:

identity
pureid<*> v = v
composition
pure (.)<*> u<*> v<*> w = u<*> (v<*> w)
homomorphism
pure f<*>pure x =pure (f x)
interchange
u<*>pure y =pure ($ y)<*> u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

As a consequence of these laws, theFunctor instance forf will satisfy

It may be useful to note that supposing

forall x y. p (q x y) = f x . g y

it follows from the above that

liftA2 p (liftA2 q u v) =liftA2 f u .liftA2 g v

Iff is also aMonad, it should satisfy

(which implies thatpure and<*> satisfy the applicative functor laws).

Minimal complete definition

pure, ((<*>) |liftA2)

Methods

pure :: a -> f aSource#

Lift a value.

(<*>) :: f (a -> b) -> f a -> f binfixl 4Source#

Sequential application.

A few functors support an implementation of<*> that is more efficient than the default one.

liftA2 :: (a -> b -> c) -> f a -> f b -> f cSource#

Lift a binary function to actions.

Some functors support an implementation ofliftA2 that is more efficient than the default one. In particular, iffmap is an expensive operation, it is likely better to useliftA2 than tofmap over the structure and then use<*>.

(*>) :: f a -> f b -> f binfixl 4Source#

Sequence actions, discarding the value of the first argument.

(<*) :: f a -> f b -> f ainfixl 4Source#

Sequence actions, discarding the value of the second argument.

Instances
Applicative []Source#

Since: 2.1

Instance details

Defined inGHC.Base

Methods

pure :: a -> [a]Source#

(<*>) :: [a -> b] -> [a] -> [b]Source#

liftA2 :: (a -> b -> c) -> [a] -> [b] -> [c]Source#

(*>) :: [a] -> [b] -> [b]Source#

(<*) :: [a] -> [b] -> [a]Source#

ApplicativeMaybeSource#

Since: 2.1

Instance details

Defined inGHC.Base

Methods

pure :: a ->Maybe aSource#

(<*>) ::Maybe (a -> b) ->Maybe a ->Maybe bSource#

liftA2 :: (a -> b -> c) ->Maybe a ->Maybe b ->Maybe cSource#

(*>) ::Maybe a ->Maybe b ->Maybe bSource#

(<*) ::Maybe a ->Maybe b ->Maybe aSource#

ApplicativeIOSource#

Since: 2.1

Instance details

Defined inGHC.Base

Methods

pure :: a ->IO aSource#

(<*>) ::IO (a -> b) ->IO a ->IO bSource#

liftA2 :: (a -> b -> c) ->IO a ->IO b ->IO cSource#

(*>) ::IO a ->IO b ->IO bSource#

(<*) ::IO a ->IO b ->IO aSource#

ApplicativePar1Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a ->Par1 aSource#

(<*>) ::Par1 (a -> b) ->Par1 a ->Par1 bSource#

liftA2 :: (a -> b -> c) ->Par1 a ->Par1 b ->Par1 cSource#

(*>) ::Par1 a ->Par1 b ->Par1 bSource#

(<*) ::Par1 a ->Par1 b ->Par1 aSource#

ApplicativeNonEmptySource#

Since: 4.9.0.0

Instance details

Defined inGHC.Base

ApplicativeReadPSource#

Since: 4.6.0.0

Instance details

Defined inText.ParserCombinators.ReadP

Methods

pure :: a ->ReadP aSource#

(<*>) ::ReadP (a -> b) ->ReadP a ->ReadP bSource#

liftA2 :: (a -> b -> c) ->ReadP a ->ReadP b ->ReadP cSource#

(*>) ::ReadP a ->ReadP b ->ReadP bSource#

(<*) ::ReadP a ->ReadP b ->ReadP aSource#

ApplicativeReadPrecSource#

Since: 4.6.0.0

Instance details

Defined inText.ParserCombinators.ReadPrec

ApplicativeDownSource#

Since: 4.11.0.0

Instance details

Defined inData.Ord

Methods

pure :: a ->Down aSource#

(<*>) ::Down (a -> b) ->Down a ->Down bSource#

liftA2 :: (a -> b -> c) ->Down a ->Down b ->Down cSource#

(*>) ::Down a ->Down b ->Down bSource#

(<*) ::Down a ->Down b ->Down aSource#

ApplicativeProductSource#

Since: 4.8.0.0

Instance details

Defined inData.Semigroup.Internal

Methods

pure :: a ->Product aSource#

(<*>) ::Product (a -> b) ->Product a ->Product bSource#

liftA2 :: (a -> b -> c) ->Product a ->Product b ->Product cSource#

(*>) ::Product a ->Product b ->Product bSource#

(<*) ::Product a ->Product b ->Product aSource#

ApplicativeSumSource#

Since: 4.8.0.0

Instance details

Defined inData.Semigroup.Internal

Methods

pure :: a ->Sum aSource#

(<*>) ::Sum (a -> b) ->Sum a ->Sum bSource#

liftA2 :: (a -> b -> c) ->Sum a ->Sum b ->Sum cSource#

(*>) ::Sum a ->Sum b ->Sum bSource#

(<*) ::Sum a ->Sum b ->Sum aSource#

ApplicativeDualSource#

Since: 4.8.0.0

Instance details

Defined inData.Semigroup.Internal

Methods

pure :: a ->Dual aSource#

(<*>) ::Dual (a -> b) ->Dual a ->Dual bSource#

liftA2 :: (a -> b -> c) ->Dual a ->Dual b ->Dual cSource#

(*>) ::Dual a ->Dual b ->Dual bSource#

(<*) ::Dual a ->Dual b ->Dual aSource#

ApplicativeLastSource#

Since: 4.8.0.0

Instance details

Defined inData.Monoid

Methods

pure :: a ->Last aSource#

(<*>) ::Last (a -> b) ->Last a ->Last bSource#

liftA2 :: (a -> b -> c) ->Last a ->Last b ->Last cSource#

(*>) ::Last a ->Last b ->Last bSource#

(<*) ::Last a ->Last b ->Last aSource#

ApplicativeFirstSource#

Since: 4.8.0.0

Instance details

Defined inData.Monoid

Methods

pure :: a ->First aSource#

(<*>) ::First (a -> b) ->First a ->First bSource#

liftA2 :: (a -> b -> c) ->First a ->First b ->First cSource#

(*>) ::First a ->First b ->First bSource#

(<*) ::First a ->First b ->First aSource#

ApplicativeSTMSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Conc.Sync

Methods

pure :: a ->STM aSource#

(<*>) ::STM (a -> b) ->STM a ->STM bSource#

liftA2 :: (a -> b -> c) ->STM a ->STM b ->STM cSource#

(*>) ::STM a ->STM b ->STM bSource#

(<*) ::STM a ->STM b ->STM aSource#

ApplicativeIdentitySource#

Since: 4.8.0.0

Instance details

Defined inData.Functor.Identity

ApplicativeZipListSource#
f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN    = 'ZipList' (zipWithN f xs1 ... xsN)

wherezipWithN refers to thezipWith function of the appropriate arity (zipWith,zipWith3,zipWith4, ...). For example:

(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]    = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])    = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

pure :: a ->ZipList aSource#

(<*>) ::ZipList (a -> b) ->ZipList a ->ZipList bSource#

liftA2 :: (a -> b -> c) ->ZipList a ->ZipList b ->ZipList cSource#

(*>) ::ZipList a ->ZipList b ->ZipList bSource#

(<*) ::ZipList a ->ZipList b ->ZipList aSource#

ApplicativeOptionSource#

Since: 4.9.0.0

Instance details

Defined inData.Semigroup

Methods

pure :: a ->Option aSource#

(<*>) ::Option (a -> b) ->Option a ->Option bSource#

liftA2 :: (a -> b -> c) ->Option a ->Option b ->Option cSource#

(*>) ::Option a ->Option b ->Option bSource#

(<*) ::Option a ->Option b ->Option aSource#

ApplicativeLastSource#

Since: 4.9.0.0

Instance details

Defined inData.Semigroup

Methods

pure :: a ->Last aSource#

(<*>) ::Last (a -> b) ->Last a ->Last bSource#

liftA2 :: (a -> b -> c) ->Last a ->Last b ->Last cSource#

(*>) ::Last a ->Last b ->Last bSource#

(<*) ::Last a ->Last b ->Last aSource#

ApplicativeFirstSource#

Since: 4.9.0.0

Instance details

Defined inData.Semigroup

Methods

pure :: a ->First aSource#

(<*>) ::First (a -> b) ->First a ->First bSource#

liftA2 :: (a -> b -> c) ->First a ->First b ->First cSource#

(*>) ::First a ->First b ->First bSource#

(<*) ::First a ->First b ->First aSource#

ApplicativeMaxSource#

Since: 4.9.0.0

Instance details

Defined inData.Semigroup

Methods

pure :: a ->Max aSource#

(<*>) ::Max (a -> b) ->Max a ->Max bSource#

liftA2 :: (a -> b -> c) ->Max a ->Max b ->Max cSource#

(*>) ::Max a ->Max b ->Max bSource#

(<*) ::Max a ->Max b ->Max aSource#

ApplicativeMinSource#

Since: 4.9.0.0

Instance details

Defined inData.Semigroup

Methods

pure :: a ->Min aSource#

(<*>) ::Min (a -> b) ->Min a ->Min bSource#

liftA2 :: (a -> b -> c) ->Min a ->Min b ->Min cSource#

(*>) ::Min a ->Min b ->Min bSource#

(<*) ::Min a ->Min b ->Min aSource#

ApplicativeComplexSource#

Since: 4.9.0.0

Instance details

Defined inData.Complex

Methods

pure :: a ->Complex aSource#

(<*>) ::Complex (a -> b) ->Complex a ->Complex bSource#

liftA2 :: (a -> b -> c) ->Complex a ->Complex b ->Complex cSource#

(*>) ::Complex a ->Complex b ->Complex bSource#

(<*) ::Complex a ->Complex b ->Complex aSource#

Applicative (Either e)Source#

Since: 3.0

Instance details

Defined inData.Either

Methods

pure :: a ->Either e aSource#

(<*>) ::Either e (a -> b) ->Either e a ->Either e bSource#

liftA2 :: (a -> b -> c) ->Either e a ->Either e b ->Either e cSource#

(*>) ::Either e a ->Either e b ->Either e bSource#

(<*) ::Either e a ->Either e b ->Either e aSource#

Applicative (U1 ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a ->U1 aSource#

(<*>) ::U1 (a -> b) ->U1 a ->U1 bSource#

liftA2 :: (a -> b -> c) ->U1 a ->U1 b ->U1 cSource#

(*>) ::U1 a ->U1 b ->U1 bSource#

(<*) ::U1 a ->U1 b ->U1 aSource#

Monoid a =>Applicative ((,) a)Source#

For tuples, theMonoid constraint ona determines how the first values merge. For example,Strings concatenate:

("hello ", (+15)) <*> ("world!", 2002)("hello world!",2017)

Since: 2.1

Instance details

Defined inGHC.Base

Methods

pure :: a0 -> (a, a0)Source#

(<*>) :: (a, a0 -> b) -> (a, a0) -> (a, b)Source#

liftA2 :: (a0 -> b -> c) -> (a, a0) -> (a, b) -> (a, c)Source#

(*>) :: (a, a0) -> (a, b) -> (a, b)Source#

(<*) :: (a, a0) -> (a, b) -> (a, a0)Source#

Applicative (ST s)Source#

Since: 4.4.0.0

Instance details

Defined inGHC.ST

Methods

pure :: a ->ST s aSource#

(<*>) ::ST s (a -> b) ->ST s a ->ST s bSource#

liftA2 :: (a -> b -> c) ->ST s a ->ST s b ->ST s cSource#

(*>) ::ST s a ->ST s b ->ST s bSource#

(<*) ::ST s a ->ST s b ->ST s aSource#

Applicative (Proxy ::Type ->Type)Source#

Since: 4.7.0.0

Instance details

Defined inData.Proxy

Methods

pure :: a ->Proxy aSource#

(<*>) ::Proxy (a -> b) ->Proxy a ->Proxy bSource#

liftA2 :: (a -> b -> c) ->Proxy a ->Proxy b ->Proxy cSource#

(*>) ::Proxy a ->Proxy b ->Proxy bSource#

(<*) ::Proxy a ->Proxy b ->Proxy aSource#

Arrow a =>Applicative (ArrowMonad a)Source#

Since: 4.6.0.0

Instance details

Defined inControl.Arrow

Methods

pure :: a0 ->ArrowMonad a a0Source#

(<*>) ::ArrowMonad a (a0 -> b) ->ArrowMonad a a0 ->ArrowMonad a bSource#

liftA2 :: (a0 -> b -> c) ->ArrowMonad a a0 ->ArrowMonad a b ->ArrowMonad a cSource#

(*>) ::ArrowMonad a a0 ->ArrowMonad a b ->ArrowMonad a bSource#

(<*) ::ArrowMonad a a0 ->ArrowMonad a b ->ArrowMonad a a0Source#

Monad m =>Applicative (WrappedMonad m)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Applicative (ST s)Source#

Since: 2.1

Instance details

Defined inControl.Monad.ST.Lazy.Imp

Methods

pure :: a ->ST s aSource#

(<*>) ::ST s (a -> b) ->ST s a ->ST s bSource#

liftA2 :: (a -> b -> c) ->ST s a ->ST s b ->ST s cSource#

(*>) ::ST s a ->ST s b ->ST s bSource#

(<*) ::ST s a ->ST s b ->ST s aSource#

Applicative f =>Applicative (Rec1 f)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a ->Rec1 f aSource#

(<*>) ::Rec1 f (a -> b) ->Rec1 f a ->Rec1 f bSource#

liftA2 :: (a -> b -> c) ->Rec1 f a ->Rec1 f b ->Rec1 f cSource#

(*>) ::Rec1 f a ->Rec1 f b ->Rec1 f bSource#

(<*) ::Rec1 f a ->Rec1 f b ->Rec1 f aSource#

Applicative f =>Applicative (Alt f)Source#

Since: 4.8.0.0

Instance details

Defined inData.Semigroup.Internal

Methods

pure :: a ->Alt f aSource#

(<*>) ::Alt f (a -> b) ->Alt f a ->Alt f bSource#

liftA2 :: (a -> b -> c) ->Alt f a ->Alt f b ->Alt f cSource#

(*>) ::Alt f a ->Alt f b ->Alt f bSource#

(<*) ::Alt f a ->Alt f b ->Alt f aSource#

Applicative f =>Applicative (Ap f)Source#

Since: 4.12.0.0

Instance details

Defined inData.Monoid

Methods

pure :: a ->Ap f aSource#

(<*>) ::Ap f (a -> b) ->Ap f a ->Ap f bSource#

liftA2 :: (a -> b -> c) ->Ap f a ->Ap f b ->Ap f cSource#

(*>) ::Ap f a ->Ap f b ->Ap f bSource#

(<*) ::Ap f a ->Ap f b ->Ap f aSource#

Monoid m =>Applicative (Const m ::Type ->Type)Source#

Since: 2.0.1

Instance details

Defined inData.Functor.Const

Methods

pure :: a ->Const m aSource#

(<*>) ::Const m (a -> b) ->Const m a ->Const m bSource#

liftA2 :: (a -> b -> c) ->Const m a ->Const m b ->Const m cSource#

(*>) ::Const m a ->Const m b ->Const m bSource#

(<*) ::Const m a ->Const m b ->Const m aSource#

Arrow a =>Applicative (WrappedArrow a b)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

pure :: a0 ->WrappedArrow a b a0Source#

(<*>) ::WrappedArrow a b (a0 -> b0) ->WrappedArrow a b a0 ->WrappedArrow a b b0Source#

liftA2 :: (a0 -> b0 -> c) ->WrappedArrow a b a0 ->WrappedArrow a b b0 ->WrappedArrow a b cSource#

(*>) ::WrappedArrow a b a0 ->WrappedArrow a b b0 ->WrappedArrow a b b0Source#

(<*) ::WrappedArrow a b a0 ->WrappedArrow a b b0 ->WrappedArrow a b a0Source#

Applicative ((->) a ::Type ->Type)Source#

Since: 2.1

Instance details

Defined inGHC.Base

Methods

pure :: a0 -> a -> a0Source#

(<*>) :: (a -> (a0 -> b)) -> (a -> a0) -> a -> bSource#

liftA2 :: (a0 -> b -> c) -> (a -> a0) -> (a -> b) -> a -> cSource#

(*>) :: (a -> a0) -> (a -> b) -> a -> bSource#

(<*) :: (a -> a0) -> (a -> b) -> a -> a0Source#

Monoid c =>Applicative (K1 i c ::Type ->Type)Source#

Since: 4.12.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a ->K1 i c aSource#

(<*>) ::K1 i c (a -> b) ->K1 i c a ->K1 i c bSource#

liftA2 :: (a -> b -> c0) ->K1 i c a ->K1 i c b ->K1 i c c0Source#

(*>) ::K1 i c a ->K1 i c b ->K1 i c bSource#

(<*) ::K1 i c a ->K1 i c b ->K1 i c aSource#

(Applicative f,Applicative g) =>Applicative (f:*: g)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a -> (f:*: g) aSource#

(<*>) :: (f:*: g) (a -> b) -> (f:*: g) a -> (f:*: g) bSource#

liftA2 :: (a -> b -> c) -> (f:*: g) a -> (f:*: g) b -> (f:*: g) cSource#

(*>) :: (f:*: g) a -> (f:*: g) b -> (f:*: g) bSource#

(<*) :: (f:*: g) a -> (f:*: g) b -> (f:*: g) aSource#

(Applicative f,Applicative g) =>Applicative (Product f g)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Product

Methods

pure :: a ->Product f g aSource#

(<*>) ::Product f g (a -> b) ->Product f g a ->Product f g bSource#

liftA2 :: (a -> b -> c) ->Product f g a ->Product f g b ->Product f g cSource#

(*>) ::Product f g a ->Product f g b ->Product f g bSource#

(<*) ::Product f g a ->Product f g b ->Product f g aSource#

Applicative f =>Applicative (M1 i c f)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a ->M1 i c f aSource#

(<*>) ::M1 i c f (a -> b) ->M1 i c f a ->M1 i c f bSource#

liftA2 :: (a -> b -> c0) ->M1 i c f a ->M1 i c f b ->M1 i c f c0Source#

(*>) ::M1 i c f a ->M1 i c f b ->M1 i c f bSource#

(<*) ::M1 i c f a ->M1 i c f b ->M1 i c f aSource#

(Applicative f,Applicative g) =>Applicative (f:.: g)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

pure :: a -> (f:.: g) aSource#

(<*>) :: (f:.: g) (a -> b) -> (f:.: g) a -> (f:.: g) bSource#

liftA2 :: (a -> b -> c) -> (f:.: g) a -> (f:.: g) b -> (f:.: g) cSource#

(*>) :: (f:.: g) a -> (f:.: g) b -> (f:.: g) bSource#

(<*) :: (f:.: g) a -> (f:.: g) b -> (f:.: g) aSource#

(Applicative f,Applicative g) =>Applicative (Compose f g)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Compose

Methods

pure :: a ->Compose f g aSource#

(<*>) ::Compose f g (a -> b) ->Compose f g a ->Compose f g bSource#

liftA2 :: (a -> b -> c) ->Compose f g a ->Compose f g b ->Compose f g cSource#

(*>) ::Compose f g a ->Compose f g b ->Compose f g bSource#

(<*) ::Compose f g a ->Compose f g b ->Compose f g aSource#

Alternatives

classApplicative f =>Alternative fwhereSource#

A monoid on applicative functors.

If defined,some andmany should be the least solutions of the equations:

Minimal complete definition

empty,(<|>)

Methods

empty :: f aSource#

The identity of<|>

(<|>) :: f a -> f a -> f ainfixl 3Source#

An associative binary operation

some :: f a -> f [a]Source#

One or more.

many :: f a -> f [a]Source#

Zero or more.

Instances
Alternative []Source#

Since: 2.1

Instance details

Defined inGHC.Base

Methods

empty :: [a]Source#

(<|>) :: [a] -> [a] -> [a]Source#

some :: [a] -> [[a]]Source#

many :: [a] -> [[a]]Source#

AlternativeMaybeSource#

Since: 2.1

Instance details

Defined inGHC.Base

AlternativeIOSource#

Since: 4.9.0.0

Instance details

Defined inGHC.Base

Methods

empty ::IO aSource#

(<|>) ::IO a ->IO a ->IO aSource#

some ::IO a ->IO [a]Source#

many ::IO a ->IO [a]Source#

AlternativeReadPSource#

Since: 4.6.0.0

Instance details

Defined inText.ParserCombinators.ReadP

AlternativeReadPrecSource#

Since: 4.6.0.0

Instance details

Defined inText.ParserCombinators.ReadPrec

AlternativeSTMSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Conc.Sync

Methods

empty ::STM aSource#

(<|>) ::STM a ->STM a ->STM aSource#

some ::STM a ->STM [a]Source#

many ::STM a ->STM [a]Source#

AlternativeZipListSource#

Since: 4.11.0.0

Instance details

Defined inControl.Applicative

AlternativeOptionSource#

Since: 4.9.0.0

Instance details

Defined inData.Semigroup

Alternative (U1 ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

empty ::U1 aSource#

(<|>) ::U1 a ->U1 a ->U1 aSource#

some ::U1 a ->U1 [a]Source#

many ::U1 a ->U1 [a]Source#

Alternative (Proxy ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Proxy

ArrowPlus a =>Alternative (ArrowMonad a)Source#

Since: 4.6.0.0

Instance details

Defined inControl.Arrow

MonadPlus m =>Alternative (WrappedMonad m)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Alternative f =>Alternative (Rec1 f)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

empty ::Rec1 f aSource#

(<|>) ::Rec1 f a ->Rec1 f a ->Rec1 f aSource#

some ::Rec1 f a ->Rec1 f [a]Source#

many ::Rec1 f a ->Rec1 f [a]Source#

Alternative f =>Alternative (Alt f)Source#

Since: 4.8.0.0

Instance details

Defined inData.Semigroup.Internal

Methods

empty ::Alt f aSource#

(<|>) ::Alt f a ->Alt f a ->Alt f aSource#

some ::Alt f a ->Alt f [a]Source#

many ::Alt f a ->Alt f [a]Source#

Alternative f =>Alternative (Ap f)Source#

Since: 4.12.0.0

Instance details

Defined inData.Monoid

Methods

empty ::Ap f aSource#

(<|>) ::Ap f a ->Ap f a ->Ap f aSource#

some ::Ap f a ->Ap f [a]Source#

many ::Ap f a ->Ap f [a]Source#

(ArrowZero a,ArrowPlus a) =>Alternative (WrappedArrow a b)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

(Alternative f,Alternative g) =>Alternative (f:*: g)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

empty :: (f:*: g) aSource#

(<|>) :: (f:*: g) a -> (f:*: g) a -> (f:*: g) aSource#

some :: (f:*: g) a -> (f:*: g) [a]Source#

many :: (f:*: g) a -> (f:*: g) [a]Source#

(Alternative f,Alternative g) =>Alternative (Product f g)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Product

Methods

empty ::Product f g aSource#

(<|>) ::Product f g a ->Product f g a ->Product f g aSource#

some ::Product f g a ->Product f g [a]Source#

many ::Product f g a ->Product f g [a]Source#

Alternative f =>Alternative (M1 i c f)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

empty ::M1 i c f aSource#

(<|>) ::M1 i c f a ->M1 i c f a ->M1 i c f aSource#

some ::M1 i c f a ->M1 i c f [a]Source#

many ::M1 i c f a ->M1 i c f [a]Source#

(Alternative f,Applicative g) =>Alternative (f:.: g)Source#

Since: 4.9.0.0

Instance details

Defined inGHC.Generics

Methods

empty :: (f:.: g) aSource#

(<|>) :: (f:.: g) a -> (f:.: g) a -> (f:.: g) aSource#

some :: (f:.: g) a -> (f:.: g) [a]Source#

many :: (f:.: g) a -> (f:.: g) [a]Source#

(Alternative f,Applicative g) =>Alternative (Compose f g)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Compose

Methods

empty ::Compose f g aSource#

(<|>) ::Compose f g a ->Compose f g a ->Compose f g aSource#

some ::Compose f g a ->Compose f g [a]Source#

many ::Compose f g a ->Compose f g [a]Source#

Instances

newtypeConst a bSource#

TheConst functor.

Constructors

Const 

Fields

Instances
Generic1 (Const a :: k ->Type)Source# 
Instance details

Defined inData.Functor.Const

Associated Types

typeRep1 (Const a) :: k ->TypeSource#

Methods

from1 ::Const a a0 ->Rep1 (Const a) a0Source#

to1 ::Rep1 (Const a) a0 ->Const a a0Source#

Show2 (Const ::Type ->Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftShowsPrec2 :: (Int -> a ->ShowS) -> ([a] ->ShowS) -> (Int -> b ->ShowS) -> ([b] ->ShowS) ->Int ->Const a b ->ShowSSource#

liftShowList2 :: (Int -> a ->ShowS) -> ([a] ->ShowS) -> (Int -> b ->ShowS) -> ([b] ->ShowS) -> [Const a b] ->ShowSSource#

Read2 (Const ::Type ->Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftReadsPrec2 :: (Int ->ReadS a) ->ReadS [a] -> (Int ->ReadS b) ->ReadS [b] ->Int ->ReadS (Const a b)Source#

liftReadList2 :: (Int ->ReadS a) ->ReadS [a] -> (Int ->ReadS b) ->ReadS [b] ->ReadS [Const a b]Source#

liftReadPrec2 ::ReadPrec a ->ReadPrec [a] ->ReadPrec b ->ReadPrec [b] ->ReadPrec (Const a b)Source#

liftReadListPrec2 ::ReadPrec a ->ReadPrec [a] ->ReadPrec b ->ReadPrec [b] ->ReadPrec [Const a b]Source#

Ord2 (Const ::Type ->Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftCompare2 :: (a -> b ->Ordering) -> (c -> d ->Ordering) ->Const a c ->Const b d ->OrderingSource#

Eq2 (Const ::Type ->Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftEq2 :: (a -> b ->Bool) -> (c -> d ->Bool) ->Const a c ->Const b d ->BoolSource#

Bifunctor (Const ::Type ->Type ->Type)Source#

Since: 4.8.0.0

Instance details

Defined inData.Bifunctor

Methods

bimap :: (a -> b) -> (c -> d) ->Const a c ->Const b dSource#

first :: (a -> b) ->Const a c ->Const b cSource#

second :: (b -> c) ->Const a b ->Const a cSource#

Bifoldable (Const ::Type ->Type ->Type)Source#

Since: 4.10.0.0

Instance details

Defined inData.Bifoldable

Methods

bifold ::Monoid m =>Const m m -> mSource#

bifoldMap ::Monoid m => (a -> m) -> (b -> m) ->Const a b -> mSource#

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c ->Const a b -> cSource#

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c ->Const a b -> cSource#

Bitraversable (Const ::Type ->Type ->Type)Source#

Since: 4.10.0.0

Instance details

Defined inData.Bitraversable

Methods

bitraverse ::Applicative f => (a -> f c) -> (b -> f d) ->Const a b -> f (Const c d)Source#

Functor (Const m ::Type ->Type)Source#

Since: 2.1

Instance details

Defined inData.Functor.Const

Methods

fmap :: (a -> b) ->Const m a ->Const m bSource#

(<$) :: a ->Const m b ->Const m aSource#

Monoid m =>Applicative (Const m ::Type ->Type)Source#

Since: 2.0.1

Instance details

Defined inData.Functor.Const

Methods

pure :: a ->Const m aSource#

(<*>) ::Const m (a -> b) ->Const m a ->Const m bSource#

liftA2 :: (a -> b -> c) ->Const m a ->Const m b ->Const m cSource#

(*>) ::Const m a ->Const m b ->Const m bSource#

(<*) ::Const m a ->Const m b ->Const m aSource#

Foldable (Const m ::Type ->Type)Source#

Since: 4.7.0.0

Instance details

Defined inData.Functor.Const

Methods

fold ::Monoid m0 =>Const m m0 -> m0Source#

foldMap ::Monoid m0 => (a -> m0) ->Const m a -> m0Source#

foldr :: (a -> b -> b) -> b ->Const m a -> bSource#

foldr' :: (a -> b -> b) -> b ->Const m a -> bSource#

foldl :: (b -> a -> b) -> b ->Const m a -> bSource#

foldl' :: (b -> a -> b) -> b ->Const m a -> bSource#

foldr1 :: (a -> a -> a) ->Const m a -> aSource#

foldl1 :: (a -> a -> a) ->Const m a -> aSource#

toList ::Const m a -> [a]Source#

null ::Const m a ->BoolSource#

length ::Const m a ->IntSource#

elem ::Eq a => a ->Const m a ->BoolSource#

maximum ::Ord a =>Const m a -> aSource#

minimum ::Ord a =>Const m a -> aSource#

sum ::Num a =>Const m a -> aSource#

product ::Num a =>Const m a -> aSource#

Traversable (Const m ::Type ->Type)Source#

Since: 4.7.0.0

Instance details

Defined inData.Traversable

Methods

traverse ::Applicative f => (a -> f b) ->Const m a -> f (Const m b)Source#

sequenceA ::Applicative f =>Const m (f a) -> f (Const m a)Source#

mapM ::Monad m0 => (a -> m0 b) ->Const m a -> m0 (Const m b)Source#

sequence ::Monad m0 =>Const m (m0 a) -> m0 (Const m a)Source#

Show a =>Show1 (Const a ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftShowsPrec :: (Int -> a0 ->ShowS) -> ([a0] ->ShowS) ->Int ->Const a a0 ->ShowSSource#

liftShowList :: (Int -> a0 ->ShowS) -> ([a0] ->ShowS) -> [Const a a0] ->ShowSSource#

Read a =>Read1 (Const a ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Ord a =>Ord1 (Const a ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftCompare :: (a0 -> b ->Ordering) ->Const a a0 ->Const a b ->OrderingSource#

Eq a =>Eq1 (Const a ::Type ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Classes

Methods

liftEq :: (a0 -> b ->Bool) ->Const a a0 ->Const a b ->BoolSource#

Contravariant (Const a ::Type ->Type)Source# 
Instance details

Defined inData.Functor.Contravariant

Methods

contramap :: (a0 -> b) ->Const a b ->Const a a0Source#

(>$) :: b ->Const a b ->Const a a0Source#

Bounded a =>Bounded (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Enum a =>Enum (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

succ ::Const a b ->Const a bSource#

pred ::Const a b ->Const a bSource#

toEnum ::Int ->Const a bSource#

fromEnum ::Const a b ->IntSource#

enumFrom ::Const a b -> [Const a b]Source#

enumFromThen ::Const a b ->Const a b -> [Const a b]Source#

enumFromTo ::Const a b ->Const a b -> [Const a b]Source#

enumFromThenTo ::Const a b ->Const a b ->Const a b -> [Const a b]Source#

Eq a =>Eq (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

(==) ::Const a b ->Const a b ->Bool#

(/=) ::Const a b ->Const a b ->Bool#

Floating a =>Floating (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

pi ::Const a bSource#

exp ::Const a b ->Const a bSource#

log ::Const a b ->Const a bSource#

sqrt ::Const a b ->Const a bSource#

(**) ::Const a b ->Const a b ->Const a bSource#

logBase ::Const a b ->Const a b ->Const a bSource#

sin ::Const a b ->Const a bSource#

cos ::Const a b ->Const a bSource#

tan ::Const a b ->Const a bSource#

asin ::Const a b ->Const a bSource#

acos ::Const a b ->Const a bSource#

atan ::Const a b ->Const a bSource#

sinh ::Const a b ->Const a bSource#

cosh ::Const a b ->Const a bSource#

tanh ::Const a b ->Const a bSource#

asinh ::Const a b ->Const a bSource#

acosh ::Const a b ->Const a bSource#

atanh ::Const a b ->Const a bSource#

log1p ::Const a b ->Const a bSource#

expm1 ::Const a b ->Const a bSource#

log1pexp ::Const a b ->Const a bSource#

log1mexp ::Const a b ->Const a bSource#

Fractional a =>Fractional (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Integral a =>Integral (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

quot ::Const a b ->Const a b ->Const a bSource#

rem ::Const a b ->Const a b ->Const a bSource#

div ::Const a b ->Const a b ->Const a bSource#

mod ::Const a b ->Const a b ->Const a bSource#

quotRem ::Const a b ->Const a b -> (Const a b,Const a b)Source#

divMod ::Const a b ->Const a b -> (Const a b,Const a b)Source#

toInteger ::Const a b ->IntegerSource#

(Typeable k,Data a,Typeable b) =>Data (Const a b)Source#

Since: 4.10.0.0

Instance details

Defined inData.Data

Methods

gfoldl :: (forall d b0.Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) ->Const a b -> c (Const a b)Source#

gunfold :: (forall b0 r.Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) ->Constr -> c (Const a b)Source#

toConstr ::Const a b ->ConstrSource#

dataTypeOf ::Const a b ->DataTypeSource#

dataCast1 ::Typeable t => (forall d.Data d => c (t d)) ->Maybe (c (Const a b))Source#

dataCast2 ::Typeable t => (forall d e. (Data d,Data e) => c (t d e)) ->Maybe (c (Const a b))Source#

gmapT :: (forall b0.Data b0 => b0 -> b0) ->Const a b ->Const a bSource#

gmapQl :: (r -> r' -> r) -> r -> (forall d.Data d => d -> r') ->Const a b -> rSource#

gmapQr :: (r' -> r -> r) -> r -> (forall d.Data d => d -> r') ->Const a b -> rSource#

gmapQ :: (forall d.Data d => d -> u) ->Const a b -> [u]Source#

gmapQi ::Int -> (forall d.Data d => d -> u) ->Const a b -> uSource#

gmapM ::Monad m => (forall d.Data d => d -> m d) ->Const a b -> m (Const a b)Source#

gmapMp ::MonadPlus m => (forall d.Data d => d -> m d) ->Const a b -> m (Const a b)Source#

gmapMo ::MonadPlus m => (forall d.Data d => d -> m d) ->Const a b -> m (Const a b)Source#

Num a =>Num (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

(+) ::Const a b ->Const a b ->Const a bSource#

(-) ::Const a b ->Const a b ->Const a bSource#

(*) ::Const a b ->Const a b ->Const a bSource#

negate ::Const a b ->Const a bSource#

abs ::Const a b ->Const a bSource#

signum ::Const a b ->Const a bSource#

fromInteger ::Integer ->Const a bSource#

Ord a =>Ord (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

compare ::Const a b ->Const a b ->Ordering#

(<) ::Const a b ->Const a b ->Bool#

(<=) ::Const a b ->Const a b ->Bool#

(>) ::Const a b ->Const a b ->Bool#

(>=) ::Const a b ->Const a b ->Bool#

max ::Const a b ->Const a b ->Const a b#

min ::Const a b ->Const a b ->Const a b#

Read a =>Read (Const a b)Source#

This instance would be equivalent to the derived instances of theConst newtype if therunConst field were removed

Since: 4.8.0.0

Instance details

Defined inData.Functor.Const

Real a =>Real (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

RealFloat a =>RealFloat (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

RealFrac a =>RealFrac (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

properFraction ::Integral b0 =>Const a b -> (b0,Const a b)Source#

truncate ::Integral b0 =>Const a b -> b0Source#

round ::Integral b0 =>Const a b -> b0Source#

ceiling ::Integral b0 =>Const a b -> b0Source#

floor ::Integral b0 =>Const a b -> b0Source#

Show a =>Show (Const a b)Source#

This instance would be equivalent to the derived instances of theConst newtype if therunConst field were removed

Since: 4.8.0.0

Instance details

Defined inData.Functor.Const

Ix a =>Ix (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

range :: (Const a b,Const a b) -> [Const a b]Source#

index :: (Const a b,Const a b) ->Const a b ->IntSource#

unsafeIndex :: (Const a b,Const a b) ->Const a b ->Int

inRange :: (Const a b,Const a b) ->Const a b ->BoolSource#

rangeSize :: (Const a b,Const a b) ->IntSource#

unsafeRangeSize :: (Const a b,Const a b) ->Int

IsString a =>IsString (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.String

Generic (Const a b)Source# 
Instance details

Defined inData.Functor.Const

Associated Types

typeRep (Const a b) ::Type ->TypeSource#

Methods

from ::Const a b ->Rep (Const a b) xSource#

to ::Rep (Const a b) x ->Const a bSource#

Semigroup a =>Semigroup (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

(<>) ::Const a b ->Const a b ->Const a bSource#

sconcat ::NonEmpty (Const a b) ->Const a bSource#

stimes ::Integral b0 => b0 ->Const a b ->Const a bSource#

Monoid a =>Monoid (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

mempty ::Const a bSource#

mappend ::Const a b ->Const a b ->Const a bSource#

mconcat :: [Const a b] ->Const a bSource#

FiniteBits a =>FiniteBits (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Bits a =>Bits (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

(.&.) ::Const a b ->Const a b ->Const a bSource#

(.|.) ::Const a b ->Const a b ->Const a bSource#

xor ::Const a b ->Const a b ->Const a bSource#

complement ::Const a b ->Const a bSource#

shift ::Const a b ->Int ->Const a bSource#

rotate ::Const a b ->Int ->Const a bSource#

zeroBits ::Const a bSource#

bit ::Int ->Const a bSource#

setBit ::Const a b ->Int ->Const a bSource#

clearBit ::Const a b ->Int ->Const a bSource#

complementBit ::Const a b ->Int ->Const a bSource#

testBit ::Const a b ->Int ->BoolSource#

bitSizeMaybe ::Const a b ->MaybeIntSource#

bitSize ::Const a b ->IntSource#

isSigned ::Const a b ->BoolSource#

shiftL ::Const a b ->Int ->Const a bSource#

unsafeShiftL ::Const a b ->Int ->Const a bSource#

shiftR ::Const a b ->Int ->Const a bSource#

unsafeShiftR ::Const a b ->Int ->Const a bSource#

rotateL ::Const a b ->Int ->Const a bSource#

rotateR ::Const a b ->Int ->Const a bSource#

popCount ::Const a b ->IntSource#

Storable a =>Storable (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

Methods

sizeOf ::Const a b ->IntSource#

alignment ::Const a b ->IntSource#

peekElemOff ::Ptr (Const a b) ->Int ->IO (Const a b)Source#

pokeElemOff ::Ptr (Const a b) ->Int ->Const a b ->IO ()Source#

peekByteOff ::Ptr b0 ->Int ->IO (Const a b)Source#

pokeByteOff ::Ptr b0 ->Int ->Const a b ->IO ()Source#

peek ::Ptr (Const a b) ->IO (Const a b)Source#

poke ::Ptr (Const a b) ->Const a b ->IO ()Source#

typeRep1 (Const a :: k ->Type)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

typeRep1 (Const a :: k ->Type) =D1 (MetaData "Const" "Data.Functor.Const" "base"True) (C1 (MetaCons "Const"PrefixITrue) (S1 (MetaSel (Just "getConst")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 a)))
typeRep (Const a b)Source#

Since: 4.9.0.0

Instance details

Defined inData.Functor.Const

typeRep (Const a b) =D1 (MetaData "Const" "Data.Functor.Const" "base"True) (C1 (MetaCons "Const"PrefixITrue) (S1 (MetaSel (Just "getConst")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 a)))

newtypeWrappedMonad m aSource#

Constructors

WrapMonad 

Fields

Instances
Monad m =>Monad (WrappedMonad m)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

Monad m =>Functor (WrappedMonad m)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

fmap :: (a -> b) ->WrappedMonad m a ->WrappedMonad m bSource#

(<$) :: a ->WrappedMonad m b ->WrappedMonad m aSource#

Monad m =>Applicative (WrappedMonad m)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

MonadPlus m =>Alternative (WrappedMonad m)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Generic1 (WrappedMonad m ::Type ->Type)Source# 
Instance details

Defined inControl.Applicative

Associated Types

typeRep1 (WrappedMonad m) :: k ->TypeSource#

Generic (WrappedMonad m a)Source# 
Instance details

Defined inControl.Applicative

Associated Types

typeRep (WrappedMonad m a) ::Type ->TypeSource#

typeRep1 (WrappedMonad m ::Type ->Type)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

typeRep1 (WrappedMonad m ::Type ->Type) =D1 (MetaData "WrappedMonad" "Control.Applicative" "base"True) (C1 (MetaCons "WrapMonad"PrefixITrue) (S1 (MetaSel (Just "unwrapMonad")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec1 m)))
typeRep (WrappedMonad m a)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

typeRep (WrappedMonad m a) =D1 (MetaData "WrappedMonad" "Control.Applicative" "base"True) (C1 (MetaCons "WrapMonad"PrefixITrue) (S1 (MetaSel (Just "unwrapMonad")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 (m a))))

newtypeWrappedArrow a b cSource#

Constructors

WrapArrow 

Fields

Instances
Generic1 (WrappedArrow a b ::Type ->Type)Source# 
Instance details

Defined inControl.Applicative

Associated Types

typeRep1 (WrappedArrow a b) :: k ->TypeSource#

Methods

from1 ::WrappedArrow a b a0 ->Rep1 (WrappedArrow a b) a0Source#

to1 ::Rep1 (WrappedArrow a b) a0 ->WrappedArrow a b a0Source#

Arrow a =>Functor (WrappedArrow a b)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

fmap :: (a0 -> b0) ->WrappedArrow a b a0 ->WrappedArrow a b b0Source#

(<$) :: a0 ->WrappedArrow a b b0 ->WrappedArrow a b a0Source#

Arrow a =>Applicative (WrappedArrow a b)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

pure :: a0 ->WrappedArrow a b a0Source#

(<*>) ::WrappedArrow a b (a0 -> b0) ->WrappedArrow a b a0 ->WrappedArrow a b b0Source#

liftA2 :: (a0 -> b0 -> c) ->WrappedArrow a b a0 ->WrappedArrow a b b0 ->WrappedArrow a b cSource#

(*>) ::WrappedArrow a b a0 ->WrappedArrow a b b0 ->WrappedArrow a b b0Source#

(<*) ::WrappedArrow a b a0 ->WrappedArrow a b b0 ->WrappedArrow a b a0Source#

(ArrowZero a,ArrowPlus a) =>Alternative (WrappedArrow a b)Source#

Since: 2.1

Instance details

Defined inControl.Applicative

Generic (WrappedArrow a b c)Source# 
Instance details

Defined inControl.Applicative

Associated Types

typeRep (WrappedArrow a b c) ::Type ->TypeSource#

Methods

from ::WrappedArrow a b c ->Rep (WrappedArrow a b c) xSource#

to ::Rep (WrappedArrow a b c) x ->WrappedArrow a b cSource#

typeRep1 (WrappedArrow a b ::Type ->Type)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

typeRep1 (WrappedArrow a b ::Type ->Type) =D1 (MetaData "WrappedArrow" "Control.Applicative" "base"True) (C1 (MetaCons "WrapArrow"PrefixITrue) (S1 (MetaSel (Just "unwrapArrow")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec1 (a b))))
typeRep (WrappedArrow a b c)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

typeRep (WrappedArrow a b c) =D1 (MetaData "WrappedArrow" "Control.Applicative" "base"True) (C1 (MetaCons "WrapArrow"PrefixITrue) (S1 (MetaSel (Just "unwrapArrow")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 (a b c))))

newtypeZipList aSource#

Lists, but with anApplicative functor based on zipping.

Constructors

ZipList 

Fields

Instances
FunctorZipListSource#

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

fmap :: (a -> b) ->ZipList a ->ZipList bSource#

(<$) :: a ->ZipList b ->ZipList aSource#

ApplicativeZipListSource#
f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN    = 'ZipList' (zipWithN f xs1 ... xsN)

wherezipWithN refers to thezipWith function of the appropriate arity (zipWith,zipWith3,zipWith4, ...). For example:

(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]    = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])    = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}

Since: 2.1

Instance details

Defined inControl.Applicative

Methods

pure :: a ->ZipList aSource#

(<*>) ::ZipList (a -> b) ->ZipList a ->ZipList bSource#

liftA2 :: (a -> b -> c) ->ZipList a ->ZipList b ->ZipList cSource#

(*>) ::ZipList a ->ZipList b ->ZipList bSource#

(<*) ::ZipList a ->ZipList b ->ZipList aSource#

FoldableZipListSource#

Since: 4.9.0.0

Instance details

Defined inControl.Applicative

Methods

fold ::Monoid m =>ZipList m -> mSource#

foldMap ::Monoid m => (a -> m) ->ZipList a -> mSource#

foldr :: (a -> b -> b) -> b ->ZipList a -> bSource#

foldr' :: (a -> b -> b) -> b ->ZipList a -> bSource#

foldl :: (b -> a -> b) -> b ->ZipList a -> bSource#

foldl' :: (b -> a -> b) -> b ->ZipList a -> bSource#

foldr1 :: (a -> a -> a) ->ZipList a -> aSource#

foldl1 :: (a -> a -> a) ->ZipList a -> aSource#

toList ::ZipList a -> [a]Source#

null ::ZipList a ->BoolSource#

length ::ZipList a ->IntSource#

elem ::Eq a => a ->ZipList a ->BoolSource#

maximum ::Ord a =>ZipList a -> aSource#

minimum ::Ord a =>ZipList a -> aSource#

sum ::Num a =>ZipList a -> aSource#

product ::Num a =>ZipList a -> aSource#

TraversableZipListSource#

Since: 4.9.0.0

Instance details

Defined inData.Traversable

Methods

traverse ::Applicative f => (a -> f b) ->ZipList a -> f (ZipList b)Source#

sequenceA ::Applicative f =>ZipList (f a) -> f (ZipList a)Source#

mapM ::Monad m => (a -> m b) ->ZipList a -> m (ZipList b)Source#

sequence ::Monad m =>ZipList (m a) -> m (ZipList a)Source#

AlternativeZipListSource#

Since: 4.11.0.0

Instance details

Defined inControl.Applicative

Eq a =>Eq (ZipList a)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

Methods

(==) ::ZipList a ->ZipList a ->Bool#

(/=) ::ZipList a ->ZipList a ->Bool#

Ord a =>Ord (ZipList a)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

Read a =>Read (ZipList a)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

Show a =>Show (ZipList a)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

Generic (ZipList a)Source# 
Instance details

Defined inControl.Applicative

Associated Types

typeRep (ZipList a) ::Type ->TypeSource#

Methods

from ::ZipList a ->Rep (ZipList a) xSource#

to ::Rep (ZipList a) x ->ZipList aSource#

Generic1ZipListSource# 
Instance details

Defined inControl.Applicative

Associated Types

typeRep1ZipList :: k ->TypeSource#

typeRep (ZipList a)Source#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

typeRep (ZipList a) =D1 (MetaData "ZipList" "Control.Applicative" "base"True) (C1 (MetaCons "ZipList"PrefixITrue) (S1 (MetaSel (Just "getZipList")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 [a])))
typeRep1ZipListSource#

Since: 4.7.0.0

Instance details

Defined inControl.Applicative

typeRep1ZipList =D1 (MetaData "ZipList" "Control.Applicative" "base"True) (C1 (MetaCons "ZipList"PrefixITrue) (S1 (MetaSel (Just "getZipList")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec1 [])))

Utility functions

(<$>) ::Functor f => (a -> b) -> f a -> f binfixl 4Source#

An infix synonym forfmap.

The name of this operator is an allusion to$. Note the similarities between their types:

 ($)  ::              (a -> b) ->   a ->   b(<$>) :: Functor f => (a -> b) -> f a -> f b

Whereas$ is function application,<$> is function application lifted over aFunctor.

Examples

Expand

Convert from aMaybeInt to aMaybeString usingshow:

>>>show <$> NothingNothing>>>show <$> Just 3Just "3"

Convert from anEitherIntInt to anEitherIntString usingshow:

>>>show <$> Left 17Left 17>>>show <$> Right 17Right "17"

Double each element of a list:

>>>(*2) <$> [1,2,3][2,4,6]

Applyeven to the second element of a pair:

>>>even <$> (2,2)(2,True)

(<$) ::Functor f => a -> f b -> f ainfixl 4Source#

Replace all locations in the input with the same value. The default definition isfmap .const, but this may be overridden with a more efficient version.

(<**>) ::Applicative f => f a -> f (a -> b) -> f binfixl 4Source#

A variant of<*> with the arguments reversed.

liftA ::Applicative f => (a -> b) -> f a -> f bSource#

Lift a function to actions. This function may be used as a value forfmap in aFunctor instance.

liftA3 ::Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f dSource#

Lift a ternary function to actions.

optional ::Alternative f => f a -> f (Maybe a)Source#

One or none.

Produced byHaddock version 2.20.0


[8]ページ先頭

©2009-2025 Movatter.jp