Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
Merge pull request #15 from mpurland/master
Browse files Browse the repository at this point in the history
Updated Either to use latest from Swiftz
  • Loading branch information
mpurland committed Jan 4, 2016
2 parents 778e088 + 3a143b7 commit e1c8fc5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 49 deletions.
47 changes: 0 additions & 47 deletions Tyro/EitherExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@ public protocol EitherType {
}

extension Either : EitherType {
public var right : R? {
switch self {
case .Right(let r): return r
default: return nil
}
}

public var left : L? {
switch self {
case .Left(let l): return l
default: return nil
}
}

func fmap<L, RA, RB>(f : RA -> RB, e : Either<L, RA>) -> Either<L, RB> {
return f <^> e
}
}

extension Array where Element : EitherType {
Expand Down Expand Up @@ -90,33 +73,3 @@ extension Dictionary where Value : EitherType {
}
}
}

//struct EitherBuilder<L, R> {
// let value : R?
//
// init(value v : R?) {
// value = v
// }
//
// static func either(r : R?) -> EitherBuilder<L, R> {
// return EitherBuilder(value : r)
// }
//
// func orThat(l : L) -> Either<L, R> {
// return value.maybe(Either.Left(l), onSome : { (r) -> Either<L, R> in
// return .Right(r)
// })
// }
//}
//
//func eitherThis<L, R>(_ r : R?) -> EitherBuilder<L, R> {
// return EitherBuilder<L, R>.either(r)
//}

//func left<L, R>(_ left : L) -> Either<L, R> {
// return .Left(left)
//}
//
//func right<L, R>(_ right : R) -> Either<L, R> {
// return .Right(right)
//}

0 comments on commit e1c8fc5

Please sign in to comment.