Skip to content

Instantly share code, notes, and snippets.

RheeseyB Rheeseyb

Block or report user

Report or block Rheeseyb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Rheeseyb / Playground.swift
Created Oct 2, 2016
In Swift, repeatedly attempt a series of failable functions, failing if any of them fail
View Playground.swift
import Cocoa
enum Failable<T> {
case fail
case success(T)
func map<U>(fn: (T) -> U) -> Failable<U> {
switch self {
case .fail: return .fail
case let .success(t): return .success(fn(t))
You can’t perform that action at this time.