Hi!

I was surprised to find two functions that appear to do the same thing

in Data.Semigroup:

stimesMonoid :: (Integral b, Monoid a) => b -> a -> a [1]

mtimesDefault :: (Integral b, Monoid a) => b -> a -> a [2]

Both are essentially versions of the default stimes implementation

that allow 0 as a multiplier.

I think it's confusing to have two functions with nearly the same

semantics but different implementations exported from the same module.

As stimesMonoid seems to fit well into the group of different stimes

implementations exported from Data.Semigroup, I propose that either

1. mtimesDefault be deleted (after a suitable deprecation period)

or (particularly, if there still are plans to make mtimes a member of Monoid)

2. mtimesDefault be moved to Data.Monoid (possibly with a deprecated

re-export from Data.Semigroup)

In case 2, I also think mtimesDefault should be made an alias of stimesMonoid.

Cheers,

Simon

[1]

http://hackage.haskell.org/package/base-4.11.0.0/docs/Data-Semigroup.html#v:stimesMonoid[2]

http://hackage.haskell.org/package/base-4.11.0.0/docs/Data-Semigroup.html#v:mtimesDefault_______________________________________________

Libraries mailing list

[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries