Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

32 lines
444 B
C#

using System;
static class Maybe
{
public static Maybe<T> C<T> (T value)
{
return null;
}
}
sealed class Maybe<T>
{
public Maybe (T value)
{
}
}
static class Extensions {
public static R Match<T,R>(this T self, params Func<T,Maybe<R>>[] matchers)
{
return default (R);
}
}
class Test {
public static void Main ()
{
Extensions.Match ("a", s => Maybe.C(s));
Extensions.Match ("a", s => Maybe.C(s), s => Maybe.C("a"));
}
}