[Haskell-cafe] Puzzling instance method definitions in Data.Sequence.Internal

Henning Thielemann lemming at henning-thielemann.de
Tue Mar 2 08:08:30 UTC 2021


On Tue, 2 Mar 2021, Viktor Dukhovni wrote:

> So the intent seems clear, but I don't understand how the instance method
> definitions are valid.  The imports of Both Prelude and Data.Foldable don't
> include `length` or `null`:
>
>   https://github.com/haskell/containers/blob/master/containers/src/Data/Sequence/Internal.hs#L194-L213

It is enough if the method name is imported with qualification. Surprising 
and maybe inconsistent but that's the state of affairs. GHC even forbids 
qualification on the left-hand side of a method definition. This at least 
is consistent with all function definitions.


More information about the Haskell-Cafe mailing list