// monadic Option <PhoneNumber> CreatePhoneNumberM (string typeStr, string countryStr, string numberStr) => optCountryCode(countryStr) .Bind(country => optNumberType(typeStr) .Bind(type => PhoneNumber.Number.Create(numberStr) .Bind <PhoneNumber.Number, PhoneNumber>(number => PhoneNumber.Create(type, country, number))));
Validation <PhoneNumber> CreateValidPhoneNumberM (string typeStr, string countryStr, string numberStr) => from type in validNumberType(typeStr) from country in validCountryCode(countryStr) from number in validNumber(numberStr) select PhoneNumber.Create(type, country, number);
// monadic with LINQ Option <PhoneNumber> CreatePhoneNumber_LINQ (string typeStr, string countryStr, string numberStr) => from country in optCountryCode(countryStr) from type in optNumberType(typeStr) from number in PhoneNumber.Number.Create(numberStr) select PhoneNumber.Create(type, country, number);