spl / dlist

Difference lists in Haskell
https://hackage.haskell.org/package/dlist
BSD 3-Clause "New" or "Revised" License
65 stars 15 forks source link

Implementation of `stimes` in `Semigroup` instance #42

Closed JaSpa closed 4 years ago

JaSpa commented 4 years ago

Hey, thanks for this library!

I was looking at the implementation and was wondering if there is a specific reason to use a hand-written implementation for stimes instead of Data.Semigroup.stimesMonoid. If I look at it correctly stimesMonoid uses only a logarithmic number of (<>) and would be preferable to the current implementation. If this is case I can make a pull-request.

spl commented 4 years ago

I was looking at the implementation and was wondering if there is a specific reason to use a hand-written implementation for stimes instead of Data.Semigroup.stimesMonoid.

I'm not aware of any reason.

If I look at it correctly stimesMonoid uses only a logarithmic number of (<>) and would be preferable to the current implementation. If this is case I can make a pull-request.

That seems reasonable. One thing that occurs to me is that it would be preferable to keep the existing error message instead of the stimesMonoid message. A PR would be welcome!

spl commented 4 years ago

Now available in dlist-1.0.