Example #1
0
def fromJust(val):
    return match(val, ('Just(j)', lambda j: j))
Example #2
0
def maybe_(no, val):
    return match(val, ('Just(j)', lambda j: j), ('Nothing()', lambda: no))
Example #3
0
def isNothing(m):
    return match(m, ('Nothing()', lambda: True), ('_', lambda: False))
Example #4
0
def isJust(m):
    return match(m, ('Just(_)', lambda: True), ('_', lambda: False))
Example #5
0
def snd(t):
    return match(t, ('(_, s)', identity))
Example #6
0
def fst(t):
    return match(t, ('(f, _)', identity))