<$>

An infix synonym for fmap. 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 a Functor.

Examples

Convert from a Maybe Int to a Maybe String using show:
>>> show <$> Nothing
Nothing
>>> show <$> Just 3
Just "3"
Convert from an Either Int Int to an Either Int String using show:
>>> show <$> Left 17
Left 17
>>> show <$> Right 17
Right "17"
Double each element of a list:
>>> (*2) <$> [1,2,3]
[2,4,6]
Apply even to the second element of a pair:
>>> even <$> (2,2)
(2,True)
hedgehog Hedgehog.Internal.Prelude, semigroupoids Data.Functor.Apply Data.Functor.Bind, base-compat Prelude.Compat, comonad Control.Comonad, protolude Protolude.Functor, diagrams-lib Diagrams.Prelude, rio RIO.Prelude, base-prelude BasePrelude BasePrelude.Operators, graphviz Data.GraphViz.Parsing, turtle Turtle, shelly Shelly Shelly.Lifted Shelly.Pipe, classy-prelude ClassyPrelude, Cabal-syntax Distribution.Compat.Prelude, universum Universum.Functor.Reexport, ihaskell IHaskellPrelude, basement Basement.Compat.Base Basement.Imports, numhask NumHask.Prelude, clash-prelude Clash.HaskellPrelude, github GitHub.Internal.Prelude, foundation Foundation, ghc-lib-parser GHC.Prelude.Basic GHC.Utils.Monad, Agda Agda.Utils.Functor Agda.Utils.Monad, dimensional Numeric.Units.Dimensional.Prelude, haxl Haxl.Prelude, rebase Rebase.Prelude, quaalude Essentials, threepenny-gui Graphics.UI.Threepenny.Core, configuration-tools Configuration.Utils.CommandLine, hledger Hledger.Cli.Script, mixed-types-num Numeric.MixedTypes.PreludeHiding, xmonad-contrib XMonad.Config.Prime, constrained-categories Control.Category.Hask, copilot-language Copilot.Language.Prelude, incipit-base Incipit.Base, opt-env-conf OptEnvConf, LambdaHack Game.LambdaHack.Core.Prelude, breakpoint Debug.Breakpoint.GhcFacade, cabal-install-solver Distribution.Solver.Compat.Prelude, faktory Faktory.Prelude, ghc-lib GHC.HsToCore.Monad, vcr Imports, verset Verset, yesod-paginator Yesod.Paginator.Prelude, distribution-opensuse OpenSuse.Prelude, frisby Text.Parsers.Frisby, hledger-web Hledger.Web.Import, termonad Termonad.Prelude
An infix synonym for fmap. 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 a Functor.

Examples

Convert from a Maybe Int to a Maybe String using show:
>>> show <$> Nothing
Nothing

>>> show <$> Just 3
Just "3"
Convert from an Either Int Int to an Either Int String using show:
>>> show <$> Left 17
Left 17

>>> show <$> Right 17
Right "17"
Double each element of a list:
>>> (*2) <$> [1,2,3]
[2,4,6]
Apply even to the second element of a pair:
>>> even <$> (2,2)
(2,True)
The document (x <$> y) concatenates document x and y with a line in between. (infixr 5)
The document (x <$> y) concatenates document x and y with a line in between. (infixr 5)
An infix synonym for fmap. 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 a Functor.

Examples

Convert from a Maybe Int to a Maybe String using show:
>>> show <$> Nothing
Nothing

>>> show <$> Just 3
Just "3"
Convert from an Either Int Int to an Either Int String using show:
>>> show <$> Left 17
Left 17

>>> show <$> Right 17
Right "17"
Double each element of a list:
>>> (*2) <$> [1,2,3]
[2,4,6]
Apply even to the second element of a pair:
>>> even <$> (2,2)
(2,True)
Alias for fmap.
Alias for fmap.
An infix synnonym for fmap.
Apply a bijection over a IsoFunctor using <$>.
The document (x <$> y) concatenates document x and y with a line in between. (infixr 5)
Map a linear function over a derivative tower.
f <$>^ u :: Aps f b is a delayed representation of f <$> u :: f b, so that it can be fused with other applicative operations. f <$>^ u is a shorthand for f <$> liftAps u.