add (<&>), fixes issue #53 (#56)

This commit is contained in:
Profpatsch
2017-06-14 07:33:23 +02:00
committed by Stephen Diehl
parent 46220a1a4a
commit d30d6a39ab
2 changed files with 9 additions and 1 deletions
+1
View File
@@ -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
View File
@@ -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 ()