Why Int doesn't have semigroup class instance?

When I try to use append for Tuple Int Int, I found Int is not semigroup. Int has the semiring instance, but why not there the definition of semiring like class (Monoid a) <= Semiring a or an instance of the monoid class like instance semiringMonoid:: Semiring a => Monoid a?

It has two equally valid instances, so we require you to pick.
https://pursuit.purescript.org/packages/purescript-prelude/4.1.1/docs/Data.Monoid.Additive#t:Additive
https://pursuit.purescript.org/packages/purescript-prelude/4.1.1/docs/Data.Monoid.Multiplicative#t:Multiplicative

1 Like

I think people use the ala function fromNewtype type class for situations like this, or other functions from that type class.

In 0.14, safe-coerce with Coercible will also be an option.