From: simonm Date: Tue, 12 May 1998 12:39:07 +0000 (+0000) Subject: [project @ 1998-05-12 12:39:07 by simonm] X-Git-Tag: Approx_2487_patches~708 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=597daaf8016f3f16bc9e9e234125c85a472442f9;p=ghc-hetmet.git [project @ 1998-05-12 12:39:07 by simonm] - add a few SPECIALISE pragmas --- diff --git a/ghc/lib/std/PrelList.lhs b/ghc/lib/std/PrelList.lhs index b03bf92..4f76427 100644 --- a/ghc/lib/std/PrelList.lhs +++ b/ghc/lib/std/PrelList.lhs @@ -290,6 +290,8 @@ lookup key ((x,y):xys) | otherwise = lookup key xys -- sum and product compute the sum or product of a finite list of numbers. +{-# SPECIALISE sum :: [Int] -> Int #-} +{-# SPECIALISE product :: [Int] -> Int #-} sum, product :: (Num a) => [a] -> a #ifdef USE_REPORT_PRELUDE sum = foldl (+) 0 @@ -307,6 +309,8 @@ product l = prod l 1 -- maximum and minimum return the maximum or minimum value from a list, -- which must be non-empty, finite, and of an ordered type. +{-# SPECIALISE maximum :: [Int] -> Int #-} +{-# SPECIALISE minimum :: [Int] -> Int #-} maximum, minimum :: (Ord a) => [a] -> a maximum [] = errorEmptyList "maximum" maximum xs = foldl1 max xs