Skip to content

Commit

Permalink
Added exist to Option
Browse files Browse the repository at this point in the history
  • Loading branch information
Donatas-L committed Jul 16, 2017
1 parent 866218a commit c14e84f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Option.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

Expand Down Expand Up @@ -89,6 +90,15 @@ public static Option<R> map<A, R>(this Option<A> @this, Func<A, R> func) {
() => Option.None, value => Option.Some(func(value)));
}

public static bool exist<A>(this Option<A> @this, Option<A> other) =>
@this.fold(
() => false,
left => other.fold(
() => false,
right => left.Equals(right)
)
);

public static Option<R> flatMap<A, R>(this Option<A> @this, Func<A, Option<R>> func) {
return @this.fold(
() => Option.None, func);
Expand Down
Binary file modified bin/Release/funkylib.dll
Binary file not shown.
Binary file modified bin/Release/funkylib.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion obj/Release/CoreCompileInputs.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b41efbdb0739bc08d73825ff2d48a3bfc7c45341
c304f7f8ade77d758475770f8271d01f624fe97c
Binary file modified obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
4 changes: 4 additions & 0 deletions obj/Release/funkylib.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ D:\Learning\code-retreat\lib\funkylib\bin\Release\funkylib.dll
D:\Learning\code-retreat\lib\funkylib\bin\Release\funkylib.pdb
D:\Learning\code-retreat\lib\funkylib\obj\Release\funkylib.dll
D:\Learning\code-retreat\lib\funkylib\obj\Release\funkylib.pdb
F:\Code\Stupid\funkylib\bin\Release\funkylib.dll
F:\Code\Stupid\funkylib\bin\Release\funkylib.pdb
F:\Code\Stupid\funkylib\obj\Release\funkylib.dll
F:\Code\Stupid\funkylib\obj\Release\funkylib.pdb
Binary file modified obj/Release/funkylib.dll
Binary file not shown.
Binary file modified obj/Release/funkylib.pdb
Binary file not shown.

0 comments on commit c14e84f

Please sign in to comment.