Talk:Data.Semigroup
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The page says `stimes` applies the binary operation `x` times, while in fact, the binary operation is applied `x-1` times to `x` elements in total. In the example `3 * 3 * 3 * 3`, `*` is applied three times (not four), to four elements. Here is what the page currently (Jan, 2020) says:
stimes :: Integral b => b -> a -> a
- Given a number
x
and a value of typea
, apply<>
to the valuex
times.
stimes 4 (Product 3) -- with the type "Product a" "<>" becomes "*" -- returns: Product {getProduct = 81} -- This is because (3 <> 3 <> 3 <> 3) == (3 * 3 * 3 * 3) == 81 -- i.e. 3 multiplied by itself 4 times.