Closed milesfrain closed 4 years ago
Thanks!
I actually think lift2
is way weirder (in an idiomatic sense at least) than the f <$> x <*> y
pattern. I've never used lift2
, and very rarely see it used.
I'm not opposed to reverting that component of this change.
The lift#
functions get some decent coverage in the book.
If we don't consider that an idiomatic way to write PS, then I think we should eliminate that section.
I'm wondering if the same should be said of ado
notation, which was another option in place of lift2
.
I'm happy with whatever for the implementation -- I just found it odd that tuples encode via arrays and decode via lists, and would prefer it to encode / decode to the same type.
Edit: Re-reading the PR description, I also don't think this code specifically (meaning a link to this code) should be used in the PureScript book, but rather that the book should probably just inline whatever code style it wants to use. That said, I'm still happy to change to use arrays in both encoding / decoding and the difference between lift2
and >>=
isn't that big to me.
This is just different syntax that's functionally equivalent. It is covered by, and passes, existing quickCheck tests.
Motivation for this change is that I'm planning on pointing readers of Ch10 (rewrite targeting argonaut in-progress) to
decodeJsonTuple
for guidance on writing their ownDecodeJson
instances in one of the exercises, and I'd like this library example to be as easy as possible for beginners to grok.This is an extension of #75.