On Sat, Oct 18, 2008 at 11:30:13AM -0700, Jason Dagit wrote: > Franchise seems to use a template system. File names that end in ".in" are > in some sort of template language. If you look in setup.hs you'll see > things like, createFile "foo". Unlike the name and type suggest createFile > isn't equivalent to the command 'touch'. It's actually going through all > the user defined substititions (called replacements), and instantiating a > template based on them. Someone should rename 'createFile' to something > that says, 'creates file 'foo' from a template named 'foo.in' by looking at > globally defined replacements'. I'd say, instantiateFromTemplate, would be > a significantly better name. Also by changing the type so that it takes the > template name and the output file name it would be more clear what it does.
Setup.hs does the same thing configure does as far as the templates go, so it should be pretty easy to understand as well as easier to keep in parallel with configure.ac while it being developed. > Which is another problem I had. Trying to understand what setup.hs does > has been difficult. I had to read the entire source of Franchise twice > before I could figure out any part of what setup.hs is doing, and I still > don't know how to extend setup.hs. The heavy use of operators and > redefined Haskell98 functions made the source hard for me to > read[1]. Only one module, Util.hs, seems to have any source level > documentation. But, all that aside, the really hard to grok part is the > undocumented mutually recursive datastructures that sit at the heart of > franchise. Unfortunately, as a user of setup.hs you need to understand > them because they are exposed at that level currently. I forget what the > types are called but it's the ones that use (:<), (:<-), and (|<-) as > constructors. You can see them at use in setup.hs. The impression given > there is that they hide some sort of magic. For almost all uses, you don't need to understand the dependency and make rules, and I'll welcome suggestions for improvements (preferably to the franchise mailing list). :< is the equivalent of ':' in a makefile, separating a target from its dependencies, and :<- and |<- are both the something like a tab, in that they connect a target-dependency relationship with a rule for building the target from its dependencies. > [1] endsWith/beginsWith/startsWith all seem to be equivalent to functions > found in the Haskell98 report. By giving new definitions of these functions > I was tricked into reading their definitions and trying to understand *how* > they differ in behavior from the isSuffixOf and isPrefixOf. I have patches > that replace the home grown versions with the ones from Data.List if anyone > wants them. You are welcome to send patches in, but patches that add new dependencies won't be accepted. I avoided using Data.List because I didn't know if it was likely to be moved out of base. And one of the points of franchise is to be portable from one version of ghc to another. And in general, I don't consider the naming of unexported functions terribly important. Personally, I'd rather see these functions renamed than replaced with functions from Data.List that I'd have to look up to figure out what they do, rather than just reading the source. -- David Roundy http://www.darcs.net _______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
