Re: Question about Data.List

Malcolm Wallace <[email protected]> Tue, 27 May 2003 09:45:18 +0100
Newsgroups gmane.comp.lang.haskell.nhc.user
Organization Dept of Computer Science, University of York
Message-ID <[email protected]>
Matthew Donadio <[email protected]> writes:

> I get an error that identifier "sum" is defined twice.  I assume that
> this is because Data.List reexports the Prelude list functions.  I can
> make the error go away by explicitly using either Prelude.sum or
> Data.List.sum, but shouldn't Data.List.sum shadow Prelude.sum?

Yes, you are right.  There is a fault in the Data.List source code

    #ifndef __HUGS__
    sum = ...
    product = ...
    #endif

should be

    #ifdef __GLASGOW_HASKELL__
    sum = ...
    product = ...
    #endif

to ensure that Prelude.sum is re-exported from Data.List, not re-defined.

Regards,
  Malcolm