Great read!
I'm going to steal that use of 'typealias' when defining a closure that uses @escaping. Those method definitions are always so messy looking, this really cleans it up.
I'm going to steal that use of 'typealias' when defining a closure that uses @escaping. Those method definitions are always so messy looking, this really cleans it up.
primitive Dollar: Decimal // no mixing with euros
primitive Meter: Double // no confusion with miles
You can do the same in Swift with typealias _but_ it will happily accept you passing in Euro where Dollar is declared because they’re both Decimals. This doesn’t happen in languages like F#.Also in F# you get the type Meter/Hour if you divide Meters by Hours. Which multiplied by an Hour value gives you the distance traveled at that speed in that time.