QuickAnnotate 0.2 → 0.3
raw patch · 2 files changed
+15/−3 lines, 2 files
Files
- QuickAnnotate.cabal +1/−1
- QuickAnnotate/Preprocessor.hs +14/−2
QuickAnnotate.cabal view
@@ -1,5 +1,5 @@ Name: QuickAnnotate-Version: 0.2+Version: 0.3 Synopsis: Annotation Framework Homepage: http://code.haskell.org/QuickAnnotate/ License: BSD3
QuickAnnotate/Preprocessor.hs view
@@ -2,7 +2,7 @@ import Language.Haskell.Exts import System.Environment (getArgs)-+import Data.List annotationFunction :: String annotationFunction = "annotate"@@ -44,8 +44,20 @@ transModule :: Module -> Module transModule (Module srcLoc moduleName modulePragmas mWarningText mExportSpecs importDecls decs) - = Module srcLoc moduleName modulePragmas mWarningText mExportSpecs importDecls (transDecl `map` decs)+ = Module srcLoc moduleName modulePragmas mWarningText mExportSpecs (transImportDecls importDecls) (transDecl `map` decs) +transImportDecls :: [ImportDecl] -> [ImportDecl]+transImportDecls lst + | Nothing <- find (\x-> let (ModuleName n) = (importModule x) in (n == "QuickAnnotate")) lst + = (ImportDecl {importLoc = SrcLoc {srcFilename = "<unknown>.hs", srcLine = 1, srcColumn = 1}, + importModule = ModuleName "QuickAnnotate", + importQualified = False, + importSrc = False, + importPkg = Nothing, + importAs = Nothing, + importSpecs = Nothing}): lst+transImportDecls lst = lst+ transDecl :: Decl -> Decl transDecl (FunBind mtchs) = FunBind (transMatch`map`mtchs) transDecl (PatBind srcLoc pat mtype rhs binds) = PatBind srcLoc pat mtype (transRhs srcLoc rhs) binds