/// <inheritdoc /> public IImmutableList <PumpkinMuffin> CookPumpkinMuffins() { var oven = new Oven(); oven.Heat(166); return(MakeFlourMixture() .Select(flourMixture => MakeEggsMixture().Select(eggsMixture => PrepareBackingDish(flourMixture, eggsMixture))) .Select(backingDish => oven.Bake <PumpkinBatterCup, PumpkinMuffin>(backingDish, TimeSpan.FromMinutes(30)).ToMaybe()) .SelectOrElse(pumpkinMuffin => pumpkinMuffin.Cups, () => null)); }
/// <inheritdoc /> public IImmutableList <PumpkinMuffin> CookPumpkinMuffins() { var oven = new Oven(); oven.Heat(166); var result = from flourMixture in MakeFlourMixture() from eggsMixture in MakeEggsMixture() from backingDish in PrepareBackingDish(flourMixture, eggsMixture) from pumpkinMuffins in oven.Bake <PumpkinBatterCup, PumpkinMuffin>(backingDish, TimeSpan.FromMinutes(30)).ToMaybe() select pumpkinMuffins.Cups; return(result.GetValueOrDefault()); }
/// <inheritdoc /> public IImmutableList <PumpkinMuffin> CookPumpkinMuffins() { var oven = new Oven(); oven.Heat(166); var result = from flourMixture in MakeFlourMixture() from eggsMixture in MakeEggsMixture() from backingDish in PrepareBackingDish(flourMixture, eggsMixture) from pumpkinMuffins in oven.Bake <PumpkinBatterCup, PumpkinMuffin>(backingDish, TimeSpan.FromMinutes(30)).ToMaybe() select pumpkinMuffins.Cups; // !!!: result имеет тип IEnumerable<IImmutableList<PumpkinMuffin>> // нужно явно вернуться из IEnumerable в Maybe - для этого и нужен соответствующий экстеншн. return(result.ToMaybe().GetValueOrDefault()); }