Exemple #1
0
        public Susp <Y> FlatMap <Y>(Func <T, Susp <Y> > f)
        {
            if (Try(out var value))
            {
                return(f(value));
            }

            var localLazy = Lazy;

            return(Susp.Lazy(() => f(localLazy.Value).Value));
        }
Exemple #2
0
        public Susp <Y> Map <Y>(Func <T, Y> f)
        {
            if (Try(out var value))
            {
                return(Susp.Eager(f(value)));
            }

            var localLazy = Lazy;

            return(Susp.Lazy(() => f(localLazy.Value)));
        }