workshop-depot / rop

Licence: MIT license
Minimal Railway Oriented Programming for Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to rop

ex operation
A library for making domain operations in Elixir
Stars: ✭ 33 (+26.92%)
Mutual labels:  railway-oriented-programming
ember-pipeline
Railway oriented programming in Ember
Stars: ✭ 17 (-34.62%)
Mutual labels:  railway-oriented-programming
Returns
Make your functions return something meaningful, typed, and safe!
Stars: ✭ 2,015 (+7650%)
Mutual labels:  railway-oriented-programming

rop

Railway Oriented Programming for Go

For reading more about Railway Oriented Programming, look here.

It's easy to construct reusable chains, with stateless functions and even (to some extent) graphs of functionalities.

It's nontheorical essence is:

                ________    ________    ________
happy path  --->|      |--->|      |--->|      |---> result
                | func |    | func |    | func |
failure     --->|      |--->|      |--->|      |---> error
                --------    --------    --------

As you see it looks like the idiomatic Go pattern of writing functions as func(TIn) (TOut, error), except for the input error from previous step.

A sequential chain of functions can be made like:

c := Chain(nil, step1, step2, step3)

res := c(Result{...})

Status: WIP; there are v1 and v2 branches, but it's being redesigned to more closely resembles Go's middleware pattern. For example now we can handle panics as we do in web apps.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].