Semigroup repeat (base package)

Herbert Valerio Riedel hvriedel at
Sun Sep 10 08:39:37 UTC 2017


On Sun, Sep 10, 2017 at 9:24 AM, Harendra Kumar
<harendra.kumar at> 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


More information about the ghc-devs mailing list