Warn when [] is used with NonEmpty and OverloadedLists
Motivation
Consider this code:
{-# LANGUAGE OverloadedLists #-}
import Data.List.NonEmpty
badNE :: NonEmpty a
badNE = []
badNE
will be bottom at runtime, despite a lack of warnings at compile time.
Proposal
When the OverloadedLists
extension is enabled, and []
is used in the code somewhere that a NonEmpty
is expected, a warning should be generated. This is similar to how we currently generate a -Woverflowed-literals
warning when a negative numeric literal is used somewhere that a Natural
is expected.