Strictness/laziness warnings

David Feuer david.feuer at
Mon May 30 03:16:26 UTC 2016

Mostly I'm looking for a rough estimate. Some false positives and
false negatives are tolerable. If I have something like

f :: Int -> Maybe String -> String
f _ Nothing = "Hi there!"
f n (Just b) = if n > 0 then show b else "whatever"

then I'd likely be interested in a warning about the fact that the
first case is not strict in the Int and the second is. I'd also likely
be interested in a warning about the first case because I'm taking a
small primitive value (Int) and doing so lazily.

On Sun, May 29, 2016 at 11:04 PM, wren romano <winterkoninkje at> wrote:
> On Sat, May 28, 2016 at 10:14 PM, Edward Kmett <ekmett at> wrote:
>> How would you detect the argument only being forced some of the time? Sounds
>> like a lot of long-term cross-module book-keeping.
> Sounds to me like what the strictness analyzer is already doing, ne? I
> missed the beginning of the thread, so might be off base. If it's more
> about noticing when the use sites of a given function have some
> pattern not captured by the strictness determined from the function's
> definition, then it seems like we shouldn't need /cross/-module
> bookkeeping: we should be able to just tabulate how each use site's
> strictness does/doesn't match the interface's spec.
> --
> Live well,
> ~wren

More information about the ghc-devs mailing list