[commit: base] master: More type signature improvements from Bas van Dijk (d073522)
Ian Lynagh
igloo at earth.li
Sat Oct 27 21:57:18 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d073522d5386b73966046ff0b0d1600efb51568c
>---------------------------------------------------------------
commit d073522d5386b73966046ff0b0d1600efb51568c
Author: Ian Lynagh <ian at well-typed.com>
Date: Sat Oct 27 19:30:29 2012 +0100
More type signature improvements from Bas van Dijk
No changes, just using nicer type variable names
>---------------------------------------------------------------
Data/List.hs | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Data/List.hs b/Data/List.hs
index 431ae1b..9d09c0a 100644
--- a/Data/List.hs
+++ b/Data/List.hs
@@ -593,7 +593,7 @@ minimumBy cmp xs = foldl1 minBy xs
-- | The 'genericLength' function is an overloaded version of 'length'. In
-- particular, instead of returning an 'Int', it returns any type which is
-- an instance of 'Num'. It is, however, less efficient than 'length'.
-genericLength :: (Num i) => [b] -> i
+genericLength :: (Num i) => [a] -> i
{-# NOINLINE [1] genericLength #-}
genericLength [] = 0
genericLength (_:l) = 1 + genericLength l
@@ -626,7 +626,7 @@ genericDrop n (_:xs) = genericDrop (n-1) xs
-- | The 'genericSplitAt' function is an overloaded version of 'splitAt', which
-- accepts any 'Integral' value as the position at which to split.
-genericSplitAt :: (Integral i) => i -> [b] -> ([b],[b])
+genericSplitAt :: (Integral i) => i -> [a] -> ([a], [a])
genericSplitAt n xs | n <= 0 = ([],xs)
genericSplitAt _ [] = ([],[])
genericSplitAt n (x:xs) = (x:xs',xs'') where
@@ -634,7 +634,7 @@ genericSplitAt n (x:xs) = (x:xs',xs'') where
-- | The 'genericIndex' function is an overloaded version of '!!', which
-- accepts any 'Integral' value as the index.
-genericIndex :: (Integral a) => [b] -> a -> b
+genericIndex :: (Integral i) => [a] -> i -> a
genericIndex (x:_) 0 = x
genericIndex (_:xs) n
| n > 0 = genericIndex xs (n-1)
More information about the Cvs-libraries
mailing list