:: a -> (a -> b) -> b -package:conferer -package:configuration-tools -package:termonad -package:ghc-prim -package:flow
base Data.Function,
lens Control.Lens.Lens Control.Lens.Operators,
microlens Lens.Micro,
base-compat Data.Function.Compat,
protolude Protolude,
diagrams-lib Diagrams.Prelude,
relude Relude.Function,
rio RIO.Prelude,
base-prelude BasePrelude BasePrelude.Operators,
optics-core Optics.Optic,
turtle Turtle,
composition-prelude Control.Composition,
universum Universum.Function,
numhask NumHask.Prelude,
config-ini Data.Ini.Config.Bidir,
rebase Rebase.Prelude,
quaalude Essentials,
stack Stack.Prelude,
incipit-base Incipit.Base,
ansi-terminal-game Terminal.Game,
ap-normalize ApNormalize,
loc Data.Loc.Internal.Prelude,
vivid Vivid.NoPluginsNoGlobalState & 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
$.
>>> 5 & (+1) & show
"6"
Postfix function application, for conveniently applying attributes.
Unlike ($), (#) has a high precedence (8), so d
# foo # bar can be combined with other things using operators
like (|||) or (<>) without needing
parentheses.
Helper to make code using records of clients more readable.
Can be mixed with (/:) for supplying arguments.
Example:
type Api = NamedRoutes RootApi
data RootApi mode = RootApi
{ subApi :: mode :- NamedRoutes SubApi
, …
} deriving Generic
data SubApi mode = SubApi
{ endpoint :: mode :- Get '[JSON] Person
, …
} deriving Generic
api :: Proxy API
api = Proxy
rootClient :: RootApi (AsClientT ClientM)
rootClient = client api
endpointClient :: ClientM Person
endpointClient = client // subApi // endpoint
& is a reverse application operator
Reverse function application which binds tighter than
<$>
and
<*>. Useful for refining grammar specification.
<*> monoidalFieldAla "extensions" (alaList' FSep MQuoted) oldExtensions
^^^ deprecatedSince [1,12] "Please use 'default-extensions' or 'other-extensions' fields."
Field access, inspired by the lens library. This is merely reverse
application, but allows us to write things like (1, 2)^._1
which is likely to be familiar to most Haskell programmers out there.
Note that this is precisely equivalent to _1 (1, 2), but
perhaps it reads a little nicer.
The
#-operator is the Haskell analog to the
.-operator in JavaScript. Example:
grd # addColorStop(0, "#8ED6FF");
This can be seen as equivalent of
grd.addColorStop(0,
"#8ED6FF").
Operator for postfix notation (same as Data.Function.(&))
>>> 255 .@hex
"0x0000_0000_0000_00ff"
>>> 0xf1 .@bin
"0b1111_0001"
>>> 2^12 .@dec
"4096"
>>> 4 * giga .@pos1
[32]
0x0 .@color (bits 31 24)
0b0000_0000_0000_0000_0000_0000_0000_0000_1111_1111_0000_0000_0000_0000_0000_0000
^^^^ ^^^^
Hang on function application, a.k.a. non-operator version of
&.
onApp = (&)
postfix function application (flip ($))
A flipped version of ($).
An operator that allows you to write C-style ternary conditionals of
the form:
p ? t ?? f
Note that parentheses are required in order to chain sequences of
conditionals together. This is probably a good thing.
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.
Note that
($) is representation-polymorphic in its
result type, so that
foo $ True where
foo :: Bool
-> Int# is well-typed.
Strict (call-by-value) application operator. It takes a function and
an argument, evaluates the argument to weak head normal form (WHNF),
then calls the function with that value.
Delay inlining a function until late in the game (simplifier phase 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.
Note that
($) is levity-polymorphic in its result
type, so that
foo $ True where
foo :: Bool ->
Int# is well-typed.
Strict (call-by-value) application operator. It takes a function and
an argument, evaluates the argument to weak head normal form (WHNF),
then calls the function with that value.
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.
Note that
($) is representation-polymorphic in its
result type, so that
foo $ True where
foo :: Bool
-> Int# is well-typed.
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.
Strict (call-by-value) application operator. It takes a function and
an argument, evaluates the argument to weak head normal form (WHNF),
then calls the function with that value.