typelevel / algebra

Experimental project to lay out basic algebra type classes
https://typelevel.org/algebra/
Other
378 stars 69 forks source link

Topic/clean up std instances #44

Closed non closed 9 years ago

non commented 9 years ago

Here are a bunch of new instances, some clean ups, etc.

I think all these should be good to go. However:

  1. There are still some common types missing (e.g. Vector)
  2. We need additional additive/multiplicative variants (e.g. for Option)
  3. Maybe we should make addition a default semigroup for number types?
  4. We provide Semigroup[A] => Semigroup[Option[A]] but Option[_] could use orElse in other cases. Worth supporting?

I don't think we have to answer all those questions immediately but we'll eventually want to.

non commented 9 years ago

I think based on @johnynek's comments I need to go back and improve the Map instances a bunch.

tixxit commented 9 years ago

Another comment I had, but left in the chat room instead, was that we need some GCD tests. Spire has a GCDTest that does sanity checking, but recently was forced to require Spire's NumberTag because the Float/Double implementations could underflow (which caused NaNs in LCM). I'd like to try to port the GCD tests over if possible. At least, I'd like to get some tests for the floating point (Float and Double for now) implementations, since they're a bit fiddly. I'll give it a try later today.

non commented 9 years ago

How do people feel about this PR?

I think it would be a big improvement if we merged it. However, it was maybe too much to bite off in one PR. If folks don't feel comfortable signing-off on this, I'll close it and try to submit individual instances in a more piecemeal fashion.

I'm sorry I let this sit for so long.

/cc @tixxit @avibryant @larsrh @johnynek @ceedubs

non commented 9 years ago

(I'm going to go through and try to address as many of @johnynek's comments as I can right now, especially when there is an obvious way to move forward.)

johnynek commented 9 years ago

Sorry, I missed this before. Let me look tomorrow and try to merge it.

johnynek commented 9 years ago

Just the last two questions, and also not you need to merge in develop.

Thanks for doing all this work. It looks really nice to me.

johnynek commented 9 years ago

LGTM.

Can we get a shipit from @tixxit who also looked at this one?

tixxit commented 9 years ago

:+1:ship it