jtmueller/RustyOptions

Needs a Unit type

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.
It's not currently possible to represent a Result that returns no value. For methods that might fail, but return no value if they succeed, we need Result<Unit, TErr> because Result<void, TErr> is impossible in C#.

Describe the solution you'd like
Because there's no global definition of a Unit type outside of FSharp.Core, RustyOptions should provide one.

Describe alternatives you've considered
We could create a new Result<TErr> type for results that have no value on success, but that's a lot of duplicated code for not a lot of value, and does not match other functional systems people might be familiar with.

The Unit type should support JSON Serialization and conversion to the F# unit.