[commit: packages/base] master: Add fmapCoerce to Functor class. (3da4fd9)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit: packages/base] master: Add fmapCoerce to Functor class. (3da4fd9)

Simon Peyton Jones
This is great, but does needs some explanatory material, on the Haskell wiki or Trac.

Simon

| -----Original Message-----
| From: ghc-commits [mailto:ghc-commits-bounces at haskell.org] On Behalf Of
| git at git.haskell.org
| Sent: 25 September 2013 05:38
| To: ghc-commits at haskell.org
| Subject: [commit: packages/base] master: Add fmapCoerce to Functor
| class. (3da4fd9)
|
| Repository : ssh://git at git.haskell.org/base
|
| On branch  : master
| Link       :
| http://ghc.haskell.org/trac/ghc/changeset/3da4fd92e005cb9348ab2852d9268a
| d61ae1b347/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
|
| _______________________________________________
| ghc-commits mailing list
| ghc-commits at haskell.org
| http://www.haskell.org/mailman/listinfo/ghc-commits