Semigroup repeat (base package)

Harendra Kumar harendra.kumar at gmail.com
Sun Sep 10 09:34:08 UTC 2017


Indeed it is cycle1, sorry to have missed it. It will be easier to spot it
if it close to the stimes* functions in the beginning of the docs. It is
placed too far down below even after Monoid re-exports.

-harendra

On 10 September 2017 at 14:09, Herbert Valerio Riedel <hvriedel at gmail.com>
wrote:

> Hi,
>
> On Sun, Sep 10, 2017 at 9:24 AM, Harendra Kumar
> <harendra.kumar at gmail.com> wrote:
> > I could not find a function that repeats a value using a semigroup
> append. I
> > am looking for something like this:
> >
> > srepeat :: Semigroup a => a -> a
> > srepeat x = xs where xs = x <> xs
> >
> > Is it already available somewhere? Does it make sense to add it to
> > Data.Semigroup?
>
> What you seem to be searching for looks more like what we know as
> `cycle :: [a] -> [a]`, and in fact there is its generalisation at
>
> http://hackage.haskell.org/package/base-4.10.0.0/docs/
> Data-Semigroup.html#v:cycle1
>
> hth
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170910/8739a770/attachment.html>


More information about the ghc-devs mailing list