Misleading strictness annotations in Data.List.NonEmpty

Henning Thielemann lemming at henning-thielemann.de
Fri Jan 8 17:13:31 UTC 2021


On Fri, 8 Jan 2021, Keith wrote:

> Currently:
> 
> head ~(a :| _) = a
> tail ~(_ :| as) = as
> 
> But head and tail are both strict. At best the '~'s have no effect.
> 
> Should I open a PR to change it to
> 
> head (a :| _) = a
> tail (_ :| as) = as
> 
> or maybe even more clearly
> 
> head !(a :l _) = a
> tail !(_ :| as) = as
> 
> ?

The last one would trigger the "redundant bang pattern" warning that is 
going to be implemented/released:
    https://gitlab.haskell.org/ghc/ghc/issues/17340


More information about the Libraries mailing list