[Haskell-cafe] Some random newbie questions

Jorge Adriano Aires jadrian at mat.uc.pt
Sun Jan 9 17:57:23 EST 2005


> (+) 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.


More information about the Haskell-Cafe mailing list