[commit: base] master: Add some more Data.Functor functions; fixes #7817 (6402f8d)
Ian Lynagh
igloo at earth.li
Mon Apr 22 00:23:48 CEST 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
https://github.com/ghc/packages-base/commit/6402f8d294db347357436321965d9b6024e02984
>---------------------------------------------------------------
commit 6402f8d294db347357436321965d9b6024e02984
Author: Ian Lynagh <ian at well-typed.com>
Date: Sun Apr 21 21:46:07 2013 +0100
Add some more Data.Functor functions; fixes #7817
Added infixl4 $>.
Re-exported void from Data.Functor.
Also defined the fixity for <$ for non-GHC impls.
>---------------------------------------------------------------
Data/Functor.hs | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Data/Functor.hs b/Data/Functor.hs
index 416768e..bac1464 100644
--- a/Data/Functor.hs
+++ b/Data/Functor.hs
@@ -18,12 +18,19 @@ module Data.Functor
(
Functor(fmap),
(<$),
+ ($>),
(<$>),
+ void,
) where
+import Control.Monad
#ifdef __GLASGOW_HASKELL__
import GHC.Base (Functor(..))
-#else
+#endif
+
+#ifndef __GLASGOW_HASKELL__
+infixl 4 <$
+
(<$) :: Functor f => a -> f b -> f a
(<$) = fmap . const
#endif
@@ -34,3 +41,8 @@ infixl 4 <$>
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<$>) = fmap
+infixl 4 $>
+
+($>) :: Functor f => f a -> b -> f b
+($>) = flip (<$)
+
More information about the ghc-commits
mailing list