A problem with my .curried approach is that it will stop working when
num-checks > 22, because .curried is a member of scala.FunctionX.
I'm really interested i a solution which will scale to more than 100
checks, so if your solution based on HLists helps, please share it.
Thanks.
--
Andreas
On Saturday, September 10, 2016 at 10:52:27 AM UTC+2, Stephen Compall wrote:
>
> On 5/30/16 6:47 PM, Andreas Joseph Krogh wrote:
>
> Then I use the ⊛ operator to accumulate errors:
>
> (checkInvoiceNumber
> ⊛ checkSentDate
> ⊛ checkCompany
> ⊛ checkSourceCompany
> ⊛ checkInvoiceSource
> ⊛ checkBankAccount
> ⊛ checkCustAddressStreet
> ⊛ checkCustAddressPlace
> ⊛ checkCustAddressCity
> ⊛ checkCustAddressZip
> ⊛ checkSenderAddressStreet
> ⊛ checkSenderAddressPlace
> ).tupled match {
> case Failure(msgList) => prinln(msgList) case Success((invoiceNumber,
> invoiceDate, company, sourceComp, invoiceSource, fromBankAccount
> , custAddrStreet, custAddrPlace, custAddrCity, custAddrZip
> , senderAddrStreet, senderAddrPlace
> )) =>
>
>
> This approach stops working when having more then 12 checks (because
> ApplicativeBuilder12 is the "last one").
>
> How can I accomplish the same using a List of any length, preserving the
> types in Success so I can use them like the match-statement above?
>
>
> The simplest way is to add more parentheses and .tupled calls. Then you
> can add more parentheses in the same places to your case Success, and the
> pattern match should work just as well.
>
> There is an hlist approach that is less ad hoc, but requires more setup;
> I'd suggest it only if you are already incorporating hlists into your code.
>
> Greetings,
>
> Stephen.
>
>
--
You received this message because you are subscribed to the Google Groups
"scalaz" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/scalaz.
For more options, visit https://groups.google.com/d/optout.