Add fixity for (==) and (/=)

Dannyu NDos ndospark320 at gmail.com
Tue Sep 18 15:45:49 UTC 2018


Well, the motivation to make them associative was that (==) is logical
XNOR, and (/=) is logical XOR. Perhaps we want an alias for
Bool-instantization of them.

2018년 9월 19일 (수) 00:34, Eric Mertens <emertens at gmail.com>님이 작성:

> Do we have any other good examples where we've got an operator that is
> considered associative where the result type isn't identical to the
> argument types? It's much more common to allow the types to vary when
> there's only one associativity that makes sense for the way an operator is
> intended to be used.
>
> a -> a -> a
>
> While it's true that focusing on Bool, (==) satisfies associativity in its
> truth table, the types don't work out so cleanly. Outside of Bool it starts
> to matter which associativity you pick.
>
> (\x y z -> (x == y) == z) :: Eq a => a -> a -> Bool -> Bool
>
> (\x y z -> x == (y == z)) :: Eq a => Bool -> a -> a -> Bool
>
> Making == associative is just going to lead to harder to understand code
> and will require people to memorize which arbitrary choice about the
> associativity of the operation was selected by the mailing list in order to
> make sense of the types of code using multiple ==.
>
> I see no gain here, and I'd prefer to leave == as is.
>
> Best regards,
> Eric Mertens
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180919/91d510ba/attachment.html>


More information about the Libraries mailing list