Proposal: Data.Bool.implies

Jon Purdy evincarofautumn at gmail.com
Mon Jan 18 05:23:26 UTC 2016


+1. “<=” has the wrong strictness. In “a `implies` b”, “b” should not be
evaluated if “a” is false.

As a strawman, I’d propose that the Ord instance for Bool be changed—but
this is more likely to break existing code, however slightly.

On Sun, Jan 17, 2016 at 8:12 PM, David Feuer <david.feuer at gmail.com> wrote:

> -1. We already have a `<=` operator.
>
> On Sun, Jan 17, 2016 at 9:17 PM, Niklas Hambüchen <mail at nh2.me> wrote:
> > I propose to add to Data.Bool:
> >
> >     -- | Boolean implication.
> >     implies :: Bool -> Bool -> Bool
> >     implies True  x = x
> >     implies False _ = True
> >
> >     infix 4 `implies` -- same as (==)
> >
> > The request for this is quite old (see e.g.
> >
> http://neilmitchell.blogspot.de/2007/02/logical-implication-in-haskell.html
> ).
> >
> > I believe that by not trying to use an operator for it, and keeping it
> > in Data.Bool, we can avoid doing anything wrong.
> >
> > A quick superficial search on Stackage Hoogle suggests that adding this
> > function should create no breakage (4 packages define their own function
> > called `implies`, none of them import Data.Bool).
> >
> > `infix` instead of `infixl` or `infixr` to force you to bracket it; for
> > the same reason it has the same precedence as `==`.
> > _______________________________________________
> > Libraries mailing list
> > Libraries at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160117/92432888/attachment.html>


More information about the Libraries mailing list