Пример #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))