Skip to content

Commit

Permalink
Updated README (#15)
Browse files Browse the repository at this point in the history
* added install guide
* fixed typos
  • Loading branch information
skrasekmichael committed Mar 22, 2024
1 parent 036ad09 commit 5554b2e
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# Railway Result

Implementation of a **Result Pattern** for C# with functional extension methods leveraging **Railway Oriented Programming**. Learn more about [Railway Oriented Programming](https://fsharpforfunandprofit.com/rop/).
Implementation of a **Result Pattern** for C# with functional extension methods leveraging **Railway Oriented Programming** (ROP). Learn more about [Railway Oriented Programming](https://fsharpforfunandprofit.com/rop/).

Extension Methods:
### Install

- `Ensure` and `EnsureNotNull` - tests for condition resulting in succedded/failed result object (railway).
- `Then` - maps current value of result object to a new value (on succeeded railway).
- `Tap` - invokes funcion on value of result object (on succeeded railway).
- `And` - encapsulates additional value into result object (on succeeded railway).
Install RailwayResult with NuGet:
```powershell
Install-Package Skrasek.RailwayResult # result object
Install-Package Skrasek.RailwayResult.Errors # predefined error types
Install-Package Skrasek.RailwayResult.FunctionalExtensions # extension methods for ROP
```

or via the .NET CLI:
```powershell
dotnet add package Skrasek.RailwayResult
dotnet add package Skrasek.RailwayResult.Errors
dotnet add package Skrasek.RailwayResult.FunctionalExtensions
```

#### Extension Methods:

- `Ensure` and `EnsureNotNull` - tests for condition resulting in successful/failed result object (railway).
- `Then` - maps current value of result object to a new value (on successful railway).
- `Tap` - invokes function on value of result object (on successful railway).
- `And` - encapsulates additional value into result object (on successful railway).

### Example:
```csharp
Expand Down Expand Up @@ -36,7 +52,7 @@ public Result<TeamMember> GetTeamMember(Guid memberId)
}
```

### Result Pattern without using railway-oriented programing:
### Result Pattern without using railway-oriented programming:
```csharp
public Result SetMemberRole(Guid initiatorId, Guid memberId, TeamRole newRole)
{
Expand Down

0 comments on commit 5554b2e

Please sign in to comment.