Cabal-1.1.4ContentsIndex
Distribution.PreProcess
Portabilityportable
Stabilityalpha
MaintainerIsaac Jones <ijones@syntaxpolice.org>
Description
Synopsis
preprocessSources :: PackageDescription -> LocalBuildInfo -> Int -> [PPSuffixHandler] -> IO ()
knownSuffixHandlers :: [PPSuffixHandler]
ppSuffixes :: [PPSuffixHandler] -> [String]
type PPSuffixHandler = (String, BuildInfo -> LocalBuildInfo -> PreProcessor)
type PreProcessor = FilePath -> FilePath -> Int -> IO ExitCode
removePreprocessed :: [FilePath] -> [String] -> [String] -> IO ()
removePreprocessedPackage :: PackageDescription -> FilePath -> [String] -> IO ()
ppCpp :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppCpp' :: [String] -> BuildInfo -> LocalBuildInfo -> PreProcessor
ppGreenCard :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppHsc2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppHappy :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppAlex :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppUnlit :: PreProcessor
Documentation
preprocessSources
:: PackageDescription
-> LocalBuildInfo
-> Intverbose
-> [PPSuffixHandler]preprocessors to try
-> IO ()
Apply preprocessors to the sources from hsSourceDirs, to obtain a Haskell source file for each module.
knownSuffixHandlers :: [PPSuffixHandler]
Standard preprocessors: GreenCard, c2hs, hsc2hs, happy, alex and cpphs.
ppSuffixes :: [PPSuffixHandler] -> [String]
Convenience function; get the suffixes of these preprocessors.
type PPSuffixHandler = (String, BuildInfo -> LocalBuildInfo -> PreProcessor)
A preprocessor for turning non-Haskell files with the given extension into plain Haskell source files.
type PreProcessor = FilePath -> FilePath -> Int -> IO ExitCode

The interface to a preprocessor, which may be implemented using an external program, but need not be. The arguments are the name of the input file, the name of the output file and a verbosity level. Here is a simple example that merely prepends a comment to the given source file:

 ppTestHandler :: PreProcessor
 ppTestHandler inFile outFile verbose
     = do when (verbose > 0) $
            putStrLn (inFile++" has been preprocessed to "++outFile)
          stuff <- readFile inFile
          writeFile outFile ("-- preprocessed as a test\n\n" ++ stuff)
          return ExitSuccess
removePreprocessed
:: [FilePath]search Location
-> [String]Modules
-> [String]suffixes
-> IO ()
Remove the preprocessed .hs files. (do we need to get some .lhs files too?)
removePreprocessedPackage
:: PackageDescription
-> FilePathroot of source tree (where to look for hsSources)
-> [String]suffixes
-> IO ()
ppCpp :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppCpp' :: [String] -> BuildInfo -> LocalBuildInfo -> PreProcessor
ppGreenCard :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppHsc2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppHappy :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppAlex :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppUnlit :: PreProcessor
Produced by Haddock version 0.7