
Hi, On Thu, Feb 21, 2013 at 03:09:46PM -0500, wagnerdm@seas.upenn.edu wrote:
On Thu, Feb 21, 2013 at 01:54:28PM -0500, wagnerdm@seas.upenn.edu wrote:
Hm. From a short look at the module, it seems the Gaps constructor is not exported because there are some invariants maintained by the auxiliary functions that act on GapSpecs and [Direction2D]s.
Do I undertand it right that you mean exporting Gaps constructor would allow users to specify some direction more than once or to add some direction for which a gap is not defined and that it should be prevented compile-time? Would creating another function (gaps' ?) that would accept a list of triples (with the third boolean element to specify an initial state) solve the problem?
Yep, that's pretty much what I meant. A smart constructor like the one you suggested should deal with the problem just fine.
Sorry but I do not know much about type constructors and data constructors and I do not see how to apply that (partial) knowledge here (without adding unnecessary complexity, iow everything I can imagine is more complicated than the attached patch, which does not add or modify any constructors, not even in the "smart constructors idiom" sense). Thank you for the review! -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com