logo       

Re: Some random newbie questions: msg#00128

lang.haskell.cafe

Subject: Re: Some random newbie questions

> (+) is
> usually strict on both arguments (although in principle it does not
> have to be true because of overloading, which implies that a compiler
> can only optimize particular specializations of sum, not generic sum).

Since you mention it, there was some talk about this in the #haskell channel,
and I wondered why aren't sum and product members of Num with default
instances, just like mconcat is also a member of Data.Monoid.Monoid.
From the docs:

"mconcat :: [a] -> a
Fold a list using the monoid. For most types, the default definition for
mconcat will be used, but the function is included in the class definition so
that an optimized version can be provided for specific types"

J.A.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise