Skip to content

Commit

Permalink
Merge pull request #167 from pthariensflame/topic/num
Browse files Browse the repository at this point in the history
Revamp `Num`, `Semigroup`, and `Monoid`
  • Loading branch information
CodaFi committed Jan 29, 2015
2 parents 4bdcb8c + c733a52 commit 65c9c4d
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 211 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,19 @@ import func Swiftz.sconcat
import struct Swiftz.Min

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

import protocol Swiftz.Monoid
import func Swiftz.mconcat
import struct Swiftz.Sum

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

import struct Swiftz.Product

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

**Arrows**
Expand Down
Loading

0 comments on commit 65c9c4d

Please sign in to comment.