[commit: packages/base] master: Add fmapCoerce to Functor class. (3da4fd9)
git at git.haskell.org
git at git.haskell.org
Wed Sep 25 06:37:46 CEST 2013
Repository : ssh://git@git.haskell.org/base
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/3da4fd92e005cb9348ab2852d9268ad61ae1b347/base
>---------------------------------------------------------------
commit 3da4fd92e005cb9348ab2852d9268ad61ae1b347
Author: Austin Seipp <austin at well-typed.com>
Date: Tue Sep 24 23:20:35 2013 -0500
Add fmapCoerce to Functor class.
This allows coercions to work under functors that are not locally known.
Authored-by: Edward Kmett <ekmett at gmail.com>
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
3da4fd92e005cb9348ab2852d9268ad61ae1b347
GHC/Base.lhs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/GHC/Base.lhs b/GHC/Base.lhs
index d876202..55172af 100644
--- a/GHC/Base.lhs
+++ b/GHC/Base.lhs
@@ -105,7 +105,6 @@ module GHC.Base
module GHC.Err -- import it explicitly
)
where
-
import GHC.Types
import GHC.Classes
import GHC.CString
@@ -186,6 +185,9 @@ class Functor f where
(<$) :: a -> f b -> f a
(<$) = fmap . const
+ fmapCoerce :: Coercible a b => f a -> f b
+ fmapCoerce = fmap coerce
+
{- | The 'Monad' class defines the basic operations over a /monad/,
a concept from a branch of mathematics known as /category theory/.
From the perspective of a Haskell programmer, however, it is best to
More information about the ghc-commits
mailing list