Skip to content

Commit a9facba

Browse files
committed
Merge pull request #24 from CodaFi/swift-1-dot-2
[WIP] Swift 1.2
2 parents d05a455 + c51b90a commit a9facba

39 files changed

+276
-695
lines changed

Basis-iOS.xcodeproj/project.pbxproj

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
84922CE419D237DA00AE9A7C /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84922CB219D237DA00AE9A7C /* Arrow.swift */; };
4545
84922CE519D237DA00AE9A7C /* BASERealWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 84922CB319D237DA00AE9A7C /* BASERealWorld.h */; settings = {ATTRIBUTES = (Public, ); }; };
4646
84922CE619D237DA00AE9A7C /* BASERealWorld.m in Sources */ = {isa = PBXBuildFile; fileRef = 84922CB419D237DA00AE9A7C /* BASERealWorld.m */; };
47-
84922CE719D237DA00AE9A7C /* Basis-ObjCBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 84922CB519D237DA00AE9A7C /* Basis-ObjCBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
4847
84922CE819D237DA00AE9A7C /* Basis.h in Headers */ = {isa = PBXBuildFile; fileRef = 84922CB619D237DA00AE9A7C /* Basis.h */; settings = {ATTRIBUTES = (Public, ); }; };
4948
84922CE919D237DA00AE9A7C /* Bottom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84922CB719D237DA00AE9A7C /* Bottom.swift */; };
5049
84922CEA19D237DA00AE9A7C /* Bounded.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84922CB819D237DA00AE9A7C /* Bounded.swift */; };
@@ -87,7 +86,6 @@
8786
84D77DF61A3BE573000F5683 /* Pointed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D77DF51A3BE573000F5683 /* Pointed.swift */; };
8887
84D77DFB1A3CF9FA000F5683 /* ListSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D77DFA1A3CF9FA000F5683 /* ListSpec.swift */; };
8988
84F43F0119E1B3B40012CF95 /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F43F0019E1B3B40012CF95 /* Optional.swift */; };
90-
84F43F0519E1CA970012CF95 /* Set.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F43F0419E1CA970012CF95 /* Set.swift */; };
9189
84F9063019D639980035D429 /* CompareSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F9062F19D639980035D429 /* CompareSpec.swift */; };
9290
84F9071519D64DE10035D429 /* ScansSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F9071419D64DE10035D429 /* ScansSpec.swift */; };
9391
/* End PBXBuildFile section */
@@ -145,7 +143,6 @@
145143
84922CB219D237DA00AE9A7C /* Arrow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Arrow.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
146144
84922CB319D237DA00AE9A7C /* BASERealWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = BASERealWorld.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
147145
84922CB419D237DA00AE9A7C /* BASERealWorld.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = BASERealWorld.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
148-
84922CB519D237DA00AE9A7C /* Basis-ObjCBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "Basis-ObjCBridge.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
149146
84922CB619D237DA00AE9A7C /* Basis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Basis.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
150147
84922CB719D237DA00AE9A7C /* Bottom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Bottom.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
151148
84922CB819D237DA00AE9A7C /* Bounded.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Bounded.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
@@ -189,7 +186,6 @@
189186
84D77DF51A3BE573000F5683 /* Pointed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pointed.swift; sourceTree = "<group>"; };
190187
84D77DFA1A3CF9FA000F5683 /* ListSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ListSpec.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
191188
84F43F0019E1B3B40012CF95 /* Optional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Optional.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
192-
84F43F0419E1CA970012CF95 /* Set.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Set.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
193189
84F9062F19D639980035D429 /* CompareSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompareSpec.swift; sourceTree = "<group>"; };
194190
84F9071419D64DE10035D429 /* ScansSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScansSpec.swift; sourceTree = "<group>"; };
195191
/* End PBXFileReference section */
@@ -302,7 +298,6 @@
302298
children = (
303299
84922CB319D237DA00AE9A7C /* BASERealWorld.h */,
304300
84922CB419D237DA00AE9A7C /* BASERealWorld.m */,
305-
84922CB519D237DA00AE9A7C /* Basis-ObjCBridge.h */,
306301
84922CC719D237DA00AE9A7C /* Info.plist */,
307302
);
308303
name = "Supporting Files";
@@ -384,7 +379,6 @@
384379
84F43F0019E1B3B40012CF95 /* Optional.swift */,
385380
84922CD419D237DA00AE9A7C /* Monoid.swift */,
386381
84922EB219D386BD00AE9A7C /* Result.swift */,
387-
84F43F0419E1CA970012CF95 /* Set.swift */,
388382
84D77DF71A3BE57B000F5683 /* Pointed */,
389383
84922CD919D237DA00AE9A7C /* ST.swift */,
390384
84922CDA19D237DA00AE9A7C /* STRef.swift */,
@@ -432,7 +426,6 @@
432426
buildActionMask = 2147483647;
433427
files = (
434428
84922CE819D237DA00AE9A7C /* Basis.h in Headers */,
435-
84922CE719D237DA00AE9A7C /* Basis-ObjCBridge.h in Headers */,
436429
84922CE519D237DA00AE9A7C /* BASERealWorld.h in Headers */,
437430
);
438431
runOnlyForDeploymentPostprocessing = 0;
@@ -574,7 +567,6 @@
574567
84922D0119D237DA00AE9A7C /* Map.swift in Sources */,
575568
84D4D8E81A16EBAF001F5E4D /* Comonad.swift in Sources */,
576569
84922D1219D237DA00AE9A7C /* Tuple.swift in Sources */,
577-
84F43F0519E1CA970012CF95 /* Set.swift in Sources */,
578570
84922CE619D237DA00AE9A7C /* BASERealWorld.m in Sources */,
579571
84922CFC19D237DA00AE9A7C /* Kinds.swift in Sources */,
580572
84922CF319D237DA00AE9A7C /* Exit.swift in Sources */,
@@ -723,6 +715,7 @@
723715
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
724716
PRODUCT_NAME = "$(TARGET_NAME)";
725717
SKIP_INSTALL = YES;
718+
SWIFT_INSTALL_OBJC_HEADER = NO;
726719
SWIFT_OBJC_BRIDGING_HEADER = "";
727720
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
728721
};
@@ -741,6 +734,7 @@
741734
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
742735
PRODUCT_NAME = "$(TARGET_NAME)";
743736
SKIP_INSTALL = YES;
737+
SWIFT_INSTALL_OBJC_HEADER = NO;
744738
SWIFT_OBJC_BRIDGING_HEADER = "";
745739
};
746740
name = Release;

Basis.xcodeproj/project.pbxproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
84922D4819D237E000AE9A7C /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84922D1619D237E000AE9A7C /* Arrow.swift */; };
4343
84922D4919D237E000AE9A7C /* BASERealWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 84922D1719D237E000AE9A7C /* BASERealWorld.h */; settings = {ATTRIBUTES = (Public, ); }; };
4444
84922D4A19D237E000AE9A7C /* BASERealWorld.m in Sources */ = {isa = PBXBuildFile; fileRef = 84922D1819D237E000AE9A7C /* BASERealWorld.m */; };
45-
84922D4B19D237E000AE9A7C /* Basis-ObjCBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 84922D1919D237E000AE9A7C /* Basis-ObjCBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
4645
84922D4C19D237E000AE9A7C /* Basis.h in Headers */ = {isa = PBXBuildFile; fileRef = 84922D1A19D237E000AE9A7C /* Basis.h */; settings = {ATTRIBUTES = (Public, ); }; };
4746
84922D4D19D237E000AE9A7C /* Bottom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84922D1B19D237E000AE9A7C /* Bottom.swift */; };
4847
84922D4E19D237E000AE9A7C /* Bounded.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84922D1C19D237E000AE9A7C /* Bounded.swift */; };
@@ -153,7 +152,6 @@
153152
84922D1619D237E000AE9A7C /* Arrow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Arrow.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
154153
84922D1719D237E000AE9A7C /* BASERealWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = BASERealWorld.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
155154
84922D1819D237E000AE9A7C /* BASERealWorld.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = BASERealWorld.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
156-
84922D1919D237E000AE9A7C /* Basis-ObjCBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "Basis-ObjCBridge.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
157155
84922D1A19D237E000AE9A7C /* Basis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Basis.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
158156
84922D1B19D237E000AE9A7C /* Bottom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Bottom.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
159157
84922D1C19D237E000AE9A7C /* Bounded.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Bounded.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
@@ -281,7 +279,6 @@
281279
children = (
282280
84922D1719D237E000AE9A7C /* BASERealWorld.h */,
283281
84922D1819D237E000AE9A7C /* BASERealWorld.m */,
284-
84922D1919D237E000AE9A7C /* Basis-ObjCBridge.h */,
285282
84922D2B19D237E000AE9A7C /* Info.plist */,
286283
);
287284
name = "Supporting Files";
@@ -332,7 +329,6 @@
332329
84922D3819D237E000AE9A7C /* Monoid.swift */,
333330
84922EB019D3869B00AE9A7C /* Result.swift */,
334331
84D77DF41A3BDCBA000F5683 /* Pointed */,
335-
842963B119DF7A3A003FCBE8 /* Set.swift */,
336332
84922D3D19D237E000AE9A7C /* ST.swift */,
337333
842A315D1A9982FD00039306 /* State.swift */,
338334
84922D3E19D237E000AE9A7C /* STRef.swift */,
@@ -447,7 +443,6 @@
447443
buildActionMask = 2147483647;
448444
files = (
449445
84922D4C19D237E000AE9A7C /* Basis.h in Headers */,
450-
84922D4B19D237E000AE9A7C /* Basis-ObjCBridge.h in Headers */,
451446
84922D4919D237E000AE9A7C /* BASERealWorld.h in Headers */,
452447
);
453448
runOnlyForDeploymentPostprocessing = 0;
@@ -591,7 +586,6 @@
591586
841FE04419DB7E7C0068636A /* Transformations.swift in Sources */,
592587
84922D5A19D237E000AE9A7C /* Function.swift in Sources */,
593588
84922D6519D237E000AE9A7C /* Map.swift in Sources */,
594-
842963B219DF7A3A003FCBE8 /* Set.swift in Sources */,
595589
84922D7619D237E000AE9A7C /* Tuple.swift in Sources */,
596590
84922D4A19D237E000AE9A7C /* BASERealWorld.m in Sources */,
597591
84922D6019D237E000AE9A7C /* Kinds.swift in Sources */,
@@ -747,7 +741,9 @@
747741
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
748742
PRODUCT_NAME = "$(TARGET_NAME)";
749743
SKIP_INSTALL = YES;
744+
SWIFT_INSTALL_OBJC_HEADER = NO;
750745
SWIFT_OBJC_BRIDGING_HEADER = "";
746+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "Basis-Swift.h";
751747
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
752748
};
753749
name = Debug;
@@ -767,7 +763,9 @@
767763
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
768764
PRODUCT_NAME = "$(TARGET_NAME)";
769765
SKIP_INSTALL = YES;
766+
SWIFT_INSTALL_OBJC_HEADER = NO;
770767
SWIFT_OBJC_BRIDGING_HEADER = "";
768+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "Basis-Swift.h";
771769
};
772770
name = Release;
773771
};

