Improving void

Dan Burton danburton.email at gmail.com
Wed Aug 7 21:57:49 CEST 2013


+1

(This should be an hlint warning if it is not already.)

-- Dan Burton
On Aug 6, 2013 8:19 PM, "wren ng thornton" <wren at freegeek.org> wrote:

> On 8/5/13 3:06 PM, Edward Kmett wrote:
> > Right now the definition of Control.Monad.void is:
> >
> > void :: Functor f => f a -> f ()
> >
> > void = fmap (const ())
> >
> > I propose we replace it with
> >
> > void :: Functor f => f a -> f ()
> >
> > void = (() <$)
> >
> > This expands out to the former definition by the default definition of
> > (<$) and Data.Functor.Functor exports (<$) explicitly to make it
> > possible to optimize this sort of thing. It seems a shame not to use
> > it.
>
> +1. That was the entire point of (<$) being added to the class afterall.
>
> --
> Live well,
> ~wren
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130807/88e79a3b/attachment.htm>


More information about the Libraries mailing list