Movatterモバイル変換


[0]ホーム

URL:


base-4.9.1.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 (<*>).

A minimal complete definition must include implementations of these functions satisfying the following laws:

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

Iff is also aMonad, it should satisfy

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

Minimal complete definition

pure,(<*>)

Methods

pure :: a -> f aSource#

Lift a value.

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

Sequential application.

(*>) :: 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# 

Methods

pure :: a -> [a]Source#

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

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

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

ApplicativeMaybeSource# 

Methods

pure :: a ->Maybe aSource#

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

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

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

ApplicativeIOSource# 

Methods

pure :: a ->IO aSource#

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

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

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

ApplicativeU1Source# 

Methods

pure :: a ->U1 aSource#

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

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

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

ApplicativePar1Source# 

Methods

pure :: a ->Par1 aSource#

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

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

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

ApplicativeReadPSource# 

Methods

pure :: a ->ReadP aSource#

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

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

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

ApplicativeReadPrecSource# 
ApplicativeLastSource# 

Methods

pure :: a ->Last aSource#

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

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

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

ApplicativeFirstSource# 

Methods

pure :: a ->First aSource#

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

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

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

ApplicativeProductSource# 
ApplicativeSumSource# 

Methods

pure :: a ->Sum aSource#

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

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

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

ApplicativeDualSource# 

Methods

pure :: a ->Dual aSource#

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

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

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

ApplicativeSTMSource# 

Methods

pure :: a ->STM aSource#

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

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

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

ApplicativeZipListSource# 
ApplicativeComplexSource# 
ApplicativeNonEmptySource# 
ApplicativeOptionSource# 
ApplicativeLastSource# 

Methods

pure :: a ->Last aSource#

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

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

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

ApplicativeFirstSource# 

Methods

pure :: a ->First aSource#

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

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

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

ApplicativeMaxSource# 

Methods

pure :: a ->Max aSource#

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

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

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

ApplicativeMinSource# 

Methods

pure :: a ->Min aSource#

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

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

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

ApplicativeIdentitySource# 
Applicative ((->) a)Source# 

Methods

pure :: a -> a -> aSource#

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

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

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

Applicative (Either e)Source# 

Methods

pure :: a ->Either e aSource#

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

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

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

Applicative f =>Applicative (Rec1 f)Source# 

Methods

pure :: a ->Rec1 f aSource#

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

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

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

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

Methods

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

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

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

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

Applicative (ST s)Source# 

Methods

pure :: a ->ST s aSource#

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

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

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

Applicative (Proxy*)Source# 
Arrow a =>Applicative (ArrowMonad a)Source# 
Monad m =>Applicative (WrappedMonad m)Source# 
Applicative (ST s)Source# 

Methods

pure :: a ->ST s aSource#

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

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

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

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

Methods

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

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

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

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

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

Methods

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

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

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

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

Applicative f =>Applicative (Alt* f)Source# 

Methods

pure :: a ->Alt* f aSource#

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

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

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

Monoid m =>Applicative (Const* m)Source# 

Methods

pure :: a ->Const* m aSource#

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

(*>) ::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# 
Applicative f =>Applicative (M1 i c f)Source# 

Methods

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

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

(*>) ::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 (Product* f g)Source# 

Methods

pure :: a ->Product* f g aSource#

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

(*>) ::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 g) =>Applicative (Compose** f g)Source# 

Methods

pure :: a ->Compose** f g aSource#

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

(*>) ::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:

  • some v = (:)<$> v<*> many v
  • many v = some v<|>pure []

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# 

Methods

empty :: [a]Source#

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

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

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

AlternativeMaybeSource# 
AlternativeIOSource# 

Methods

empty ::IO aSource#

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

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

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

AlternativeU1Source# 

Methods

empty ::U1 aSource#

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

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

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

AlternativeReadPSource# 
AlternativeReadPrecSource# 
AlternativeSTMSource# 

Methods

empty ::STM aSource#

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

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

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

AlternativeOptionSource# 
Alternative f =>Alternative (Rec1 f)Source# 

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 (Proxy*)Source# 
ArrowPlus a =>Alternative (ArrowMonad a)Source# 
MonadPlus m =>Alternative (WrappedMonad m)Source# 
(Alternative f,Alternative g) =>Alternative ((:*:) f g)Source# 

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 ((:.:) f g)Source# 

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 (Alt* f)Source# 

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#

(ArrowZero a,ArrowPlus a) =>Alternative (WrappedArrow a b)Source# 
Alternative f =>Alternative (M1 i c f)Source# 

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,Alternative g) =>Alternative (Product* f g)Source# 

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,Applicative g) =>Alternative (Compose** f g)Source# 

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

Bifunctor (Const*)Source# 

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#

Show2 (Const*)Source# 

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*)Source# 

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#

Ord2 (Const*)Source# 

Methods

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

Eq2 (Const*)Source# 

Methods

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

Functor (Const* m)Source# 

Methods

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

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

Monoid m =>Applicative (Const* m)Source# 

Methods

pure :: a ->Const* m aSource#

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

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

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

Foldable (Const* m)Source# 

Methods

fold ::Monoid m =>Const* m m -> mSource#

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

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)Source# 

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 m => (a -> m b) ->Const* m a -> m (Const* m b)Source#

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

Generic1 (Const* a)Source# 

Associated Types

typeRep1 (Const* a ::* ->*) ::* ->*Source#

Methods

