Regarding default arguments: maybe they should only be accepted for types with a distinguished default value, e.g. the identity of a monoid, None for Option. Then, the type signature would make the behavior clear. Type aliases could explicitly provide alternate default values.
-
Show this thread
If you want an Integer with a default of 10, you should instead require an Integer Option then explicitly map None to 10. Then, whoever wraps around your function can keep the Integer Option protocol and not have to propagate the magic value 10 all along the call hierarchy.
4:56 PM - 13 Feb 2019
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!