Opened 5 years ago

Closed 5 years ago

#9827 closed task (fixed)

void does not use <$

Reported by: dfeuer Owned by: dfeuer
Priority: normal Milestone: 7.10.1
Component: Core Libraries Version: 7.9
Keywords: Cc: core-libraries-committee@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D521
Wiki Page:

Description

Data.Functor.void is currently defined as

void = fmap (const ())

Some Functor instances have an optimized <$, so this should be

void x = () <$ x

Change History (3)

comment:1 Changed 5 years ago by dfeuer

Status: newpatch

comment:2 Changed 5 years ago by Herbert Valerio Riedel <hvr@…>

In cc7a735f015510dda6f69d4a48d1b0cdd55856ba/ghc:

Define void using <$ (re #9827)

`() <$ x` is sometimes better than `fmap (const ()) x` and should
never be worse.

Reviewed By: ekmett

Differential Revision: https://phabricator.haskell.org/D521

comment:3 Changed 5 years ago by dfeuer

Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.