This file contains hidden or 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 | |
// --------------------- | |
// Actions | |
// --------------------- | |
typealias Closure<S> = (inout S) -> Void | |
/// Our Actions are basically a Tree of Nodes | |
/// Data for multiple args |
This file contains hidden or 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 | |
// contramap | |
precedencegroup I3 { associativity: left higherThan: LogicalConjunctionPrecedence } | |
precedencegroup I4 { associativity: left higherThan: LogicalConjunctionPrecedence, I3 } | |
infix operator <!> : I4 | |
let flag: (Bool) -> String = { $0 ? "✅" : "❌" } |
This file contains hidden or 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
let flag: (Bool) -> String = { $0 ? "✅" : "❌" } | |
// ------------------------ | |
// Predicative | |
// ------------------------ | |
protocol Predicative { | |
static func + (lhs: Self, rhs: Self) -> Self | |
static func * (lhs: Self, rhs: Self) -> Self | |
static func gt<P: PredicateLike>(_: P.Input) -> P where P.Input: Comparable, P.Output == Self |
This file contains hidden or 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 | |
import PlaygroundSupport | |
// -------------------------------------------------------------------------------- | |
// MARK: - operators | |
// -------------------------------------------------------------------------------- | |
precedencegroup MonoidComposePrecedence { | |
associativity: left higherThan: AssignmentPrecedence lowerThan: AdditionPrecedence |
This file contains hidden or 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
// -------------------------------------------------------------------------------- | |
// MARK: - Operators | |
// -------------------------------------------------------------------------------- | |
precedencegroup Cobind { associativity: left } | |
precedencegroup Cokleisli { | |
associativity: left | |
higherThan: Cobind |
This file contains hidden or 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
// -------------------------------------------------------------------------------- | |
// MARK: - Prerequsites | |
// -------------------------------------------------------------------------------- | |
/// Compose Operator | |
precedencegroup BijectionGroup { associativity: left } | |
infix operator <> : BijectionGroup | |
/// Typealias for a binary function | |
typealias Bin<T> = (T) -> (T) -> T |
This file contains hidden or 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
// ------------------------------------ | |
// Network | |
// ------------------------------------ | |
struct MeetupResponse { | |
var groupName: String = "" | |
var groupOrganizers: [String] = [] | |
var meetupTitle: String = "" | |
var meetupAttendes: Int = 0 |
This file contains hidden or 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
precedencegroup Apply { | |
higherThan: ComparisonPrecedence | |
associativity: right | |
} | |
precedencegroup Compose { | |
higherThan: Apply | |
} |
This file contains hidden or 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 UIKit | |
import PlaygroundSupport | |
extension UIFont { | |
static func font(for style: UIFontTextStyle, | |
atScale scale: CGFloat = 1, | |
usingFont fontInSize: ((CGFloat) -> UIFont)? = nil) -> UIFont { | |
switch (fontInSize, scale) { |
This file contains hidden or 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 UIKit | |
enum GraphicsCommand { | |
case setColour(colour: UInt32) | |
case moveTo(x: Float, y: Float) | |
case lineTo(x: Float, y: Float) | |
} |
NewerOlder