
#7682: Plugin example not updated for ghc 7.6 -----------------------------+---------------------------------------------- Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Component: Documentation Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- The GHC plugin docs (http://www.haskell.org/ghc/docs/latest/html/users_guide/compiler- plugins.html) have this example: {{{ pass :: ModGuts -> CoreM ModGuts pass = bindsOnlyPass (mapM printBind) where printBind :: CoreBind -> CoreM CoreBind printBind bndr@(NonRec b _) = do putMsgS $ "Non-recursive binding named " ++ showSDoc (ppr b) return bndr printBind bndr = return bndr }}} but in ghc >= 7.6 `showSDoc` requires `DynFlags`: {{{ pass :: ModGuts -> CoreM ModGuts pass guts = do dynFlags <- getDynFlags bindsOnlyPass (mapM $ printBind dynFlags) guts where printBind :: DynFlags -> CoreBind -> CoreM CoreBind printBind _dynFlags bndr@(NonRec b _) = do #if __GLASGOW_HASKELL__ >= 706 putMsgS $ "Non-recursive binding named " ++ showSDoc _dynFlags (ppr b) #else putMsgS $ "Non-recursive binding named " ++ showSDoc (ppr b) #endif return bndr printBind _dynFlags bndr = return bndr }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7682 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler