Permalink
Browse files

Switch from github.com/LlamaKit/LlamaKit to github.com/antitypical/Re…

…sult.

Because [lamaKit told me to](https://github.com/LlamaKit/LlamaKit).
  • Loading branch information...
kareman committed Apr 8, 2015
1 parent 3e6463f commit f527d9e0e8999479c4627dd4ffdd5871174b7edf
View
@@ -1,2 +1,2 @@
github "thoughtbot/runes"
-github "LlamaKit/LlamaKit"
+github "antitypical/Result" "master"
View
@@ -1,2 +1,5 @@
-github "LlamaKit/LlamaKit" "v0.6.0"
+github "robrix/Box" "18d05a56845837eea90a36854c67de2520983bf8"
+github "robrix/Prelude" "180e9ae5e60ec47abd8f3e0fa68cafbbbd160abe"
github "thoughtbot/runes" "v1.2.2"
+github "robrix/Either" "026d3471bca7c9573fdec46bab3d8f265d2ec001"
+github "antitypical/Result" "fdb2f9b7023647db606879119b09f4c732214592"
@@ -7,12 +7,21 @@
objects = {
/* Begin PBXBuildFile section */
+ BABF32F91AD481B3007DC6AE /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F51AD481B3007DC6AE /* Result.framework */; };
+ BABF32FA1AD481B3007DC6AE /* Either.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F61AD481B3007DC6AE /* Either.framework */; };
+ BABF32FB1AD481B3007DC6AE /* Prelude.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F71AD481B3007DC6AE /* Prelude.framework */; };
+ BABF32FC1AD481B3007DC6AE /* Box.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F81AD481B3007DC6AE /* Box.framework */; };
+ BABF32FD1AD4825F007DC6AE /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F51AD481B3007DC6AE /* Result.framework */; };
+ BABF32FE1AD4825F007DC6AE /* Either.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F61AD481B3007DC6AE /* Either.framework */; };
+ BABF32FF1AD4825F007DC6AE /* Prelude.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F71AD481B3007DC6AE /* Prelude.framework */; };
+ BABF33001AD4825F007DC6AE /* Box.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BABF32F81AD481B3007DC6AE /* Box.framework */; };
+ BABF33011AD482BB007DC6AE /* Result.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BABF32F51AD481B3007DC6AE /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ BABF33021AD482BB007DC6AE /* Either.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BABF32F61AD481B3007DC6AE /* Either.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ BABF33031AD482BB007DC6AE /* Prelude.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BABF32F71AD481B3007DC6AE /* Prelude.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ BABF33041AD482BB007DC6AE /* Box.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BABF32F81AD481B3007DC6AE /* Box.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BAC6B22B1A61D92B005643D9 /* FootlessParser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAC6B21F1A61D92B005643D9 /* FootlessParser.framework */; };
- BAC6CE5B1AC5B51D002246E5 /* LlamaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAC6CE591AC5B51D002246E5 /* LlamaKit.framework */; };
BAC6CE5C1AC5B51D002246E5 /* Runes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAC6CE5A1AC5B51D002246E5 /* Runes.framework */; };
- BAC6CE5D1AC5B621002246E5 /* LlamaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAC6CE591AC5B51D002246E5 /* LlamaKit.framework */; };
BAC6CE5E1AC5B621002246E5 /* Runes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAC6CE5A1AC5B51D002246E5 /* Runes.framework */; };
- BAC6CE601AC5B669002246E5 /* LlamaKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BAC6CE591AC5B51D002246E5 /* LlamaKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BAC6CE611AC5B669002246E5 /* Runes.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BAC6CE5A1AC5B51D002246E5 /* Runes.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BAC6CE671AC5BBB3002246E5 /* Result+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAC6CE661AC5BBB3002246E5 /* Result+Operators.swift */; };
BAC6CE691AC5DC32002246E5 /* ParserInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAC6CE681AC5DC32002246E5 /* ParserInput.swift */; };
@@ -38,7 +47,10 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
- BAC6CE601AC5B669002246E5 /* LlamaKit.framework in CopyFiles */,
+ BABF33011AD482BB007DC6AE /* Result.framework in CopyFiles */,
+ BABF33021AD482BB007DC6AE /* Either.framework in CopyFiles */,
+ BABF33031AD482BB007DC6AE /* Prelude.framework in CopyFiles */,
+ BABF33041AD482BB007DC6AE /* Box.framework in CopyFiles */,
BAC6CE611AC5B669002246E5 /* Runes.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -47,11 +59,14 @@
/* Begin PBXFileReference section */
BABF32F01AD4223A007DC6AE /* Playground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; name = Playground.playground; path = tests/Playground.playground; sourceTree = "<group>"; };
+ BABF32F51AD481B3007DC6AE /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/Mac/Result.framework; sourceTree = "<group>"; };
+ BABF32F61AD481B3007DC6AE /* Either.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Either.framework; path = Carthage/Build/Mac/Either.framework; sourceTree = "<group>"; };
+ BABF32F71AD481B3007DC6AE /* Prelude.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Prelude.framework; path = Carthage/Build/Mac/Prelude.framework; sourceTree = "<group>"; };
+ BABF32F81AD481B3007DC6AE /* Box.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Box.framework; path = Carthage/Build/Mac/Box.framework; sourceTree = "<group>"; };
BAC6B21F1A61D92B005643D9 /* FootlessParser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FootlessParser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BAC6B2231A61D92B005643D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BAC6B22A1A61D92B005643D9 /* FootlessParserTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FootlessParserTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
BAC6B2301A61D92B005643D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- BAC6CE591AC5B51D002246E5 /* LlamaKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LlamaKit.framework; path = Carthage/Build/Mac/LlamaKit.framework; sourceTree = "<group>"; };
BAC6CE5A1AC5B51D002246E5 /* Runes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Runes.framework; path = Carthage/Build/Mac/Runes.framework; sourceTree = "<group>"; };
BAC6CE661AC5BBB3002246E5 /* Result+Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Result+Operators.swift"; sourceTree = "<group>"; };
BAC6CE681AC5DC32002246E5 /* ParserInput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParserInput.swift; sourceTree = "<group>"; };
@@ -65,7 +80,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- BAC6CE5B1AC5B51D002246E5 /* LlamaKit.framework in Frameworks */,
+ BABF32F91AD481B3007DC6AE /* Result.framework in Frameworks */,
+ BABF32FA1AD481B3007DC6AE /* Either.framework in Frameworks */,
+ BABF32FB1AD481B3007DC6AE /* Prelude.framework in Frameworks */,
+ BABF32FC1AD481B3007DC6AE /* Box.framework in Frameworks */,
BAC6CE5C1AC5B51D002246E5 /* Runes.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -74,7 +92,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- BAC6CE5D1AC5B621002246E5 /* LlamaKit.framework in Frameworks */,
+ BABF32FD1AD4825F007DC6AE /* Result.framework in Frameworks */,
+ BABF32FE1AD4825F007DC6AE /* Either.framework in Frameworks */,
+ BABF32FF1AD4825F007DC6AE /* Prelude.framework in Frameworks */,
+ BABF33001AD4825F007DC6AE /* Box.framework in Frameworks */,
BAC6CE5E1AC5B621002246E5 /* Runes.framework in Frameworks */,
BAC6B22B1A61D92B005643D9 /* FootlessParser.framework in Frameworks */,
);
@@ -151,6 +172,10 @@
BAC6CE621AC5B686002246E5 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ BABF32F51AD481B3007DC6AE /* Result.framework */,
+ BABF32F61AD481B3007DC6AE /* Either.framework */,
+ BABF32F71AD481B3007DC6AE /* Prelude.framework */,
+ BABF32F81AD481B3007DC6AE /* Box.framework */,
BAC6CE631AC5B6B0002246E5 /* Mac */,
);
name = Frameworks;
@@ -159,7 +184,6 @@
BAC6CE631AC5B6B0002246E5 /* Mac */ = {
isa = PBXGroup;
children = (
- BAC6CE591AC5B51D002246E5 /* LlamaKit.framework */,
BAC6CE5A1AC5B51D002246E5 /* Runes.framework */,
);
name = Mac;
@@ -3,7 +3,7 @@
// From https://github.com/thoughtbot/Runes/blob/a2d22e2a761d4284deb30318930bd7ab3382c47f/Source/Result.swift
//
-import LlamaKit
+import Result
import Runes
/**
@@ -37,26 +37,6 @@ public func <*><T, U, E>(f: Result<(T -> U), E>, a: Result<T, E>) -> Result<U, E
return a.apply(f)
}
-/**
- flatMap a function over a result
-
- - If the value is .Failure, the function will not be evaluated and this will return the failure
- - If the value is .Success, the function will be applied to the unwrapped value
-
- :param: f A transformation function from type T to type Result<U, E>
- :param: a A value of type Result<T, E>
-
- :returns: A value of type Result<U, E>
-*/
-public func >>-<T, U, E>(a: Result<T, E>, f: T -> Result<U, E>) -> Result<U, E> {
- return a.flatMap(f)
-}
-
-@availability(*, unavailable, message="function (T -> U) does not return Result<U, E>, perhaps you meant f <^> val")
-public func >>-<T, U, E>(a: Result<T, E>, f: T -> U) -> Result<U, E> {
- return a.map(f)
-}
-
/**
Wrap a value in a minimal context of .Success
@@ -65,7 +45,7 @@ public func >>-<T, U, E>(a: Result<T, E>, f: T -> U) -> Result<U, E> {
:returns: The provided value wrapped in .Success
*/
public func pure<T, E>(a: T) -> Result<T, E> {
- return success(a)
+ return .success(a)
}
extension Result {
@@ -80,10 +60,7 @@ extension Result {
:returns: A value of type Result<U, E>
*/
- func apply<U>(f: Result<(T -> U), E>) -> Result<U, E> {
- switch f {
- case let .Success(fx): return map(fx.unbox)
- case let .Failure(e): return failure(e.unbox)
- }
+ func apply<U>(f: Result<(T -> U), Error>) -> Result<U, Error> {
+ return f >>- { $0 <^> self }
}
}
View
@@ -7,7 +7,7 @@
// Copyright (c) 2015 NotTooBad Software. All rights reserved.
//
-import LlamaKit
+import Result
import Runes
// TODO: Implement ParserError
@@ -22,9 +22,9 @@ public func token <T: Equatable> (token: T) -> Parser<T, T> {
return Parser { input in
return input.read(expect: toString(token)) >>- { next in
if next.head == token {
- return success(output:token, nextinput:next.tail)
+ return .success(output:token, nextinput:next.tail)
} else {
- return failure("expected '\(token)', got '\(next.head)'.")
+ return .failure("expected '\(token)', got '\(next.head)'.")
}
}
}
View
@@ -7,7 +7,7 @@
// Copyright (c) 2015 NotTooBad Software. All rights reserved.
//
-import LlamaKit
+import Result
import Foundation
/** Provide parser with tokens from the input. */
@@ -43,9 +43,9 @@ extension ParserInput {
/** Return the next token and the rest of the input, or an error message if the end has been reached. */
public func read (# expect: String) -> Result<(head: Token, tail: ParserInput<Token>), ParserError> {
if let next = self.next() {
- return success(next)
+ return .success(next)
} else {
- return failure("expected '\(expect)', got EOF.")
+ return .failure("expected '\(expect)', got EOF.")
}
}
}
@@ -46,7 +46,7 @@ class Parser_Tests: XCTestCase {
let result = parser.parse(input)
- XCTAssertFalse(result.isSuccess)
+ XCTAssertNotNil(result.error)
XCTAssertFalse(result.error!.isEmpty, "Should have an error message")
}
}

1 comment on commit f527d9e

@kareman

This comment has been minimized.

Show comment
Hide comment
@kareman

kareman May 10, 2015

Owner

Discussed briefly here.

Owner

kareman commented on f527d9e May 10, 2015

Discussed briefly here.

Please sign in to comment.