<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I did some more digging around and it would seem that the error was being printed from the load call (depanal does some parsing ofcourse to find the imports).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I managed to silence that using loadWithLogger (const $ return ())  LoadAllTargets (maybe all these loggers should be consolidated).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>That stopped it from showing part of the error, but can’t figure out what’s showing the module name at the end. â€œPrintf”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Daniel Peebles [mailto:pumpkingod@gmail.com] <br><b>Sent:</b> Saturday, May 22, 2010 03:02<br><b>To:</b> Phyx<br><b>Cc:</b> Thomas Schilling; haskell-cafe@haskell.org<br><b>Subject:</b> Re: [Haskell-cafe] making the GHC Api not write to stderr<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Have you tried freopen on stderr?<o:p></o:p></p><div><p class=MsoNormal>On Fri, May 21, 2010 at 8:43 AM, Phyx &lt;<a href="mailto:lonetiger@gmail.com">lonetiger@gmail.com</a>&gt; wrote:<o:p></o:p></p><p class=MsoNormal>Hi,<br>I tried that, setting it to (\_ _ _ _ -&gt; return ()) and it still did the<br>same, also tried setting it to undefined to see whether the code that's<br>printing the error is using it, and it didn't crash<br>So I assume it's not.<br><br>-----------<br>*VsxParser&gt; getModInfo True<br>&quot;C:\\Users\\Phyx\\AppData\\Local\\Temp\\tmp5600.hs&quot;<br>&quot;&quot; &gt;&gt; return ()<br><br>C:\Users\Phyx\AppData\Local\Temp\tmp5600.hs:11:13:<br>&nbsp; &nbsp;parse error on input `='<br>Printf<br>---------<br><br>I think parseModule might still have a hardcoded print statement in it.<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><br>-----Original Message-----<br>From: Thomas Schilling [mailto:<a href="mailto:nominolo@googlemail.com">nominolo@googlemail.com</a>]<br>Sent: Friday, May 21, 2010 12:53<br>To: Phyx<br>Cc: <a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a><br>Subject: Re: [Haskell-cafe] making the GHC Api not write to stderr<o:p></o:p></p></div><div><div><p class=MsoNormal>You could try changing the log_action[1] member of the DynFlags. &nbsp;A while<br>ago I turned most printed errors into some form of error message, but I<br>wouldn't be surprised if I missed some places. &nbsp;All output should go through<br>log_action, though, so try changing that to intercept any output.<br><br>[1]:<br><a href="http://haskell.org/ghc/docs/6.12-latest/html/libraries/ghc-6.12.2/DynFlags.h%0d%0atml#v%3Alog_action" target="_blank">http://haskell.org/ghc/docs/6.12-latest/html/libraries/ghc-6.12.2/DynFlags.h<br>tml#v%3Alog_action</a><br><br>On 20 May 2010 19:05, Phyx &lt;<a href="mailto:lonetiger@gmail.com">lonetiger@gmail.com</a>&gt; wrote:<br>&gt; I was wondering how to forcibly quiet down the API. I have a custom<br>&gt; handler in place, but when I call the function on failure both my<br>&gt; handler gets called and somewhere somehow errors get printed to the<br>&gt; stderr, which I really need to avoid.<br>&gt;<br>&gt;<br>&gt;<br>&gt; My current code looks like<br>&gt;<br>&gt;<br>&gt;<br>&gt; getModInfo :: Bool -&gt; String -&gt; String -&gt; IO (ApiResults ModuleInfo)<br>&gt;<br>&gt; getModInfo qual file path = handleSourceError processErrors $<br>&gt;<br>&gt; runGhc (Just libdir) $ do<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; dflags &lt;- getSessionDynFlags<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; setSessionDynFlags $ configureDynFlags dflags<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; target &lt;- guessTarget file Nothing<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; addTarget target<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; setSessionDynFlags $ dflags { importPaths = [path] }<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; load LoadAllTargets<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;graph &lt;- depanal [] False<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; let modifier = moduleName . ms_mod<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modName&nbsp; = modifier $ head graph<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; includes = includePaths dflags<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imports&nbsp; = importPaths dflags<br>&gt;<br>&gt;<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;dflags' &lt;- Debug.trace (moduleNameString modName)<br>&gt; getSessionDynFlags<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; setSessionDynFlags $ dflags' { includePaths = path:includes<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , importPaths&nbsp; = path:imports<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;<br>&gt;<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; parsed&nbsp; &lt;- parse modName<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; checked &lt;- typecheckModule parsed<br>&gt;<br>&gt; _______________________________________________<br>&gt; Haskell-Cafe mailing list<br>&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>&gt;<br>&gt;<br><br><br><br>--<br>Push the envelope. &nbsp;Watch it bend.<br><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>