Skip to content

sherry-ummen/rop

Repository files navigation

rop

Railway Oriented Programming

Description

Inspired by F# Railway Oriented Programming article https://fsharpforfunandprofit.com/rop/

Usage

from rop.result import Result

def func_example():
    result = does_file_exist() \
    .on_success(parse_log()) \
    .on_success(store_to_database()) \
    .on_success(finalize_report())

    if result.is_success:
        print('Successfull!')
    else:
        print(result.error_text)


def does_file_exist() -> Result:
    return Result.ok()

def parse_log() -> Result:
    return Result.ok()

def store_to_database() -> Result:
    return Result.fail('Database error!')

def finalize_report() -> Result:
    return Result.ok()

About

Python Railway Oriented Programming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages