Skip to content

Instantly share code, notes, and snippets.

@banbh
Created May 9, 2012 21:27
Show Gist options
  • Select an option

  • Save banbh/2649032 to your computer and use it in GitHub Desktop.

Select an option

Save banbh/2649032 to your computer and use it in GitHub Desktop.
static void Foo()
{
//Action<Action<int>, Action<string>> a = (a1, a2) => Example(3, a1, a2);
//var aa = a.MergeYields().AsEnumerable();
var x = MergeYields<int, string>((a1, a2) => Example(3, a1, a2));
Func<int, IEnumerable<Either<int, string>>> f = n =>
MergeYields<int, string>((a1, a2) => Example(n, a1, a2))
.AsEnumerable();
var tb = new TransformManyBlock<int, Either<int, string>>(f);
ITargetBlock<int> intSink = null;
//IPropagatorBlock<Either<int,string>, int>
var left = new TransformBlock<Either<int, string>, int>(either => either.Left1);
left.LinkTo(intSink);
var right = new TransformBlock<Either<int, string>, string>(either => either.Right1);
ITargetBlock<string> stringSink = null;
right.LinkTo(stringSink);
tb.LinkTo(left, either => either.IsLeft);
tb.LinkTo(right, either => either.IsRight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment