zeroth (empty) → 2008.10.27
raw patch · 4 files changed
+88/−0 lines, 4 filesdep +basedep +directorydep +haskell-src-extssetup-changed
Dependencies added: base, directory, haskell-src-exts, process
Files
- LICENSE +35/−0
- Setup.hs +2/−0
- src/Main.hs +30/−0
- zeroth.cabal +21/−0
+ LICENSE view
@@ -0,0 +1,35 @@+Copyright (c) 2004-2005, David Himmelstrup+All rights reserved.++Redistribution and use in source and binary forms,+with or without modification, are permitted provided+that the following conditions are met:++ * Redistributions of source code must retain+ the above copyright notice, this list of+ conditions and the following disclaimer.+ * Redistributions in binary form must reproduce+ the above copyright notice, this list of+ conditions and the following disclaimer in the+ documentation and/or other materials provided+ with the distribution.+ * Neither the name of David Himmelstrup nor the+ names of other contributors may be used to+ endorse or promote products derived from this+ software without specific prior written permission.+++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY+OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/Main.hs view
@@ -0,0 +1,30 @@+module Main ( main ) where++import Zeroth ( zeroth )+import Setup ( parseArgs, ConfigFlags (..), mkConfigFlags )++import System.Environment ( getArgs )+import System.IO ( hGetContents, stdin, stdout, hPutStr )++readFromFile :: FilePath -> IO String+readFromFile "-" = hGetContents stdin+readFromFile path = readFile path++writeToFile :: FilePath -> String -> IO ()+writeToFile "-" d = hPutStr stdout d+writeToFile path d = writeFile path d++++main :: IO ()+main = do args <- getArgs+ configFlags <- mkConfigFlags =<< parseArgs args+ input <- readFromFile (configInputFile configFlags)+ output <- zeroth (configGHCPath configFlags)+ (configCpphsPath configFlags)+ (configGHCArgs configFlags)+ (configCpphsArgs configFlags)+ input+ writeToFile (configOutputFile configFlags) output++
+ zeroth.cabal view
@@ -0,0 +1,21 @@+Name: zeroth+Version: 2008.10.27+License: BSD3+License-file: LICENSE+Maintainer: Lemmih <lemmih@gmail.com>+Build-type: Simple+Build-depends: base, haskell-src-exts, directory, process+Copyright: 2005-2008 Lemmih <lemmih@gmail.com>+Category: Language+Synopsis: ZeroTH - remove unnecessary TH depdendencies.+Description: TemplateHaskell is fairly useful for generating new+ Haskell programs. This, however, incur a dependency on+ TH on subsequent uses where none theoretically should exist.+ ZeroTH solves this by scanning a file for top-level TH+ declarations, evaluates them, and then puts the generated+ code back.++Executable: zeroth+Main-is: Main.hs+GHC-Options: -Wall+Hs-Source-Dirs: src