
I am writing some code for citation support in gitit, and all the #ifdefs I'm using to do conditional compilation are a bit tiresome. Suppose you have the requirement that a certain feature of your software be disable-able at compile time, to avoid having to pull in certain dependencies (which may not be available on all platforms). Disabling a feature may entail removing certain fields from certain constructors (again, to avoid pulling in certain dependencies), and/or removing certain functions from certain modules. What is the best way to do this in Haskell? This problem description suggests that perhaps insights from Aspect-Oriented Programming and/or Software Product Lines may be relevant. However, I haven't heard of much work that relates these concepts to Haskell. Maybe this would be a good topic for an enterprising student? -- Robin

Hi Robin, On Fri, Mar 27, 2009 at 16:13, Robin Green wrote:
Suppose you have the requirement that a certain feature of your software be disable-able at compile time, to avoid having to pull in certain dependencies (which may not be available on all platforms). Disabling a feature may entail removing certain fields from certain constructors (again, to avoid pulling in certain dependencies), and/or removing certain functions from certain modules. What is the best way to do this in Haskell?
I don't know, but... This problem description suggests that perhaps insights from
Aspect-Oriented Programming and/or Software Product Lines may be relevant. However, I haven't heard of much work that relates these concepts to Haskell. Maybe this would be a good topic for an enterprising student?
I would love to see Haskell SPLs developed with feature-oriented programming concepts [1,2]. Only it would be much better if compositions were type-safe. I don't want aspects as they are presented in AspectJ (i.e. dynamic, hazardous). But everybody has their own definition of aspect these days. Regards, Sean [1] http://en.wikipedia.org/wiki/Feature_Oriented_Programming [2] http://www.cs.utexas.edu/users/schwartz/search.cgi

On Fri, 27 Mar 2009, Robin Green wrote:
I am writing some code for citation support in gitit, and all the #ifdefs I'm using to do conditional compilation are a bit tiresome.
I live well without CPP in Haskell. When I need conditional compilation I create two directories with modules of the same names in it. Then I set Hs-Source-Dirs conditionally in Cabal.

Robin Green wrote:
I am writing some code for citation support in gitit, and all the #ifdefs I'm using to do conditional compilation are a bit tiresome.
Suppose you have the requirement that a certain feature of your software be disable-able at compile time, to avoid having to pull in certain dependencies (which may not be available on all platforms). Disabling a feature may entail removing certain fields from certain constructors (again, to avoid pulling in certain dependencies), and/or removing certain functions from certain modules. What is the best way to do this in Haskell?
I would parameterise over the functionality (i.e. use type parameters to datatypes and HOF parameters to functions where appropriate), and instantiate the types with () or some useful type as appropriate. Some CPP would still be required but hopefully only at the top level. Ganesh =============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ===============================================================================
participants (4)
-
Henning Thielemann
-
Robin Green
-
Sean Leather
-
Sittampalam, Ganesh