Latest4.1.0
Homepagehttps://github.com/thoughtbot/runes
LicenseMIT
Platformsios 8.0, osx 10.9, watchos 2.0, tvos 9.0, requires ARC
Authors,

Runes

Indecipherable symbols that some people claim have actual meaning.

pod
Carthage compatible
Swift Package Manager compatible

Please see the documentation for version compatibility and installation
information.

What’s included?

Importing Runes introduces several new operators and one global function that
correspond to common Haskell typeclasses:

Functor

  • <^> (pronounced "map")

Applicative Functor

  • <*> (pronounced "apply")
  • <* (pronounced "left sequence")
  • *> (pronounced "right sequence")
  • pure (pronounced "pure")

Alternative

  • <|> (pronounced "alternate")
  • empty (pronounced "empty")

Monad

  • >>- (pronounced "flatMap") (left associative)
  • -<< (pronounced "flatMap") (right associative)
  • >-> (pronounced "Monadic compose") (left associative)
  • <-< (pronounced "Monadic compose") (right associative)

Implementations

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

// Optional+Functor:
public func <^> <T, U>(f: T -> U, x: T?) -> U?

// Optional+Applicative:
public func <*> <T, U>(f: (T -> U)?, x: T?) -> U?
public func <* <T, U>(lhs: T?, rhs: U?) -> T?
public func *> <T, U>(lhs: T?, rhs: U?) -> U?
public func pure<T>(x: T) -> T?

// Optional+Alternative:
public func <|> <T>(lhs: T?, rhs: T?) -> T?
public func empty<T>() -> T?

// Optional+Monad:
public func >>- <T, U>(x: T?, f: T -> U?) -> U?
public func -<< <T, U>(f: T -> U?, x: T?) -> U?
public func >-> <T, U, V>(f: T -> U?, g: U -> V?) -> T -> V?
public func <-< <T, U, V>(f: U -> V?, g: T -> U?) -> T -> V?

// Array+Functor:
public func <^> <T, U>(f: T -> U, x: [T]) -> [U]

// Array+Applicative:
public func <*> <T, U>(fs: [T -> U], x: [T]) -> [U]
public func <* <T, U>(lhs: [T], rhs: [U]) -> [T]
public func *> <T, U>(lhs: [T], rhs: [U]) -> [U]
public func pure<T>(x: T) -> [T]

// Array+Alternative:
public func <|> <T>(lhs: [T], rhs: [T]) -> [T]
public func empty<T>() -> [T]

// Array+Monad:
public func >>- <T, U>(x: [T], f: T -> [U]) -> [U]
public func -<< <T, U>(f: T -> [U], x: [T]) -> [U]
public func >-> <T, U, V>(f: T -> [U], g: U -> [V]) -> T -> [V]
public func <-< <T, U, V>(f: U -> [V], g: T -> [U]) -> T -> [V]

Contributing

See the CONTRIBUTING document. Thank you, contributors!

License

Runes is Copyright (c) 2015 thoughtbot, inc. It is free software, and may be
redistributed under the terms specified in the LICENSE file.

About

thoughtbot

Runes is maintained and funded by thoughtbot, inc. The names and logos for
thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or look at
our product case studies and hire us to help build your iOS app.

Latest podspec

{
    "name": "Runes",
    "version": "4.1.0",
    "summary": "Functional operators for Swift",
    "homepage": "https://github.com/thoughtbot/runes",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Gordon Fontenot": "[email protected]",
        "thoughtbot": null
    },
    "social_media_url": "http://twitter.com/thoughtbot",
    "source": {
        "git": "https://github.com/thoughtbot/runes.git",
        "tag": "v4.1.0"
    },
    "source_files": "Sources/**/*.{h,swift}",
    "requires_arc": true,
    "compiler_flags": "-whole-module-optimization",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This