{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}
module Relude.Functor.Fmap
( (<<$>>)
, (<&>)
, flap
, (??)
) where
import Relude.Function ((.))
import Relude.Functor.Reexport (Functor (..))
import Data.Functor ((<$>))
#if MIN_VERSION_base(4,11,0)
import Data.Functor ((<&>))
#else
infixl 1 <&>
(<&>) :: Functor f => f a -> (a -> b) -> f b
as <&> f = f <$> as
{-# INLINE (<&>) #-}
#endif
infixl 4 <<$>>
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
<<$>> :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> f (g a) -> f (g b)
(<<$>>) = (g a -> g b) -> f (g a) -> f (g b)
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((g a -> g b) -> f (g a) -> f (g b))
-> ((a -> b) -> g a -> g b) -> (a -> b) -> f (g a) -> f (g b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> g a -> g b
forall a b. (a -> b) -> g a -> g b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
{-# INLINE (<<$>>) #-}
flap :: Functor f => f (a -> b) -> a -> f b
flap :: forall (f :: * -> *) a b. Functor f => f (a -> b) -> a -> f b
flap f (a -> b)
ff a
x = (\a -> b
f -> a -> b
f a
x) ((a -> b) -> b) -> f (a -> b) -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f (a -> b)
ff
{-# INLINE flap #-}
infixl 4 ??
(??) :: Functor f => f (a -> b) -> a -> f b
?? :: forall (f :: * -> *) a b. Functor f => f (a -> b) -> a -> f b
(??) = f (a -> b) -> a -> f b
forall (f :: * -> *) a b. Functor f => f (a -> b) -> a -> f b
flap
{-# INLINE (??) #-}