MRP Summary & revised MRP 2ed
Herbert Valerio Riedel
hvr at gnu.org
Thu Nov 26 08:36:19 UTC 2015
On 2015-11-26 at 09:28:32 +0100, Akio Takano wrote:
[...]
> I understand this, but perhaps there is a way to achieve this without
> slowing down existing code. How about introducing a new warning
> (enabled with -Wall) that is triggered when a type satisfies the
> following 3 conditions?
>
> 1. The type has a Monad instance and an Applicative instance declared
> in the same module, with the same set of constraints.
> 2. (*>) is not defined as (*>) = (>>). i.e. either it has a
> non-trivial definition or its definition is left out.
> 3. (>>) is not defined as (>>) = (*>). i.e. either it has a
> non-trivial definition or its definition is left out.
>
> This way, people can be warned when (*>) and (>>) can share an
> implementation but they don't.
Coincidentally, I've recently implemented something similar to that end
(but it is *not* enabled via -Wall/-Wcompat by default yet), see
https://git.haskell.org/ghc.git/commitdiff/f09f2470a76bb08b7f51d2f5663daa672b86f618
for details.
Cheers,
hvr
More information about the Libraries
mailing list