
Hi David,
On Sun, 7 Aug 2011 11:19:21 -0400
David Place
On Aug 7, 2011, at 11:07 AM, Manfred Lotz wrote:
What I don't want to do is to write a definition like valList because if I add a new value I have to remind myself not to forget to add it to valList too.
Hi, Manfred.
I think we are having difficulty understanding what you are try to do. Since, you are worried about conciseness, why not write out the Haskell program that shows what you want to do without worrying about conciseness. Then we can look for opportunities to improve it.
You may be right. Here is what I want to do. I have some 15 directories as Strings, where I want to do certain actions like to create those directories, or doing some other things to all of those directories. For doing this something like this would be good (for the sake of simplicity I do not write down all 15 entries) dirLst = [ "somedir", "otherdir" ] main = do map makeDir dirLst ... Later on in the program I would need those directorie names to create (depending upon the context) new pathnames. Now something like this would be good. -- In my program instead of d1,...,d15 -- I use meaningful names of course. d1 = "somedir" ... d15 = "otherdir" doSomething fls = do let pathname = d1 ++ "/bin" copyFiles2bin fls pathname ... I would like to combine both approaches in a concise (from a typing point of view) way. This I don't like d1 = "somedir" ... d15 = "otherdir" dirLst = [ d1, d15] because then I have to write names d1, ..., d15 two times in order to get my definitions right. I'm looking for a more elegant way doing this. Hope this is a bit clearer what I'm after. -- Thanks, Manfred