Plugin example not updated for ghc 7.6
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
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Documentation |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |