The Data.Functor
module contains two combinators, <$
and $>
, which ignore all of the values contained in a functor, replacing them all with a single constant value.
infixl 4 <$, $>
<$ :: Functor f => a -> f b -> f a
(<$) = fmap . const
$> :: Functor f => f a -> b -> f b
($>) = flip (<$)
void
ignores the return value of a computation.
void :: Functor f => f a -> f ()
void = (() <$)