Skip to content

Commit 65c9c4d

Browse files
committed
Merge pull request #167 from pthariensflame/topic/num
Revamp `Num`, `Semigroup`, and `Monoid`
2 parents 4bdcb8c + c733a52 commit 65c9c4d

File tree

6 files changed

+231
-211
lines changed

6 files changed

+231
-211
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,19 @@ import func Swiftz.sconcat
190190
import struct Swiftz.Min
191191

192192
/// The least element of a list can be had with the Min Semigroup.
193-
let smallestElement = sconcat(Min(), 2, xs) // 0
193+
let smallestElement = sconcat(Min(2), xs.map { Min($0) }).value() // 0
194194

195195
import protocol Swiftz.Monoid
196196
import func Swiftz.mconcat
197197
import struct Swiftz.Sum
198198

199199
/// Or the sum of a list with the Sum Monoid.
200-
let sum = mconcat(Sum<Int8, NInt8>(i: nint8), xs) // 10
200+
let sum = mconcat(xs.map { Sum($0) }).value() // 10
201201

202202
import struct Swiftz.Product
203203

204204
/// Or the product of a list with the Product Monoid.
205-
let product = mconcat(Product<Int8, NInt8>(i: nint8), xs) // 0
205+
let product = mconcat(xs.map { Product($0) }).value() // 0
206206
```
207207

208208
**Arrows**

0 commit comments

Comments
 (0)