-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplified either instantiation (#12)
- Loading branch information
1 parent
3e5c4f4
commit 9143943
Showing
12 changed files
with
199 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
namespace MonadicBits | ||
namespace MonadicBits | ||
{ | ||
public static class EitherExtensions | ||
{ | ||
public static Either<TLeft, TRight> Left<TLeft, TRight>(this TLeft left) => | ||
Either<TLeft, TRight>.Left(left); | ||
public static Either<TLeft, TRight> Left<TLeft, TRight>(this TLeft value) => | ||
value.Left(); | ||
|
||
public static Either<TLeft, TRight> Right<TLeft, TRight>(this TRight right) => | ||
Either<TLeft, TRight>.Right(right); | ||
public static Either<TLeft, TRight> Right<TLeft, TRight>(this TRight value) => | ||
value.Right(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace MonadicBits | ||
{ | ||
public static class Enumerable | ||
{ | ||
public static IEnumerable<T> Return<T>(T value) | ||
{ | ||
yield return value; | ||
} | ||
|
||
public static IEnumerable<T> ToEnumerable<T>(this T @this) => | ||
Return(@this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
|
||
namespace MonadicBitsTests | ||
{ | ||
public static class EnumerableTests | ||
{ | ||
[Test] | ||
public static void Elevation_creates_single_item_enumeration() => | ||
MonadicBits.Enumerable.Return(42).Should().BeEquivalentTo(new[] { 42 }); | ||
} | ||
} |
Oops, something went wrong.