open System.ServiceModel open System.Runtime.Serialization /// Record for LoanInformation [] type LoanInformation = { [] mutable Amount : double [] mutable InterestRateInPercent : double [] mutable TermInMonth : int } /// Record for PaymentInformation [] type PaymentInformation = { [] mutable MonthlyPayment : double [] mutable TotalPayment : double } //[] --> Never add this attribute on Discriminated Union, it won't work /// Discriminated Union type Suit = | Heart | Diamond | Spade | Club /// For F#, all the interface method must be given a parameter name: eg. a:LoanInformation /// otherwise, you will fail to start the service host [] type public ILoanCadulator = /// Use Record to send and recieve data [] abstract Calculate : a:LoanInformation -> PaymentInformation /// Use Tuple to send and recieve data [] abstract Calculate2 : b:(int * string) -> int * string /// Use Discriminated Union(DU) to send and recieve data [] abstract Calculate3 : c: Suit -> Suit