Tôi có hai chức năng.Composable sử dụng scalaz Arrow?
def process(date: DateTime, invoice: Invoice, user: User, reference: Reference) : (Action, Iterable[Billable])
def applyDiscount(billable: Billable) : Billable
Làm thế nào tôi có thể soạn những cái mà tôi có một chức năng duy nhất của (DateTime, Invoice, Thành viên, tham khảo) => (Hành động, Iterable [Có thể thanh toán])
Đây là mans cách kém những gì tôi muốn
def buildFromInvoice(user: User, order: Invoice, placementDate: DateTime, reference: Reference) = {
val ab = billableBuilder.fromInvoice(user, order, placementDate, reference)
(ab._1, ab._2.map(applyDiscount(_))
}
bạn muốn có một chức năng mà lần đầu tiên thực hiện 'process' và sau đó' applyDiscount'? –
Vâng, chính xác. Hai hàm này có thể phối hợp bằng cách sử dụng mũi tên Scalaz và nếu có, cú pháp là gì? – OleTraveler