qfpl / dollaridoos

A typesafe wrapper around monetary values represented as numeric values, allowing only sensible operations.
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

Consider adding Group type class instance #5

Open gwils opened 7 years ago

gwils commented 7 years ago

Given that we've chosen addition as the monoid for money, we can define an instance for Group too. But where should we get group from? The groups package seems almost unused, and I can't find its source on github.

Maybe we should depend on the albegra package instead. It's worth looking at that package. As well as group, what other algebraic structures does it provide that money fits?

frasertweedale commented 7 years ago

groups seems much more popular actually ; many more downloads, and many more in last 30 days than algebra.

OTOH, algebra is authored by Ed.

OTOOH

13:06 <nkpart> The revdeps are empty for this package, so I think it was probably a playground

But if we go for algebra the abstraction we fit http://hackage.haskell.org/package/algebra-4.3/docs/Numeric-Additive-Group.html.

As for other structures, we are also Abelian (commutative group) though this does not define any new operations, just provides additional structure to the combining operation.