[Haskell] specification of sum

Simon Marlow simonmar at microsoft.com
Thu Nov 3 06:24:01 EST 2005

On 02 November 2005 17:06, Scherrer, Chad wrote:

>> Surely not... sum is defined by Haskell 98 as:
>>  sum = foldl (+) 0
>> and this is exactly what GHC provides.  Furthermore we have
>> specialised strict versions for Int and Integer.
> I'd been using ghci for testing along the way and getting terrible
> results; does the specialization only apply to ghc per se? 

Yes, you need 'ghc -O' to get the optimised versions.  The performance
characteristics of unoptimised (including interpreted) code are often
quite different.  You can load the optimised module into GHCi, of


More information about the Haskell mailing list