committed by
Stephen Diehl
parent
46220a1a4a
commit
d30d6a39ab
@@ -35,6 +35,7 @@ void :: Functor f => f a -> f ()
|
||||
|
||||
```haskell
|
||||
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,
|
||||
throwIO,
|
||||
throwTo,
|
||||
foreach,
|
||||
foreach, (<&>),
|
||||
show,
|
||||
pass,
|
||||
guarded,
|
||||
@@ -570,6 +570,13 @@ throwTo tid e = liftIO (Control.Exception.throwTo tid e)
|
||||
foreach :: Functor f => f a -> (a -> b) -> f b
|
||||
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.
|
||||
pass :: Applicative f => f ()
|
||||
pass = pure ()
|
||||
|
||||
Reference in New Issue
Block a user