|
|
|
|
|
by lkitching
1676 days ago
|
|
For division you really should put the requirement for the non-zero check in the type of the divisor instead of propagating failure to the caller e.g. div(x: Int, y: NonZero[Int]) -> Int
Exceptions at least have the benefit of retaining the location the context for the error occurred which gets lost without extra bookeeping when using optionals. |
|