#NEWLINE# def in_maybe( fn ) : #NEWLINE# #INDENT# '\n    Decorator for monadic error handling.\n\n    If the decorated function raises an exception, return Nothing. Otherwise,\n    take the result and wrap it in a Just.\n    ' #NEWLINE# def closure_in_maybe( * args , **kwargs ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return Just ( fn ( * args , ** kwargs ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return Nothing #NEWLINE# #UNINDENT# #UNINDENT# return typify ( fn , hkt = ( lambda x : t ( Maybe , x ) ) ) ( closure_in_maybe )