Basis/Applicative.swift

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
// Released under the MIT license.
88
//
99

10-
/// Applicative sits in the middle distance between a Functor and a Monad. An Applicative Functor
11-
/// is a Functor equipped with a function (called point or lift) that takes a value to an instance
12-
/// of a functor containing that value. Applicative Functors provide the ability to operate on not
13-
/// just values, but values in a functorial context such as Eithers, Lists, and Optionals without
14-
/// needing to unwrap or map over their contents.
10+
/// Applicative sits in the middle distance between a Functor and a Monad.
11+
///
12+
/// Applicative Functors, as the name implies, allow for the application of functions inside of
13+
/// Functors. In this way Applicative Functors provide the ability to operate on not just values,
14+
/// but values in a functorial context such as Eithers, Lists, and Optionals without needing to
15+
/// unwrap or map over their contents.
1516
public protocol Applicative : Pointed, Functor {
1617
/// Type of Functors containing morphisms from our objects to a target.
1718
typealias FAB = K1<A -> B>
1819

19-
class func ap(FAB) -> Self -> FB
20+
static func ap(FAB) -> Self -> FB
2021

2122
/// Sequential Application | Applies the function "inside the Functor" to the "inside" of our
2223
/// Functor and herds up the results.
@@ -26,21 +27,24 @@ public protocol Applicative : Pointed, Functor {
2627
/// the right.
2728
///
2829
/// Default definition:
29-
/// `const(id) <%> a <*> b`
30+
///
31+
/// const(id) <%> a <*> b
3032
func *>(Self, FB) -> FB
3133

3234
/// Sequence Left | Disregards the Functor on the Right.
3335
///
3436
/// Default definition:
35-
/// `const <%> a <*> b`
37+
///
38+
/// const <%> a <*> b
3639
func <*(Self, FB) -> Self
3740
}
3841

3942
/// Alternatives are Applicative Monoids.
4043
public protocol Alternative : Applicative {
4144
/// The type of the result of Alternative's mappend-esque functions.
4245
typealias FLA = K1<[A]>
43-
46+
typealias FMA = K1<Maybe<A>>
47+
4448
/// Returns the identity element.
4549
func empty() -> Self
4650

@@ -62,6 +66,13 @@ public protocol Alternative : Applicative {
6266
///
6367
/// some(v) <|> pure([])
6468
func many(Self) -> FLA
69+
70+
/// One or none
71+
///
72+
/// Default definition:
73+
///
74+
/// `Maybe.just <%> v <|> pure(Maybe.nothing())`
75+
func optional(Self) -> FMA
6576
}
6677

6778
/// Additional functions to be implemented by those types conforming to the Applicative protocol.
@@ -72,11 +83,11 @@ public protocol ApplicativeOps : Applicative {
7283
typealias FD = K1<D>
7384

7485
/// Lift a function to a Functorial action.
75-
class func liftA(f : A -> B) -> Self -> FB
86+
static func liftA(f : A -> B) -> Self -> FB
7687

7788
/// Lift a binary function to a Functorial action.
78-
class func liftA2(f : A -> B -> C) -> Self -> FB -> FC
89+
static func liftA2(f : A -> B -> C) -> Self -> FB -> FC
7990

8091
/// Lift a ternary function to a Functorial action.
81-
class func liftA3(f : A -> B -> C -> D) -> Self -> FB -> FC -> FD
92+
static func liftA3(f : A -> B -> C -> D) -> Self -> FB -> FC -> FD
8293
}

Basis/Arrow.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public protocol Arrow : Category {
6666
typealias FANOUT = K2<B, (B, D)>
6767

6868
/// Lift a function to an arrow.
69-
class func arr(A -> B) -> Self
69+
static func arr(A -> B) -> Self
7070

7171
/// Splits the arrow into two tuples that model a computation that applies our Arrow to an
7272
/// argument on the "left side" and sends the "right side" through unchanged.
@@ -96,7 +96,7 @@ public protocol ArrowZero : Arrow {
9696
typealias ABC = K2<A, B>
9797

9898
/// The identity arrow.
99-
class func zeroArrow() -> ABC
99+
static func zeroArrow() -> ABC
100100
}
101101

102102
/// A monoid for Arrows.
@@ -147,10 +147,10 @@ public protocol ArrowChoice : Arrow {
147147

148148
/// Feed marked inputs through the argument arrow, passing the rest through unchanged to the
149149
/// output.
150-
class func left(Self) -> LEFT
150+
static func left(Self) -> LEFT
151151

152152
/// The mirror image of left.
153-
class func right(Self) -> RIGHT
153+
static func right(Self) -> RIGHT
154154

155155
/// Splat | Split the input between both argument arrows, then retag and merge their outputs
156156
/// into Eithers.
@@ -167,11 +167,11 @@ public protocol ArrowChoice : Arrow {
167167
/// \
168168
/// o - a - [ f ] -> b
169169
/// /
170-
/// a -------> a - •
170+
/// a ------------ •
171171
///
172172
public protocol ArrowApply : Arrow {
173173
typealias APP = K2<(Self, A), B>
174-
class func app() -> APP
174+
static func app() -> APP
175175
}
176176

177177
/// Arrows that admit right-tightening recursion.
@@ -188,5 +188,5 @@ public protocol ArrowApply : Arrow {
188188
public protocol ArrowLoop : Arrow {
189189
typealias LOOP = K2<(A, D), (B, D)>
190190

191-
class func loop(LOOP) -> Self
191+
static func loop(LOOP) -> Self
192192
}

Basis/Basis-ObjCBridge.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

Basis/Bottom.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@
77
// Released under the MIT license.
88
//
99

10-
/// The type from which no information may be drawn.
10+
/// The type from which no information may be drawn and no instances may be made. Bottom (also
11+
/// notated ⊥) is the type of all computations that never complete successfully and is inhabited by
12+
/// infinite loops and fatal errors.
1113
public enum Bottom { }
14+
15+
/// Computes ⊥.
16+
public func absurd() -> Bottom {
17+
return absurd()
18+
}

Basis/Bounded.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
/// Bounded types are types that have definable upper and lower limits. For types like the Int and
1111
/// Float, their limits are the minimum and maximum possible values representable in their bit-
1212
/// width. While the definition of a "limit" is flexible, generally custom types that wish to
13-
/// appear bounded must come with some kind of supremum or infimum.
13+
/// appear bounded must come with some kind of supremum and infimum.
1414
public protocol Bounded {
15-
class func minBound() -> Self
16-
class func maxBound() -> Self
15+
static func minBound() -> Self
16+
static func maxBound() -> Self
1717
}
1818

1919
extension Bool : Bounded {

Basis/Category.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
/// between those objects. Each object includes an identity morphism, and composition of morphisms
1212
/// is the primary reason categories are such powerful abstractions.
1313
///
14-
/// Here, a Category is some class of Kind * -> * -> * that you can think of as modelling an "arrow"
15-
/// from A -> B. This means that if we provide a composition function, `•`, we can hook up
16-
/// Categories from A -> B with Categories from B -> C and get Categories from A -> C. This
17-
/// function is also called >>>.
14+
/// Here, a Category is some class of Kind `* -> * -> *` that you can think of as modelling an "arrow"
15+
/// A -> B. This means that if we provide a composition function, `•`, we can hook up Categories
16+
/// from A -> B with Categories from B -> C and get Categories from A -> C.
1817
public protocol Category {
1918
/// Source
2019
typealias A
@@ -31,7 +30,7 @@ public protocol Category {
3130
typealias CAC = K2<A, C>
3231

3332
/// The identity morphism.
34-
class func id() -> CAA
33+
static func id() -> CAA
3534

3635
/// Composition of categories.
3736
///

Basis/Coerce.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// The highly unsafe primitive unsafeCoerce converts a value from any type to any other type.
1111
/// Needless to say, if you use this function, it is your responsibility to ensure that the old and
1212
/// new types have identical internal representations, in order to prevent runtime corruption.
13-
/// ~http://hackage.haskell.org/package/base-4.7.0.1/docs/Unsafe-Coerce.html
13+
/// ~( http://hackage.haskell.org/package/base-4.7.0.1/docs/Unsafe-Coerce.html )
1414
public func unsafeCoerce<A, B>(x : A) -> B {
1515
return unsafeBitCast(x, B.self)
1616
}

0 commit comments

Comments
 (0)