hinstaller 2007.4.24 → 2007.5.13
raw patch · 3 files changed
+19/−6 lines, 3 files
Files
- hinstaller.cabal +2/−2
- src/System/Installer.hs +2/−2
- src/System/Installer/TH.hs +15/−2
hinstaller.cabal view
@@ -1,6 +1,6 @@ name: hinstaller-version: 2007.4.24-stability: Alpha+version: 2007.5.13+stability: Beta copyright: Matthew Sackman category: System maintainer: matthew@wellquite.org
src/System/Installer.hs view
@@ -67,7 +67,7 @@ -- exports a function 'cabalCleanHInstallerDir'. To use this, modify -- your @Setup.hs@ along the lines of the following: ----- > #!\/usr\/bin\/env runghc+-- > #!/usr/bin/env runghc -- > -- > import Distribution.Simple -- > import System.Installer@@ -99,7 +99,7 @@ binariesWithTmp ; func <- TH.makeInstallFunc funcName clauses ; dataDecls <- TH.makeDataDecls funcName binaries- ; return $ (concat importDecls) ++ (func : dataDecls)+ ; return $ (concat importDecls) ++ func ++ dataDecls } where clauses = map (TH.makeInstallFuncCase funcName) binaries
src/System/Installer/TH.hs view
@@ -45,9 +45,22 @@ ptr = varE $ mkName ("installer_" ++ fullName) len = varE $ mkName ("installer_" ++ fullName ++ "_length") -makeInstallFunc :: String -> [Q Clause] -> Q Dec+makeInstallFunc :: String -> [Q Clause] -> Q [Dec] makeInstallFunc funcName clauses- = funD (mkName funcName) clauses+ = do { func <- funD name clauses+ ; funcSig <- sigD name (appT+ (appT arrowT (conT dataDeclName))+ (appT+ (appT arrowT (conT fpName))+ (appT (conT ioName) (conT tupName))))+ ; return [funcSig, func]+ }+ where+ name = mkName funcName+ dataDeclName = mkName $ "Installer_" ++ funcName+ fpName = mkName "FilePath"+ ioName = mkName "IO"+ tupName = mkName "()" makeDataDecls :: String -> [(String, FilePath)] -> Q [Dec] makeDataDecls base names