Maintainer | dneavesdev@pm.me |
---|---|
Safe Haskell | Safe |
Language | GHC2021 |
Antelude.Monad
Description
Synopsis
- module Control.Monad
- ($>) :: Functor f => f a -> b -> f b
- (<<) :: Monad m => m b -> m a -> m b
Documentation
module Control.Monad
($>) :: Functor f => f a -> b -> f b infixl 4 #
Flipped version of <$
.
Examples
Replace the contents of a
with a constant
Maybe
Int
String
:
>>>
Nothing $> "foo"
Nothing>>>
Just 90210 $> "foo"
Just "foo"
Replace the contents of an
with a constant Either
Int
Int
String
, resulting in an
:Either
Int
String
>>>
Left 8675309 $> "foo"
Left 8675309>>>
Right 8675309 $> "foo"
Right "foo"
Replace each element of a list with a constant String
:
>>>
[1,2,3] $> "foo"
["foo","foo","foo"]
Replace the second element of a pair with a constant String
:
>>>
(1,2) $> "foo"
(1,"foo")
Since: base-4.7.0.0