from1 ::Const* a a ->Rep1 (Const* a) aSource#

to1 ::Rep1 (Const* a) a ->Const* a aSource#

Show a =>Show1 (Const* a)Source# 

Methods

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

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

Read a =>Read1 (Const* a)Source# 

Methods

liftReadsPrec :: (Int ->ReadS a) ->ReadS [a] ->Int ->ReadS (Const* a a)Source#

liftReadList :: (Int ->ReadS a) ->ReadS [a] ->ReadS [Const* a a]Source#

Ord a =>Ord1 (Const* a)Source# 

Methods

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

Eq a =>Eq1 (Const* a)Source# 

Methods

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

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

Methods

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

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

toEnum ::Int ->Const k a bSource#

fromEnum ::Const k a b ->IntSource#

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

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

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

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

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

Methods

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

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

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

Methods

pi ::Const k a bSource#

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Methods

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

recip ::Const k a b ->Const k a bSource#

fromRational ::Rational ->Const k a bSource#

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

Methods

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

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

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

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

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

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

toInteger ::Const k a b ->IntegerSource#

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

Methods

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

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

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

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

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

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

fromInteger ::Integer ->Const k a bSource#

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

Methods

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

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

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

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

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

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

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

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

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

Real a =>Real (Const k a b)Source# 
RealFloat a =>RealFloat (Const k a b)Source# 
RealFrac a =>RealFrac (Const k a b)Source# 

Methods

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

truncate ::Integral b =>Const k a b -> bSource#

round ::Integral b =>Const k a b -> bSource#

ceiling ::Integral b =>Const k a b -> bSource#

floor ::Integral b =>Const k a b -> bSource#

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

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

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

Methods

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

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

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

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

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

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

IsString a =>IsString (Const* a b)Source# 
Generic (Const k a b)Source# 

Associated Types

typeRep (Const k a b) ::* ->*Source#

Methods

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

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

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

Methods

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

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

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

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

Methods

mempty ::Const k a bSource#

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

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

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

Methods

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

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

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

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

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

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

zeroBits ::Const k a bSource#

bit ::Int ->Const k a bSource#

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

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

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

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

bitSizeMaybe ::Const k a b ->MaybeIntSource#

bitSize ::Const k a b ->IntSource#

isSigned ::Const k a b ->BoolSource#

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

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

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

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

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

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

popCount ::Const k a b ->IntSource#

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

Methods

sizeOf ::Const k a b ->IntSource#

alignment ::Const k a b ->IntSource#

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

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

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

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

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

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

typeRep1 (Const* a)Source# 
typeRep1 (Const* a) =D1 (MetaData "Const" "Data.Functor.Const" "base"True) (C1 (MetaCons "Const"PrefixITrue) (S1 (MetaSel (JustSymbol "getConst")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 a)))
typeRep (Const k a b)Source# 
typeRep (Const k a b) =D1 (MetaData "Const" "Data.Functor.Const" "base"True) (C1 (MetaCons "Const"PrefixITrue) (S1 (MetaSel (JustSymbol "getConst")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 a)))

newtypeWrappedMonad m aSource#

Constructors

WrapMonad 

Fields

Instances

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

Methods

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

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

Monad m =>Applicative (WrappedMonad m)Source# 
Generic1 (WrappedMonad m)Source# 

Associated Types

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

MonadPlus m =>Alternative (WrappedMonad m)Source# 
Generic (WrappedMonad m a)Source# 

Associated Types

typeRep (WrappedMonad m a) ::* ->*Source#

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

newtypeWrappedArrow a b cSource#

Constructors

WrapArrow 

Fields

Instances

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

Methods

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

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

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

Associated Types

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

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

Associated Types

typeRep (WrappedArrow a b c) ::* ->*Source#

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)Source# 
typeRep1 (WrappedArrow a b) =D1 (MetaData "WrappedArrow" "Control.Applicative" "base"True) (C1 (MetaCons "WrapArrow"PrefixITrue) (S1 (MetaSel (JustSymbol "unwrapArrow")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec1 (a b))))
typeRep (WrappedArrow a b c)Source# 
typeRep (WrappedArrow a b c) =D1 (MetaData "WrappedArrow" "Control.Applicative" "base"True) (C1 (MetaCons "WrapArrow"PrefixITrue) (S1 (MetaSel (JustSymbol "unwrapArrow")NoSourceUnpackednessNoSourceStrictnessDecidedLazy) (Rec0 (a b c))))

newtypeZipList aSource#

Lists, but with anApplicative functor based on zipping, so that

f<$>ZipList xs1<*> ...<*>ZipList xsn =ZipList (zipWithn f xs1 ... xsn)

Constructors

ZipList 

Fields

Instances

FunctorZipListSource# 

Methods

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

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

ApplicativeZipListSource# 
FoldableZipListSource# 

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# 

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#

Generic1ZipListSource# 

Associated Types

typeRep1 (ZipList ::* ->*) ::* ->*Source#

Eq a =>Eq (ZipList a)Source# 

Methods

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

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

Ord a =>Ord (ZipList a)Source# 
Read a =>Read (ZipList a)Source# 
Show a =>Show (ZipList a)Source# 
Generic (ZipList a)Source# 

Associated Types

typeRep (ZipList a) ::* ->*Source#

Methods

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

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

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

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

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 aSource#

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.

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

Lift a binary function to actions.

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.17.3


[8]ページ先頭

©2009-2026 Movatter.jp