示例#1
0
 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);
示例#2
0
 // 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);