I’m constructing a [CalendarDay] which looks like this
newtype CalendarDay = MKCal (Either AvailableDay UnAvailableDay) deriving Show
Right now, I am passing an intermediate data type through several filters with the intent
of constructing the [CalendarDay] once all information has been gathered. The problem is, the tuple now has become a four-value tuple. Which means it’s time to do something different.
My options appear to be one of two.
1) Construct a record holding the four values, passing that along to each filter, then construct the [CalendarDay].
2) Construct the [CalendarDay] as I go along through each filter, dispensing with the intermediate data type altogether.
Opinions welcome. I’m leaning towards option 2.
I’m going to write this up in a blog entry. Don’t have a blog, but Michael Snoyman’s site will serve until I fix that problem.
I’d try building up the type incrementally, replacing
undefinedvalues with their found value as it is discovered.If relying on laziness is unappealing, you could guarantee safety by well-defined intermediate types for each stage.