relude-1.2.1.0: Safe, performant, user-friendly and lightweight Haskell Standard Library
Copyright(c) 2016 Stephen Diehl
(c) 2016-2018 Serokell
(c) 2018-2023 Kowainik
LicenseMIT
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellSafe
LanguageHaskell2010

Relude.Functor.Fmap

Description

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

Synopsis

Documentation

(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b) infixl 4 Source #

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

>>> negate <<$>> Just [1,2,3]
Just [-1,-2,-3]

(<&>) :: Functor f => f a -> (a -> b) -> f b #

flap :: Functor f => f (a -> b) -> a -> f b Source #

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

>>> flap (++) "relude" "P"
"Prelude"

Since: 0.3.0

(??) :: Functor f => f (a -> b) -> a -> f b infixl 4 Source #

Operator version of the flap function.

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

Since: 0.3.0