[deinfix and detypesyn statement before pretty printing it in jhci
John Meacham <john@repetae.net>**20051208025247] hunk ./FrontEnd/Infix.hs 19
-module FrontEnd.Infix (buildFixityMap, infixHsModule, FixityMap,size) where
+module FrontEnd.Infix (buildFixityMap, infixHsModule, FixityMap,size, infixStatement) where
hunk ./FrontEnd/Infix.hs 72
+infixStatement :: Monad m => FixityMap -> HsStmt -> m HsStmt
+infixStatement (FixityMap ism) m = return $ processStmt ism m
hunk ./FrontEnd/TypeSyns.hs 1
-module TypeSyns( expandTypeSyns ) where
+module TypeSyns( expandTypeSyns, expandTypeSynsStmt ) where
hunk ./FrontEnd/TypeSyns.hs 48
+expandTypeSynsStmt :: MonadWarn m => TypeSynonyms -> Module -> HsStmt -> m HsStmt
+expandTypeSynsStmt syns mod m = ans where
+    startState = ScopeState {
+        errors         = [],
+        synonyms       =  syns,
+        srcLoc         = bogusASrcLoc,
+        currentModule  = mod
+        }
+
+    (rm, fs) = runState (renameHsStmt m ()) startState
+    ans = do
+        mapM_ addWarning (errors fs)
+        return rm
hunk ./Interactive.hs 21
+import qualified FrontEnd.Infix
+import qualified HsPretty
+import TypeSyns
hunk ./Interactive.hs 56
-    stateInteract :: Interact
+    stateInteract :: Interact,
+    stateModule :: Module
+    }
+
+isInitial = IS {
+    stateHo = mempty,
+    stateInteract = emptyInteract,
+    stateModule = Module "Main"
hunk ./Interactive.hs 110
-        Right e -> executeStatement IS { stateHo = ho, stateInteract = act } e >> return act
+        Right e -> executeStatement isInitial { stateHo = ho, stateInteract = act } e >> return act
hunk ./Interactive.hs 123
+printStatement stmt = do
+        putStrLn $ HsPretty.render $ HsPretty.ppHsStmt $  stmt
hunk ./Interactive.hs 127
-executeStatement IS { stateHo = ho } stmt = do
+executeStatement is@IS { stateHo = ho } stmt = do
hunk ./Interactive.hs 129
-    stmt' <- renameStatement mempty defs (Module "Main") stmt
+    stmt' <- renameStatement mempty defs (stateModule is) stmt
hunk ./Interactive.hs 131
-    when (not b) $ putStrLn (show stmt')
-executeStatement _ HsLetStmt {} = putStrLn "let statements not yet supported"
-executeStatement _ HsGenerator {} = putStrLn "generators not yet supported"
-executeStatement _ (HsQualifier e) = putStrLn (show e)
+    if b then return () else do
+    --printStatement stmt'
+    stmt'' <- expandTypeSynsStmt (hoTypeSynonyms ho) (stateModule is) stmt'
+    stmt''' <- FrontEnd.Infix.infixStatement (hoFixities ho) stmt''
+    b <- printIOErrors
+    if b then return () else do
+    printStatement stmt'''
+
+--executeStatement _ HsLetStmt {} = putStrLn "let statements not yet supported"
+--executeStatement _ HsGenerator {} = putStrLn "generators not yet supported"
+--executeStatement _ (HsQualifier e) = putStrLn (show e)
hunk ./Interactive.hs 153
+{-
+    let thisFixityMap = buildFixityMap (concat [ filter isHsInfixDecl (hsModuleDecls $ modInfoHsModule m) | m <- ms])
+    let fixityMap = thisFixityMap `mappend` hoFixities me
+    let thisTypeSynonyms =  (declsToTypeSynonyms $ concat [ filter isHsTypeDecl (hsModuleDecls $ modInfoHsModule m) | m <- ms])
+    let ts = thisTypeSynonyms  `mappend` hoTypeSynonyms me
+    let f x = expandTypeSyns ts (modInfoHsModule x) >>= FrontEnd.Infix.infixHsModule fixityMap >>= \z -> return (modInfoHsModule_s ( z) x)
+-}