Skip to content

Instantly share code, notes, and snippets.

View MattJOlson's full-sized avatar

Matt Olson MattJOlson

View GitHub Profile
@mrange
mrange / RResult.md
Created March 18, 2017 12:32
Railway Oriented Programming and F# Result

Railway Oriented Programming and F# Result

Full source: https://gist.github.com/mrange/aa9e0898492b6d384dd839bc4a2f96a1

Option<_> is great for ROP (Railway Oriented Programming) but we get no info on what went wrong (the failure value is None which carries no info).

With the introduction F# 4.1 we got Result<_, _> a "smarter" Option<_> as it allows us to pass a failure value.

However, when one inspects the signature of Result.bind one sees a potential issue for ROP: