<div><div dir="auto">Andrew: could you explain the algebra notation you were using for short hand? I think I followed, but for people the libraries list might be their first exposure to advanced / graduate abstract algebra (which winds up being simpler than most folks expect ;) )</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 31, 2020 at 4:36 PM Carter Schonwald <<a href="mailto:carter.schonwald@gmail.com">carter.schonwald@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">that actually sounds pretty sane. I think! <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 31, 2020 at 3:38 PM Andrew Lelechenko <<a href="mailto:andrew.lelechenko@gmail.com" target="_blank">andrew.lelechenko@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 28 Jan 2020, Dannyu NDos wrote:<br>
<br>
> Second, I suggest to move `abs` and `signum` from `Num` to `Floating`<br>
<br>
I can fully relate your frustration with `abs` and `signum` (and numeric type classes in Haskell altogether). But IMO breaking both in `Num` and in `Floating` at once is not a promising way to make things proper. <br>
<br>
I would rather follow the beaten track of Applicative Monad and Semigroup Monoid proposals and - as a first step - introduce a superclass (probably, borrowing the design from `semirings` package): <br>
<br>
class Semiring a where <br>
zero :: a<br>
plus :: a -> a -> a <br>
one :: a<br>
times :: a -> a -> a <br>
fromNatural :: Natural -> a <br>
class Semiring a => Num a where ...<br>
<br>
Tangible benefits in `base` include:<br>
a) instance Semiring Bool, <br>
b) a total instance Semiring Natural (in contrast to a partial instance Num Natural),<br>
c) instance Num a => Semiring (Complex a) (in contrast to instance RealFloat a => Num (Complex a)),<br>
d) newtypes Sum and Product would require only Semiring constraint instead of Num.<br>
<br>
Best regards,<br>
Andrew<br>
<br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>
</blockquote></div></div>