RE: [Haskell] specification of sum
3 Nov
2005
3 Nov
'05
11:24 a.m.
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 course. Cheers, Simon
7602
Age (days ago)
7602
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow