[Haskell-cafe] Monoid wants a (++) equivalent

Alexander Dunlap alexander.dunlap at gmail.com
Thu Jul 2 12:36:16 EDT 2009


On Wed, Jul 1, 2009 at 11:26 AM, Ross Paterson<ross at soi.city.ac.uk> wrote:
> On Wed, Jul 01, 2009 at 10:55:39AM -0700, Bryan O'Sullivan wrote:
>> Okay, here's a tentative plan that will help to figure out the answer. I'll
>> build a fiddled base package that rewires the Monoid class to have (++) be the
>> binary operator, and mappend as a synonym for it. I'll import the Monoid (++)
>> into the Prelude. I'll see how much breaks. If that much builds smoothly, I'll
>> see how much of the rest of Hackage builds, both with and without this custom
>> base package. I'll follow up here with the results, along with a suggestion of
>> how acceptable I think the observed level of breakage is.
>
> Generalizing (++) will break some Haskell 98 code, e.g.
>
>  append = (++)
>
> I think that's a show-stopper.
> _______________________________________________

Could we use some default rules to keep H98 code working? I don't know
much about defaulting, but

times = (*)

works fine and defaults to type Integer. Could we not do the same
thing with monoids, having monoids default to type []?

Alex


More information about the Haskell-Cafe mailing list