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