Skip to content

Commit 5f01581

Browse files
milesfrainturlando
authored andcommitted
Add examples for power (purescript#253)
1 parent 847a1a4 commit 5f01581

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Data/Monoid.purs

+8
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ instance monoidRecord :: (RL.RowToList row list, MonoidRecord list row row) => M
7272
-- | n` cancels with `power x (-n)`, i.e. `power x n <> power x (-n) = mempty`.
7373
-- | For that, we would additionally need the ability to invert elements, i.e.
7474
-- | a Group.
75+
-- |
76+
-- | ```purescript
77+
-- | power [1,2] 3 == [1,2,1,2,1,2]
78+
-- | power [1,2] 1 == [1,2]
79+
-- | power [1,2] 0 == []
80+
-- | power [1,2] (-3) == []
81+
-- | ```
82+
-- |
7583
power :: forall m. Monoid m => m -> Int -> m
7684
power x = go
7785
where

0 commit comments

Comments
 (0)