davegurnell / checklist

Validation library for Scala.
Apache License 2.0
47 stars 11 forks source link

WIP Created Checked Class #17

Closed Jacoby6000 closed 6 years ago

Jacoby6000 commented 6 years ago

Based on some discussion in #10, and some comments from @ashleymercer.

The main work I've done so far is in Checked.scala

I did this before @ashleymercer's most recent comments regarding Trior, but I'm not sure generalizing that far would be good for the purposes of Checked specifically.

Trior is a structure I'd expect to be monadic with regard to any position, however Checked is Monadic with regard to the left and right, but applicative in the middle.

Also, if you look at Errored, Warned, and Succeeded, we can take advantage of our domain regarding Nels and Lists in different positions based on what information is known in those contexts.

Jacoby6000 commented 6 years ago

I should have an update to this by the end of the day. I've changed Checked in to Trior, as suggested in #10 but I don't like the name.

Trior implies that all 3 states can exist independently of one another, like 3 options where one must be present. However, a left can never appear with a right, and a middle will never appear alone. In the end, you wind up with only 4 possible states. I think the easiest to parse representation of this is (Option[Middle], Either[L, R]). It's not quite a Trior. In the end, that's just a name though so who really cares. It's easy to change.

Jacoby6000 commented 6 years ago

Closing this because it's outdated now, and likely super-ceded by the recent work