[PATCH] * Export X.L.Gaps Gaps constructor

Hi, Since it's adviced everywhere to attach patches (in the absence of a functional MTA setup), here it goes, attached. -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com

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. Perhaps
the right thing to do is to wrap up these functions into ones that act
on Gaps a's instead, and export those, instead of exporting the
constructor?
~d
Quoting Paul Fertser
Hi,
Since it's adviced everywhere to attach patches (in the absence of a functional MTA setup), here it goes, attached.
-- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com

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? -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com

Quoting Paul Fertser
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. ~d

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

On Fri, Feb 22, 2013 at 12:52:39PM +0400, Paul Fertser wrote:
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
Well, unless you meant gaps' as a smart constructor for ModifiedLayout, sorry for the noise. -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com

This 1-patch bundle was just applied to http://code.haskell.org/XMonadContrib:
20130222072232 Paul Fertser
participants (3)
-
darcswatch@nomeata.de
-
Paul Fertser
-
wagnerdm@seas.upenn.edu