acme-operators-0.2.0.0: Operators of base, all in one place!

LicenseBSD-3-Clause (see the file LICENSE)
MaintainerOleg Grenrus <oleg.grenrus@iki.fi>
Safe HaskellNone
LanguageHaskell2010

Acme.Operators.Base

Contents

Description

Have you ever been wondering about some magic lookin operator. Here are all operators in base package. Not so many.

The operators are in few bigger logical groups, subgrouped by package. Many of them are exported from Prelude.

There is a Stack Overflow QA listing prononciations of some of the operators. See: http://stackoverflow.com/questions/7746894/are-there-pronounceable-names-for-common-haskell-operators

Synopsis

Functions

Data.Function

($) :: (a -> b) -> a -> b infixr 0

Application operator. This operator is redundant, since ordinary application (f x) means the same as (f $ x). However, $ has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example:

    f $ g $ h x  =  f (g (h x))

It is also useful in higher-order situations, such as map ($ 0) xs, or zipWith ($) fs xs.

(&) :: a -> (a -> b) -> b infixl 1 Source

& is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator $, which allows & to be nested in $.

@since 4.8.0.0

Functors

Infamous operators on Functor, Applicative and Monad. Also Alternative.

Data.Functor

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

An infix synonym for fmap.

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

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

($>) :: Functor f => f a -> b -> f b infixl 4

Flipped version of <$.

Since: 4.7.0.0

Control.Applicative

(<*>) :: Applicative f => forall a b. f (a -> b) -> f a -> f b

Sequential application.

(<*) :: Applicative f => forall a b. f a -> f b -> f a

Sequence actions, discarding the value of the second argument.

(*>) :: Applicative f => forall a b. f a -> f b -> f b

Sequence actions, discarding the value of the first argument.

(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4

A variant of <*> with the arguments reversed.

(<|>) :: Alternative f => forall a. f a -> f a -> f a

An associative binary operation

Control.Monad

(>>=) :: Monad m => forall a b. m a -> (a -> m b) -> m b

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

(>>) :: Monad m => forall a b. m a -> m b -> m b

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.

(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1

Same as >>=, but with the arguments interchanged.

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1

Left-to-right Kleisli composition of monads.

(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c infixr 1

Right-to-left Kleisli composition of monads. (>=>), with the arguments flipped

(<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 Source

Strict version of <$>.

@since 4.8.0.0

Category & Arrows

Control.Category

Dot operator . clashes with one in Prelude: .. You can use <<<.

(.) :: Category k cat => forall b c a. cat b c -> cat a b -> cat a c

morphism composition

(>>>) :: Category k cat => cat a b -> cat b c -> cat a c infixr 1

Left-to-right composition

(<<<) :: Category k cat => cat b c -> cat a b -> cat a c infixr 1

Right-to-left composition

Control.Arrow

Optionally one can use Arrows language extensions. See: https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/arrow-notation.html.

(***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')

Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

(&&&) :: Arrow a => forall b c c'. a b c -> a b c' -> a b (c, c')

Fanout: send the input to both argument arrows and combine their output.

The default definition may be overridden with a more efficient version if desired.

(^>>) :: Arrow a => (b -> c) -> a c d -> a b d infixr 1

Precomposition with a pure function.

(>>^) :: Arrow a => a b c -> (c -> d) -> a b d infixr 1

Postcomposition with a pure function.

(<<^) :: Arrow a => a c d -> (b -> c) -> a b d infixr 1

Precomposition with a pure function (right-to-left variant).

(^<<) :: Arrow a => (c -> d) -> a b c -> a b d infixr 1

Postcomposition with a pure function (right-to-left variant).

(+++) :: ArrowChoice a => forall b c b' c'. a b c -> a b' c' -> a (Either b b') (Either c c')

Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

(|||) :: ArrowChoice a => forall b d c. a b d -> a c d -> a (Either b c) d

Fanin: Split the input between the two argument arrows and merge their outputs.

The default definition may be overridden with a more efficient version if desired.

Algebraic

Data.Eq

(==) :: Eq a => a -> a -> Bool

(/=) :: Eq a => a -> a -> Bool

Data.Ord

(<=) :: Ord a => a -> a -> Bool

(<) :: Ord a => a -> a -> Bool

(>) :: Ord a => a -> a -> Bool

(>=) :: Ord a => a -> a -> Bool

Data.Monoid

(<>) :: Monoid m => m -> m -> m infixr 6

An infix synonym for mappend.

Since: 4.5.0.0

Data

Data.Bits

(.&.) :: Bits a => a -> a -> a

Bitwise "and"

(.|.) :: Bits a => a -> a -> a

Bitwise "or"

Data.Bool

(&&) :: Bool -> Bool -> Bool infixr 3

Boolean "and"

(||) :: Bool -> Bool -> Bool infixr 2

Boolean "or"

Data.Complex

data Complex a :: * -> *

Complex numbers are an algebraic type.

For a complex number z, abs z is a number with the magnitude of z, but oriented in the positive real direction, whereas signum z has the phase of z, but unit magnitude.

Constructors

!a :+ !a infix 6

forms a complex number from its real and imaginary rectangular components.

Instances

Eq a => Eq (Complex a) 
RealFloat a => Floating (Complex a) 
RealFloat a => Fractional (Complex a) 
Data a => Data (Complex a) 
RealFloat a => Num (Complex a) 
Read a => Read (Complex a) 
Show a => Show (Complex a) 
Typeable (* -> *) Complex 

Data.Ratio

(%) :: Integral a => a -> a -> Ratio a infixl 7

Forms the ratio of two integral numbers.

Data.List

(++) :: [a] -> [a] -> [a] infixr 5

Append two lists, i.e.,

[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]

If the first list is not finite, the result is the first list.

(!!) :: [a] -> Int -> a infixl 9

List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.

(\\) :: Eq a => [a] -> [a] -> [a] infix 5

The \\ function is list difference (non-associative). In the result of xs \\ ys, the first occurrence of each element of ys in turn (if any) has been removed from xs. Thus

(xs ++ ys) \\ xs == ys.

It is a special case of deleteFirstsBy, which allows the programmer to supply their own equality test.

Numeric

(+) :: Num a => a -> a -> a

(*) :: Num a => a -> a -> a

(-) :: Num a => a -> a -> a

(/) :: Fractional a => a -> a -> a

fractional division

Expontentials

(^) :: (Num a, Integral b) => a -> b -> a infixr 8

raise a number to a non-negative integral power

(^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8

raise a number to an integral power

(**) :: Floating a => a -> a -> a

Type level trickery

Data.Type.Equality

data a :~: b :: k -> k -> * infix 4

Propositional equality. If a :~: b is inhabited by some terminating value, then the type a is the same as the type b. To use this equality in practice, pattern-match on the a :~: b to get out the Refl constructor; in the body of the pattern-match, the compiler knows that a ~ b.

Since: 4.7.0.0

Instances

Category k ((:~:) k) 
TestEquality k ((:~:) k a) 
(~) k a b => Bounded ((:~:) k a b) 
(~) k a b => Enum ((:~:) k a b) 
Eq ((:~:) k a b) 
Ord ((:~:) k a b) 
(~) k a b => Read ((:~:) k a b) 
Show ((:~:) k a b)