$

($) is the function application operator. Applying ($) to a function f and an argument x gives the same result as applying f to x directly. The definition is akin to this:
($) :: (a -> b) -> a -> b
($) f x = f x
This is id specialized from a -> a to (a -> b) -> (a -> b) which by the associativity of (->) is the same as (a -> b) -> a -> b. On the face of it, this may appear pointless! But it's actually one of the most useful and important operators in Haskell. The order of operations is very different between ($) and normal function application. Normal function application has precedence 10 - higher than any operator - and associates to the left. So these two definitions are equivalent:
expr = min 5 1 + 5
expr = ((min 5) 1) + 5
($) has precedence 0 (the lowest) and associates to the right, so these are equivalent:
expr = min 5 $ 1 + 5
expr = (min 5) (1 + 5)

Examples

A common use cases of ($) is to avoid parentheses in complex expressions. For example, instead of using nested parentheses in the following Haskell function:
-- | Sum numbers in a string: strSum "100  5 -7" == 98
strSum :: String -> Int
strSum s = sum (mapMaybe readMaybe (words s))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100  5 -7" == 98
strSum :: String -> Int
strSum s = sum $ mapMaybe readMaybe $ words s
($) is also used as a section (a partially applied operator), in order to indicate that we wish to apply some yet-unspecified function to a given value. For example, to apply the argument 5 to a list of functions:
applyFive :: [Int]
applyFive = map ($ 5) [(+1), (2^)]
>>> [6, 32]

Technical Remark (Representation Polymorphism)

($) is fully representation-polymorphic. This allows it to also be used with arguments of unlifted and even unboxed kinds, such as unboxed integers:
fastMod :: Int -> Int -> Int
fastMod (I# x) (I# m) = I# $ remInt# x m
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.
($) is the function application operator. Applying ($) to a function f and an argument x gives the same result as applying f to x directly. The definition is akin to this:
($) :: (a -> b) -> a -> b
($) f x = f x
On the face of it, this may appear pointless! But it's actually one of the most useful and important operators in Haskell. The order of operations is very different between ($) and normal function application. Normal function application has precedence 10 - higher than any operator - and associates to the left. So these two definitions are equivalent:
expr = min 5 1 + 5
expr = ((min 5) 1) + 5
($) has precedence 0 (the lowest) and associates to the right, so these are equivalent:
expr = min 5 $ 1 + 5
expr = (min 5) (1 + 5)

Uses

A common use cases of ($) is to avoid parentheses in complex expressions. For example, instead of using nested parentheses in the following Haskell function:
-- | Sum numbers in a string: strSum "100  5 -7" == 98
strSum :: String -> Int
strSum s = sum (mapMaybe readMaybe (words s))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100  5 -7" == 98
strSum :: String -> Int
strSum s = sum $ mapMaybe readMaybe $ words s
($) is also used as a section (a partially applied operator), in order to indicate that we wish to apply some yet-unspecified function to a given value. For example, to apply the argument 5 to a list of functions:
applyFive :: [Int]
applyFive = map ($ 5) [(+1), (2^)]
>>> [6, 32]

Technical Remark (Representation Polymorphism)

($) is fully representation-polymorphic. This allows it to also be used with arguments of unlifted and even unboxed kinds, such as unboxed integers:
fastMod :: Int -> Int -> Int
fastMod (I# x) (I# m) = I# $ remInt# x m
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.
Note that this denotes the identity function, so ($) f can usually be replaced with f.
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.
Infix application.
f :: Either String $ Maybe Int
=
f :: Either String (Maybe Int)
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
($) is the function application operator. Applying ($) to a function f and an argument x gives the same result as applying f to x directly. The definition is akin to this:
($) :: (a -> b) -> a -> b
($) f x = f x
This is id specialized from a -> a to (a -> b) -> (a -> b) which by the associativity of (->) is the same as (a -> b) -> a -> b. On the face of it, this may appear pointless! But it's actually one of the most useful and important operators in Haskell. The order of operations is very different between ($) and normal function application. Normal function application has precedence 10 - higher than any operator - and associates to the left. So these two definitions are equivalent:
expr = min 5 1 + 5
expr = ((min 5) 1) + 5
($) has precedence 0 (the lowest) and associates to the right, so these are equivalent:
expr = min 5 $ 1 + 5
expr = (min 5) (1 + 5)

Examples

A common use cases of ($) is to avoid parentheses in complex expressions. For example, instead of using nested parentheses in the following Haskell function:
-- | Sum numbers in a string: strSum "100  5 -7" == 98
strSum :: String -> Int
strSum s = sum (mapMaybe readMaybe (words s))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100  5 -7" == 98
strSum :: String -> Int
strSum s = sum $ mapMaybe readMaybe $ words s
($) is also used as a section (a partially applied operator), in order to indicate that we wish to apply some yet-unspecified function to a given value. For example, to apply the argument 5 to a list of functions:
applyFive :: [Int]
applyFive = map ($ 5) [(+1), (2^)]
>>> [6, 32]

Technical Remark (Representation Polymorphism)

($) is fully representation-polymorphic. This allows it to also be used with arguments of unlifted and even unboxed kinds, such as unboxed integers:
fastMod :: Int -> Int -> Int
fastMod (I# x) (I# m) = I# $ remInt# x m
Type-level infix applcation for functors.
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.
Flipped version of <$.

Examples

Replace the contents of a Maybe Int with a constant String:
>>> Nothing $> "foo"
Nothing
>>> Just 90210 $> "foo"
Just "foo"
Replace the contents of an Either Int Int with a constant String, resulting in an Either Int String:
>>> Left 8675309 $> "foo"
Left 8675309
>>> Right 8675309 $> "foo"
Right "foo"
Replace each element of a list with a constant String:
>>> [1,2,3] $> "foo"
["foo","foo","foo"]
Replace the second element of a pair with a constant String:
>>> (1,2) $> "foo"
(1,"foo")
This is >$ with its arguments flipped.
The deep analogue of $!. f $!! x fully evaluates x before returning f x. There is no guarantee about the ordering of evaluation. f x may be evaluated before x is fully evaluated. To impose an actual order on evaluation, use pseq from Control.Parallel in the parallel package.
Deprecated: Use runConduit and .|
The connect-and-resume operator. This does not close the Source, but instead returns it to be used again. This allows a Source to be used incrementally in a large program, without forcing the entire program to live in the Sink monad. Mnemonic: connect + do more. Since 0.5.0
Continue processing after usage of $$+. Since 0.5.0
Same as $$++ and connectResume, but doesn't include the updated SealedConduitT. NOTE In previous versions, this would cause finalizers to run. Since version 1.3.0, there are no finalizers in conduit. Since 0.5.0
Deprecated: Use .|
Left fusion for a sealed source. Since 1.0.16