[commit: packages/base] master: Add fmapCoerce to Functor class. (3da4fd9)
Johan Tibell
johan.tibell at gmail.com
Wed Sep 25 04:41:22 UTC 2013
Having coerce (!) show up in such a commonly used type class is a bit
alarming. Was there a libraries discussion about this? At least we
should add some docs to the method.
On Wed, Sep 25, 2013 at 12:37 AM, <git at git.haskell.org> wrote:
> 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
>
> _______________________________________________
> ghc-commits mailing list
> ghc-commits at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-commits
More information about the ghc-devs
mailing list