HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulerelude-1.2.0.0Haskell2010

Relude.Functor.Fmap

SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable

This module contains useful functions to work with Functor type class.

  • 4 values
  • Packagerelude-1.2.0.0
  • Exports4
  • LanguageHaskell2010
  • LicenceMIT
  • SourceFmap.hs
value(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
#

Alias for fmap . fmap. Convenient to work with two nested Functors.

Example1 expression
negate <<$>> Just [1,2,3]Just [-1,-2,-3]
value(<&>) :: Functor f => f a -> (a -> b) -> f b
#

Flipped version of <$>.

(<&>) = flip fmap
Examples

Apply (+1) to a list, a Just and a Right:

Example1 expression
Just 2 <&> (+1)Just 3
Example1 expression
[1,2,3] <&> (+1)[2,3,4]
Example1 expression
Right 3 <&> (+1)Right 4
valueflap :: Functor f => f (a -> b) -> a -> f b
#

Takes a function in a Functor context and applies it to a normal value.

Example1 expression
flap (++) "relude" "P""Prelude"
value(??) :: Functor f => f (a -> b) -> a -> f b
#

Operator version of the flap function.

Example1 expression
[(+2), (*3)] ?? 5[7,15]
Example1 expression
Just (+3) ?? 5Just 8