
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

+1
(This should be an hlint warning if it is not already.)
-- Dan Burton
On Aug 6, 2013 8:19 PM, "wren ng thornton"
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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (2)
-
Dan Burton
-
wren ng thornton