Skip to content

Commit

Permalink
Fix for explicitly implemented operators in IO
Browse files Browse the repository at this point in the history
  • Loading branch information
louthy committed Aug 18, 2024
1 parent d02cfee commit d4814c7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions LanguageExt.Core/Effects/IO/IO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ public IO<C> SelectMany<C>(Func<A, Guard<Error, Unit>> bind, Func<A, Unit, C> pr
public static IO<A> operator |(IO<A> lhs, IO<A> rhs) =>
lhs.Catch(rhs).As();

static IO<A> Fallible<IO<A>, IO, Error, A>.operator |(K<IO, A> lhs, IO<A> rhs) =>
public static IO<A> operator |(IO<A> lhs, K<IO, A> rhs) =>
lhs.Catch(rhs).As();

static IO<A> Fallible<IO<A>, IO, Error, A>.operator |(IO<A> lhs, K<IO, A> rhs) =>
public static IO<A> operator |(K<IO, A> lhs, IO<A> rhs) =>
lhs.Catch(rhs).As();

public static IO<A> operator |(IO<A> lhs, Pure<A> rhs) =>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Streams/RecursionIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class RecursionIO
public static IO<Unit> run =>
from _ in writeLine("Enter a number to count from")
from s in readLine
from n in parseInt<IO>(s) | @catch(IO.fail<int>("expected a number!"))
from n in parseInt<IO>(s) | IO.fail<int>("expected a number!")
from r in recurse(n) >>
emptyLine
select r;
Expand Down
2 changes: 1 addition & 1 deletion Samples/Streams/SumOfSquares.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class SumOfSquares
public static IO<Unit> run =>
from _ in writeLine("Enter a number to find the sum of squares")
from s in readLine
from n in parseInt<IO>(s) | @catch(IO.fail<int>("expected a number!"))
from n in parseInt<IO>(s) | IO.fail<int>("expected a number!")
from x in example(n).Iter().As()
select unit;

Expand Down
12 changes: 6 additions & 6 deletions Samples/Streams/Zipping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ from v in evens(n).Zip(odds(n))
from _ in writeLine(v)
where false
select unit;

static bool isOdd(int n) =>
(n & 1) == 1;

static bool isEven(int n) =>
!isOdd(n);

static StreamT<IO, int> evens(int n) =>
from x in Range(0, n).AsStream<IO>()
Expand All @@ -31,4 +25,10 @@ static StreamT<IO, int> odds(int n) =>
from x in Range(0, n).AsStream<IO>()
where isOdd(x)
select x;

static bool isOdd(int n) =>
(n & 1) == 1;

static bool isEven(int n) =>
!isOdd(n);
}

0 comments on commit d4814c7

Please sign in to comment.