Skip to content

Commit

Permalink
Merge pull request #17 from dn-m/issue/11
Browse files Browse the repository at this point in the history
Remove Number module and move Number things to Algebra/Adapters
  • Loading branch information
jsbean authored Jul 30, 2017
2 parents e42983e + 98a60f8 commit bd341ad
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 36 deletions.
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ let package = Package(
.target(name: "DictionaryProtocol"),
.target(name: "LinkedList"),
.target(name: "Matrix"),
.target(name: "Number", dependencies: ["Algebra"]),
.target(name: "OrderedDictionary", dependencies: ["DictionaryProtocol"]),
.target(name: "PatternMatching"),
.target(name: "Predicates"),
Expand Down
30 changes: 30 additions & 0 deletions Sources/Algebra/Adapters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import Destructure

// - MARK: collections

extension Sequence where Element: Monoid {

/// - Returns: The values contained herein, reduced from the `.identity` value of the `Monoid`,
Expand Down Expand Up @@ -116,3 +118,31 @@ extension Array {
return [head] + tail
}
}

// - MARK: numeric types

extension Int: Additive {
public static let zero: Int = 0
}

extension Int: Multiplicative {
public static let one: Int = 1
}

extension Float: Additive {
public static let zero: Float = 0
}

extension Float: Multiplicative {
public static let one: Float = 1
}

extension Double: Additive {
public static let zero: Double = 0
}

extension Double: Multiplicative {
public static let one: Double = 1
}

// FIXME: Flesh out
35 changes: 0 additions & 35 deletions Sources/Number/Number.swift

This file was deleted.

0 comments on commit bd341ad

Please sign in to comment.