This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Distributed | |
import DistributedCluster | |
typealias DefaultDistributedActorSystem = ClusterSystem | |
/// Naive implementation of Virtual Actors | |
/// | |
/// **Don't overuse it**: this pattern should be used on purpose, e.g. when you have number of dynamic *transparent* actors with some id. | |
/// If you have limited, already defined set of actors—just create and reference them in a seperate node. | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
combine :: Int -> Int -> Int | |
combine a b = a + b | |
increase = combine 1 | |
decrease = combine (-1) | |
data Optional a = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Wrapper around a lazily resolved using checked continuation. | |
/// | |
/// Usage: | |
/// | |
/// ``` | |
/// let promiseA = Promised<String>() | |
/// async let a1 = promiseA.value | |
/// promiseA.resolve(with: "AAA") | |
/// let a2 = try await promiseA.value | |
/// print(try await a1, a2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Tree<A> { | |
indirect case node(A, left: Tree<A>, right: Tree<A>) | |
case empty | |
} | |
extension Tree { | |
static func singleton(_ a: A) -> Tree { | |
return .node(a, left: .empty, right: .empty) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit // needed for Task in Playgrounds 🤷♂️🤔 | |
public protocol Functor { | |
associatedtype A | |
associatedtype B: Functor = Self | |
func map<C>(_ f: @escaping (A) -> C) -> B where B.A == C | |
} | |
protocol Monad: Functor { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Points and display type | |
PPI is points per inch below, not pixels per inch. Not all models are listed, just the first model with a new display size. Diamond, RGB Stripe and Pentile RGB refer to the subpixel patterns. | |
iPhone 1 = 320×480 at 163ppi sRGB IPS LCD RGB Stripe | |
iPhone 4 = 320×480 at 163ppi sRGB IPS LCD RGB Stripe | |
iPhone 5 = 320×568 at 163ppi sRGB IPS LCD RGB Stripe | |
iPhone 6 = 375×667 at 163ppi sRGB IPS LCD RGB Stripe | |
iPhone 6 Plus = 414×736 at 153.5ppi sRGB IPS LCD RGB Stripe | |
iPhone 7 = 375×667 at 163ppi P3 IPS LCD RGB Stripe |