From 597daaf8016f3f16bc9e9e234125c85a472442f9 Mon Sep 17 00:00:00 2001 From: simonm Date: Tue, 12 May 1998 12:39:07 +0000 Subject: [PATCH] [project @ 1998-05-12 12:39:07 by simonm] - add a few SPECIALISE pragmas --- ghc/lib/std/PrelList.lhs | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 1.7.10.4