Worth a read for some more context.
Create the file in the root of the project (where your Package.swift
file lives as well), and use the following contents:
/// Package.xcconfig
Worth a read for some more context.
Create the file in the root of the project (where your Package.swift
file lives as well), and use the following contents:
/// Package.xcconfig
func apply<A, B>(fn: (A) -> B, a: A) -> B { | |
fn(a) | |
} | |
func bluebird<A, B, C>(fn1: (A) -> B, fn2: (C) -> A, c: C) -> B { | |
fn1(fn2(c)) | |
} | |
func blackbird<A, B, C, D>(fn1: (C) -> D, fn2: (A, B) -> C, a: A, b: B) -> D { |
public func equals(_ lhs: Any, _ rhs: Any) -> Bool { | |
func open<A: Equatable>(_ lhs: A, _ rhs: Any) -> Bool { | |
type(of: rhs) == A.self && lhs == (rhs as? A) | |
} | |
guard let lhs = lhs as? any Equatable else { return false } | |
return open(lhs, rhs) | |
} |
@dynamicMemberLookup | |
struct CoW<T> { | |
init(_ value: T) { | |
_storage = Storage(value) | |
} | |
public subscript<V>(dynamicMember keyPath: WritableKeyPath<T, V>) -> V { | |
get { value[keyPath: keyPath] } | |
set { value[keyPath: keyPath] = newValue } | |
} | |
var value: T { |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE TupleSections #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE RankNTypes #-} | |
import Control.Applicative | |
import Control.Comonad | |
import Data.Bifunctor |
#Every Single Option Under The Sun
// Playground - noun: a place where people can play | |
public func id<A>(x : A) -> A { | |
return x | |
} | |
public func error<A>(x : String) -> A { | |
assert(false, x) | |
} |
public func unsafeCoerce<A, B>(_ x : A) -> B { | |
return unsafeBitCast(x, to: B.self) | |
} | |
func Y<A>(_ f : @escaping (A) -> A) -> A { | |
return { (x : @escaping (A) -> A) in | |
return f((x(unsafeCoerce(x)))) | |
}({ (x : A) -> A in | |
let fn : (A) -> A = unsafeCoerce(x) | |
return f(fn(x)) |