Disable messages with GHC API

Christopher Done chrisdone at gmail.com
Fri Feb 3 15:30:21 UTC 2017


Adding `handleSourceError` around it makes no difference.

Which makes sense, as I don't think warnings count as exceptions,
otherwise my code would never have completed in the first place.

On 3 February 2017 at 12:50, Matthew Pickering
<matthewtpickering at gmail.com> wrote:
> The errors are eventually caught and printed by "handleSourceError"
> which is used a few times in your code. You could either modify one of
> these to not print out any errors or try something more intelligent
> like is in `parUpsweep_one` which does use the `log_action` in order
> to print the errors out.
>
> On Fri, Feb 3, 2017 at 12:21 PM, Christopher Done <chrisdone at gmail.com> wrote:
>> In Intero, after loading modules, for each one I run the following
>> function: https://github.com/commercialhaskell/intero/blob/300ac5a/src/GhciInfo.hs#L75..L85
>>
>> If there are warnings or any output, they get outputted. As they are
>> already outputted by regular :load, I don’t need the same output
>> twice.
>>
>> How do I disable non-severe output for any GhcMonad m => m a? I’m
>> using GHC 8.0.1 presently.
>>
>> I tried the following before calling getModInfo, expecting there to be
>> no output anymore:
>>
>> +      GHC.setSessionDynFlags
>> +        df {log_action = \ref dflags severity srcSpan style msg -> return ()}
>>
>> And this had no effect. I tried some other things but ran out of
>> patience to keep a record of them all.
>>
>> Ciao!
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list