Skip to content

Commit afe8639

Browse files
authored
Merge pull request #314 from typelift/swift-develop
Merge Swift 3.0 Support into Master
2 parents 2827502 + 0405aca commit afe8639

File tree

92 files changed

+4546
-4603
lines changed

Some content is hidden

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

92 files changed

+4546
-4603
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Xcode
22
.DS_Store
33
build/
4+
.build/*
5+
Packages/*
46
*.pbxuser
57
!default.pbxuser
68
*.mode1v3

.travis.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@ matrix:
55
include:
66
- os: osx
77
language: objective-c
8-
osx_image: xcode7.3
8+
osx_image: xcode8
99
before_install:
1010
- git submodule update --init --recursive
1111
script:
12-
- pod lib lint
12+
# Restore pod build before shipping for 3.0
13+
# - pod lib lint
1314
- carthage build --no-skip-current
1415
- os: osx
1516
language: objective-c
16-
osx_image: xcode7.3
17+
osx_image: xcode8
1718
before_install:
1819
- git submodule update --init --recursive
1920
script:
2021
- set -o pipefail
2122
- xcodebuild test -scheme Swiftz | xcpretty -c
2223
# !!!: Make sure desired device name & OS version are suitable for the Xcode version installed on osx_image
23-
- iOS_DEVICE_NAME="iPad Pro"
24-
- iOS_RUNTIME_VERSION="9.3"
24+
- iOS_DEVICE_NAME="iPad Pro (12.9 inch)"
25+
- iOS_RUNTIME_VERSION="10.0"
2526
# Get simulator identifier for desired device/runtime pair
2627
- SIMULATOR_ID=$(xcrun instruments -s | grep -o "${iOS_DEVICE_NAME} (${iOS_RUNTIME_VERSION}) \[.*\]" | grep -o "\[.*\]" | sed "s/^\[\(.*\)\]$/\1/")
2728
- echo $SIMULATOR_ID
@@ -36,12 +37,11 @@ matrix:
3637
before_install:
3738
- git submodule update --init --recursive
3839
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
39-
- wget https://swift.org/builds/swift-2.2.1-release/ubuntu1404/swift-2.2.1-RELEASE/swift-2.2.1-RELEASE-ubuntu14.04.tar.gz
40-
- tar xzf swift-2.2.1-RELEASE-ubuntu14.04.tar.gz
41-
- export PATH=${PWD}/swift-2.2.1-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
40+
- wget https://swift.org/builds/swift-3.0-release/ubuntu1404/swift-3.0-RELEASE/swift-3.0-RELEASE-ubuntu14.04.tar.gz
41+
- tar xzf swift-3.0-RELEASE-ubuntu14.04.tar.gz
42+
- export PATH=${PWD}/swift-3.0-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
4243
script:
43-
# Uncomment when releasing Swift 3.0
44-
# - swift build
44+
- swift build
4545
notifications:
4646
webhooks:
4747
urls:

Cartfile.private

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
github "typelift/Swiftx"
1+
github "typelift/Swiftx"
22
github "typelift/SwiftCheck"
33
github "typelift/Operadics"
44

Cartfile.resolved

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
github "typelift/Operadics" "0.2.0"
2-
github "typelift/SwiftCheck" "v0.6.2"
3-
github "typelift/Swiftx" "v0.4.0"
1+
github "typelift/Operadics" "0.2.2"
2+
github "typelift/SwiftCheck" "v0.7.0"
3+
github "typelift/Swiftx" "0.5.0"

Package.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import PackageDescription
2+
3+
let package = Package(
4+
name: "Swiftz",
5+
targets: [
6+
Target(name: "Swiftz")
7+
],
8+
dependencies: [
9+
.Package(url: "https://github.com/typelift/Operadics.git", versions: Version(0,2,2)...Version(0,2,2)),
10+
.Package(url: "https://github.com/typelift/Swiftx.git", versions: Version(0,5,0)...Version(0,5,0)),
11+
]
12+
)
13+
14+
let libSwiftz = Product(name: "Swiftz", type: .Library(.Dynamic), modules: "Swiftz")
15+
products.append(libSwiftz)
16+

Sources/Applicative.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// Applicative.swift
3+
// Swiftz
4+
//
5+
// Created by Maxwell Swadling on 15/06/2014.
6+
// Copyright (c) 2014-2016 Maxwell Swadling. All rights reserved.
7+
//
8+
9+
/// Applicative sits in the middle distance between a Functor and a Monad. An
10+
/// Applicative Functor is a Functor equipped with a function (called point or
11+
/// pure) that takes a value to an instance of a functor containing that value.
12+
/// Applicative Functors provide the ability to operate on not just values, but
13+
/// values in a functorial context such as Eithers, Lists, and Optionals without
14+
/// needing to unwrap or map over their contents.
15+
public protocol Applicative : Pointed, Functor {
16+
/// Type of Functors containing morphisms from our objects to a target.
17+
associatedtype FAB = K1<(A) -> B>
18+
19+
/// Applies the function encapsulated by the Functor to the value
20+
/// encapsulated by the receiver.
21+
func ap(_ f : FAB) -> FB
22+
}
23+
24+
/// Additional functions to be implemented by those types conforming to the
25+
/// Applicative protocol.
26+
public protocol ApplicativeOps : Applicative {
27+
associatedtype C
28+
associatedtype FC = K1<C>
29+
associatedtype D
30+
associatedtype FD = K1<D>
31+
32+
/// Lift a function to a Functorial action.
33+
static func liftA(_ f : @escaping (A) -> B) -> (Self) -> FB
34+
35+
/// Lift a binary function to a Functorial action.
36+
static func liftA2(_ f : @escaping (A) -> (B) -> C) -> (Self) -> (FB) -> FC
37+
38+
/// Lift a ternary function to a Functorial action.
39+
static func liftA3(_ f : @escaping (A) -> (B) -> (C) -> D) -> (Self) -> (FB) -> (FC) -> FD
40+
}

0 commit comments

Comments
 (0)