License | BSD-3-Clause (see the file LICENSE) |
---|---|
Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
Safe Haskell | None |
Language | Haskell2010 |
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
- ($) :: (a -> b) -> a -> b
- (&) :: a -> (a -> b) -> b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<$) :: Functor f => forall a b. a -> f b -> f a
- ($>) :: Functor f => f a -> b -> f b
- (<*>) :: Applicative f => forall a b. f (a -> b) -> f a -> f b
- (<*) :: Applicative f => forall a b. f a -> f b -> f a
- (*>) :: Applicative f => forall a b. f a -> f b -> f b
- (<**>) :: Applicative f => f a -> f (a -> b) -> f b
- (<|>) :: Alternative f => forall a. f a -> f a -> f a
- (>>=) :: Monad m => forall a b. m a -> (a -> m b) -> m b
- (>>) :: Monad m => forall a b. m a -> m b -> m b
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- (<$!>) :: Monad m => (a -> b) -> m a -> m b
- (.) :: Category k cat => forall b c a. cat b c -> cat a b -> cat a c
- (>>>) :: Category k cat => cat a b -> cat b c -> cat a c
- (<<<) :: Category k cat => cat b c -> cat a b -> cat a c
- (***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')
- (&&&) :: Arrow a => forall b c c'. a b c -> a b c' -> a b (c, c')
- (^>>) :: Arrow a => (b -> c) -> a c d -> a b d
- (>>^) :: Arrow a => a b c -> (c -> d) -> a b d
- (<<^) :: Arrow a => a c d -> (b -> c) -> a b d
- (^<<) :: Arrow a => (c -> d) -> a b c -> a b d
- (+++) :: ArrowChoice a => forall b c b' c'. a b c -> a b' c' -> a (Either b b') (Either c c')
- (|||) :: ArrowChoice a => forall b d c. a b d -> a c d -> a (Either b c) d
- (==) :: Eq a => a -> a -> Bool
- (/=) :: Eq a => a -> a -> Bool
- (<=) :: Ord a => a -> a -> Bool
- (<) :: Ord a => a -> a -> Bool
- (>) :: Ord a => a -> a -> Bool
- (>=) :: Ord a => a -> a -> Bool
- (<>) :: Monoid m => m -> m -> m
- (.&.) :: Bits a => a -> a -> a
- (.|.) :: Bits a => a -> a -> a
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- data Complex a :: * -> * = !a :+ !a
- (%) :: Integral a => a -> a -> Ratio a
- (++) :: [a] -> [a] -> [a]
- (!!) :: [a] -> Int -> a
- (\\) :: Eq a => [a] -> [a] -> [a]
- (+) :: Num a => a -> a -> a
- (*) :: Num a => a -> a -> a
- (-) :: Num a => a -> a -> a
- (/) :: Fractional a => a -> a -> a
- (^) :: (Num a, Integral b) => a -> b -> a
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- (**) :: Floating a => a -> a -> a
- data a :~: b :: k -> k -> *
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
. However, $
x)$
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
,
or map
($
0) xs
.zipWith
($
) fs xs
Functors
Infamous operators on Functor
, Applicative
and Monad
. Also Alternative
.
Data.Functor
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>=>
)
Category & Arrows
Control.Category
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 => 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
Data.Ord
Data.Monoid
Data
Data.Bits
Data.Bool
Data.Complex
data Complex a :: * -> *
Complex numbers are an algebraic type.
For a complex number z
,
is a number with the magnitude of abs
zz
,
but oriented in the positive real direction, whereas
has the phase of signum
zz
, but unit magnitude.
Constructors
!a :+ !a infix 6 | forms a complex number from its real and imaginary rectangular components. |
Data.Ratio
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
(/) :: Fractional a => a -> a -> a
fractional division
Expontentials
(^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8
raise a number to an integral power
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