option types with None?
Is there a "maybe None" type in reticulated that would let me type the following (without Dyn)?
def div(n1:int, n2:int)->int:
if n2 == 0:
return None
else:
return n1 / n2
If not, can we add this?
(The other option I see is making a Option class with Some val and None subtypes, but I don't want to refactor functions like div.)
I also don't want to raise an exception
There is not such a type (yet!).
On Wed, Jun 8, 2016 at 1:40 PM, Benjamin Greenman [email protected] wrote:
Is there a "maybe None" type in reticulated that would let me type the following (without Dyn)?
def div(n1:int, n2:int)->int: if n2 == 0: return None else: return n1 / n2
If not, can we add this? (The other option I see is making a Option class with Some val and None subtypes, but I don't want to refactor functions like div.)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mvitousek/reticulated/issues/28, or mute the thread https://github.com/notifications/unsubscribe/ABjedZf51nDpA0W6NAdk3Z1TawZdzDapks5qJv52gaJpZM4IxNzg .