committed by
Stephen Diehl
parent
46220a1a4a
commit
d30d6a39ab
@@ -35,6 +35,7 @@ void :: Functor f => f a -> f ()
|
|||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
foreach :: Functor f => f a -> (a -> b) -> f b
|
foreach :: Functor f => f a -> (a -> b) -> f b
|
||||||
|
(<&>) :: Functor f => f a -> (a -> b) -> f b
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -16,7 +16,7 @@ module Protolude (
|
|||||||
print,
|
print,
|
||||||
throwIO,
|
throwIO,
|
||||||
throwTo,
|
throwTo,
|
||||||
foreach,
|
foreach, (<&>),
|
||||||
show,
|
show,
|
||||||
pass,
|
pass,
|
||||||
guarded,
|
guarded,
|
||||||
@@ -570,6 +570,13 @@ throwTo tid e = liftIO (Control.Exception.throwTo tid e)
|
|||||||
foreach :: Functor f => f a -> (a -> b) -> f b
|
foreach :: Functor f => f a -> (a -> b) -> f b
|
||||||
foreach = flip fmap
|
foreach = flip fmap
|
||||||
|
|
||||||
|
-- | Infix version of foreach.
|
||||||
|
--
|
||||||
|
-- @<&>@ is to '<$>' what '&' is to '$'.
|
||||||
|
infixl 4 <&>
|
||||||
|
(<&>) :: Functor f => f a -> (a -> b) -> f b
|
||||||
|
(<&>) = foreach
|
||||||
|
|
||||||
-- | Do nothing returning unit inside applicative.
|
-- | Do nothing returning unit inside applicative.
|
||||||
pass :: Applicative f => f ()
|
pass :: Applicative f => f ()
|
||||||
pass = pure ()
|
pass = pure ()
|
||||||
|
|||||||
Reference in New Issue
Block a user