Skip to content

courajs/Runes

 
 

Repository files navigation

Indecipherable symbols that some people claim have actual meaning.

Carthage compatible

Installation

Note that as of Runes 1.2, master will assume Swift 1.2. The Runes 1.1.x series of releases are considered stable for long-term use.

github "thoughtbot/runes"

Then run carthage update.

Follow the current instructions in Carthage's README for up to date installation instructions.

Add the following to your Podfile:

pod 'Runes'

You will also need to make sure you're opting into using frameworks:

use_frameworks!

Then run pod install with CocoaPods 0.36 or newer.

What's included?

Importing Runes introduces 3 new operators and one global function:

  • <^> (pronounced "map")
  • <*> (pronounced "apply")
  • >>- (pronounced "flatMap") (left associative)
  • -<< (pronounced "flatMap") (right associative)
  • pure (pronounced "pure")

We also include default implementations for Optional and Array with the following type signatures:

// Optional:
public func <^><T, U>(f: T -> U, a: T?) -> U?
public func <*><T, U>(f: (T -> U)?, a: T?) -> U?
public func >>-<T, U>(a: T?, f: T -> U?) -> U?
public func -<<<T, U>(f: T -> U?, a: T?) -> U?
public func pure<T>(a: T) -> T?

// Array:
public func <^><T, U>(f: T -> U, a: [T]) -> [U]
public func <*><T, U>(fs: [T -> U], a: [T]) -> [U]
public func >>-<T, U>(a: [T], f: T -> [U]) -> [U]
public func -<<<T, U>(f: T -> [U], a: [T]) -> [U]
public func pure<T>(a: T) -> [T]

About

Functional operators for Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 92.7%
  • Ruby 4.2%
  • C++ 3.1%