Overlapping and incoherent instances

Johan Tibell johan.tibell at gmail.com
Tue Jul 29 10:02:19 UTC 2014


On Tue, Jul 29, 2014 at 11:50 AM, Herbert Valerio Riedel <hvr at gnu.org> wrote:
> On 2014-07-29 at 11:29:45 +0200, Niklas Hambüchen wrote:
>>> instance {-# OVERLAPPABLE #-} Show a => Show [a] where …
>>
>> Is the syntax somewhat flexible in where the pragma can be placed?
>> For example, some might prefer
>>
>>   {-# OVERLAPPING #-}
>>   instance Show [Char] where …
>
> This variant may also be more convenient in cases where you need to
> CPP-guard that pragma, as it's on a separate line.

Agreed, and if we remove the old pragma (even with a deprecation
cycle) you'll see quite a few of those as many library authors try to
have their libraries compile with the last 3 major GHC versions.

P.S. For e.g. INLINABLE we require that you mention the function name
next to the pragma (which means that you can e.g. put the pragma after
the declaration). What's the rationale to not require

{-# OVERLAPPING Show [Char] #-}

here? Perhaps it's too annoying to have to repeat the types?


More information about the Glasgow-haskell-users mailing list