Skip to content

Commit 2105329

Browse files
committed
Merge pull request #255 from CodaFi/forward-march
Swift 2.0 Support
2 parents 2c173ef + c49be8b commit 2105329

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4338
-3089
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ DerivedData
1616
*.hmap
1717
*.ipa
1818
*.xcuserstate
19+
*.xcscmblueprint
20+
*.resolved
21+
Carthage/Build
22+
Carthage/Checkouts
23+

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "Carthage/Checkouts/SwiftCheck"]
55
path = Carthage/Checkouts/SwiftCheck
66
url = https://github.com/typelift/SwiftCheck.git
7+
[submodule "Carthage/Checkouts/Operadics"]
8+
path = Carthage/Checkouts/Operadics
9+
url = https://github.com/typelift/Operadics.git

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
language: objective-c
2-
osx_image: beta-xcode6.3
2+
osx_image: xcode7
33

4-
install:
4+
before_install:
5+
- gem install xcpretty-travis-formatter --no-rdoc --no-ri --no-document --quiet
6+
7+
install:
58
- git submodule update -i --recursive
69

710
script:
8-
- xctool -project Swiftz.xcodeproj -scheme Swiftz -sdk macosx ONLY_ACTIVE_ARCH=NO clean build test
9-
- xctool -project Swiftz.xcodeproj -scheme Swiftz-iOS -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO clean build test
10-
11+
- set -o pipefail && xcodebuild -project Swiftz.xcodeproj -scheme Swiftz -sdk macosx ONLY_ACTIVE_ARCH=NO clean build test | xcpretty -c -f `xcpretty-travis-formatter`
12+
- set -o pipefail && xcodebuild -project Swiftz.xcodeproj -scheme Swiftz-iOS -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO clean build test | xcpretty -c -f `xcpretty-travis-formatter`

Cartfile.private

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
github "typelift/Swiftx"
22
github "typelift/SwiftCheck"
3+
github "typelift/Operadics"
4+

Cartfile.resolved

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
github "typelift/SwiftCheck" "v0.2.6"
2-
github "typelift/Swiftx" "v0.2.1"
1+
github "typelift/Operadics" "0.1.4"
2+
github "typelift/SwiftCheck" "v0.3.1"
3+
github "typelift/Swiftx" "v0.3.0"

Carthage/Checkouts/Operadics

Submodule Operadics added at c65e635

Carthage/Checkouts/SwiftCheck

Submodule SwiftCheck updated 46 files

README.md

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ the library rely on their combinatorial semantics to allow declarative ideas to
5252
be expressed more clearly in Swift.
5353

5454
Swiftz is a proper superset of [Swiftx](https://github.com/typelift/Swiftx) that
55-
implements higher-level data types like Lenses, Zippers, HLists, and a number of
55+
implements higher-level data types like Arrows, Lists, HLists, and a number of
5656
typeclasses integral to programming with the maximum amount of support from the
5757
type system.
5858

@@ -112,11 +112,6 @@ public class User : JSONDecodable {
112112
<*> x <? "tweets"
113113
<*> x <? "attrs" <> "one" // A nested keypath
114114
}
115-
116-
// lens example
117-
public class func luserName() -> Lens<User, User, String, String> {
118-
return Lens { user in IxStore(user.name) { User($0, user.age, user.tweets, user.attr) } }
119-
}
120115
}
121116

122117
public func ==(lhs : User, rhs : User) -> Bool {
@@ -129,55 +124,7 @@ let userjs = "{\"name\": \"max\", \"age\": 10, \"tweets\": [\"hello\"], \"attrs\
129124
//: the user would be nil.
130125
let user : User? = JSONValue.decode(userjs) >>- User.fromJSON // .Some( User("max", 10, ["hello"], "1") )
131126
```
132-
133-
**Lenses**
134-
135-
```swift
136-
import struct Swiftz.Lens
137-
import struct Swiftz.IxStore
138-
139-
//: A party has a host, who is a user.
140-
final class Party {
141-
let host : User
142-
143-
init(h : User) {
144-
host = h
145-
}
146-
147-
class func lpartyHost() -> Lens<Party, Party, User, User> {
148-
let getter = { (party : Party) -> User in
149-
party.host
150-
}
151-
152-
let setter = { (party : Party, host : User) -> Party in
153-
Party(h: host)
154-
}
155-
156-
return Lens(get: getter, set: setter)
157-
}
158-
}
159-
160-
//: A Lens for the User's name.
161-
extension User {
162-
public class func luserName() -> Lens<User, User, String, String> {
163-
return Lens { user in IxStore(user.name) { User($0, user.age, user.tweets, user.attrs) } }
164-
}
165-
}
166-
167-
//: Let's throw a party now.
168-
let party = Party(h: User("max", 1, [], Dictionary()))
169-
170-
//: A lens for a party host's name.
171-
let hostnameLens = Party.lpartyHost() User.luserName()
172-
173-
//: Retrieve our gracious host's name.
174-
let name = hostnameLens.get(party) // "max"
175-
176-
//: Our party seems to be lacking in proper nouns.
177-
let updatedParty = (Party.lpartyHost() User.luserName()).set(party, "Max")
178-
let properName = hostnameLens.get(updatedParty) // "Max"
179-
```
180-
127+
181128
**Semigroups and Monoids**
182129

183130
```swift

Swiftz.podspec

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Swiftz"
3-
s.version = "0.2.4"
3+
s.version = "0.3.0"
44
s.summary = "Swiftz is a Swift library for functional programming."
55
s.homepage = "https://github.com/typelift/Swiftz"
66
s.license = { :type => "BSD" }
@@ -10,6 +10,5 @@ Pod::Spec.new do |s|
1010
s.osx.deployment_target = "10.9"
1111
s.ios.deployment_target = "8.0"
1212
s.source = { :git => "https://github.com/typelift/Swiftz.git", :tag => "v#{s.version}", :submodules => true }
13-
s.source_files = "Swiftz/*.swift", "**/Swiftx/*.swift"
14-
s.exclude_files = "**/Swiftx/Operators.swift"
13+
s.source_files = "Swiftz/*.swift", "**/Swiftx/*.swift", "**/Operadics/*.swift"
1514
end

0 commit comments

Comments
 (0)