Skip to content

Commit

Permalink
doc add monoid example
Browse files Browse the repository at this point in the history
  • Loading branch information
ireina7 committed May 21, 2023
1 parent 18f7d5b commit 34e6adb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ func main() {

## An example for `Monoid` and `Fold`
```go
type Monoid[A any] interface {
Zero() A
Plus(a, b A) A
}

type MonoidString struct{}

func (self *MonoidString) Zero() string {
Expand Down

0 comments on commit 34e6adb

Please sign in to comment.