How to fool the divergence checker in ghc 9

David Feuer david.feuer at gmail.com
Fri Jan 20 10:27:51 UTC 2023


Actually, getting that arity probably isn't important anyway.... Try O0.

On Fri, Jan 20, 2023, 5:26 AM David Feuer <david.feuer at gmail.com> wrote:

> What if you go with the big hammer for that module: -O0? My main concern
> about that is that you won't get arity analysis. There may be some more -f
> flags I've missed...
>
> On Fri, Jan 20, 2023, 5:17 AM Michael Sperber <sperber at deinprogramm.de>
> wrote:
>
>>
>> On Fri, Jan 20 2023, David Feuer <david.feuer at gmail.com> wrote:
>>
>> > I don't know what all that means exactly (especially since GHC's demand
>> > signatures have changed recently in a way I don't understand at all).
>> But
>> > for hiding divergence, one option is to use a module with demand
>> analysis
>> > disabled. Try {-# options_ghc -fno-strictness #-}. You'll likely need to
>> > put oops in its own module to avoid interfering with desired
>> optimizations.
>>
>> THanks for the suggestion!
>>
>> So I did this:
>>
>> {-# options_ghc -fno-strictness #-}
>> module ConCat.Oops(oops) where
>>
>> import GHC.Stack (errorWithStackTrace)  -- for oops
>>
>> -- | Pseudo function to fool GHC's divergence checker.
>> oops :: String -> b
>> oops str = errorWithStackTrace ("Oops: "++str)
>> {-# NOINLINE oops #-}
>>
>> ... but am getting the same result from the divergence checker, sadly ...
>>
>> --
>> Regards,
>> Mike
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20230120/17799222/attachment.html>


More information about the Glasgow-haskell-users mailing list