swlaschin / Railway-Oriented-Programming-Example

This repository contains code that demonstrates the "Railway Oriented Programming" concept for error handling in functional programming languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: ROP in C#

Sinewyk opened this issue · comments

Did you implement a classic imperative architecture in the C# example to highlight the differences, or is it simply hard (impossible) to do ROP in C# ?

For example, I'm comparing the database access layer in C# and in F#.

I see nothing stopping me from creating a Result class (which would be a Either monad ?) and try/catching the getById to actually return a Failure no ?

And then pipe it into those functions that can handle the Result type. Sure it wouldn't be as clean as in F# but it would be doable right ?

edit: fixed F# instead of C# last line

Yes, it's totally doable in C#! I have written some C# code that does demonstrate that -- I'll try to update this repo with it.

Thanks =).