我有兩個功能。使用斯拉拉箭頭組合?
def process(date: DateTime, invoice: Invoice, user: User, reference: Reference) : (Action, Iterable[Billable])
def applyDiscount(billable: Billable) : Billable
如何可以構成這些使得我有(日期時間,發票,用戶,參考)=>(動作,可迭代[計費])的單功能
此處是芒方式差我想
def buildFromInvoice(user: User, order: Invoice, placementDate: DateTime, reference: Reference) = {
val ab = billableBuilder.fromInvoice(user, order, placementDate, reference)
(ab._1, ab._2.map(applyDiscount(_))
}
你要首先執行'process'然後'功能applyDiscount'? –
是的,確切地說。這兩個函數是否使用Scalaz箭頭組合?如果是這樣,語法是什麼? – OleTraveler