Hi,

In Hugs 1.4 (July 1997), the List module in the standard library
has a mistake in genericTake.  It always gives an error.
The problem is that the code looks like...

genericTake             :: (Integral a) => a -> [b] -> [b]
genericTake _ []         = []
genericTake n (x:xs) 
   | n > 0               = x : genericTake (n-1) xs
   | otherwise           = error "List.genericTake: negative argument"

However, it should be as follows, note the first case.

genericTake             :: (Integral a) => a -> [b] -> [b]
genericTake 0 _          = []
genericTake _ []         = []
genericTake n (x:xs) 
   | n > 0               = x : genericTake (n-1) xs
   | otherwise           = error "List.genericTake: negative argument"

        Gary Leavens
        229 Atanasoff Hall, Department of Computer Science
        Iowa State Univ., Ames, Iowa 50011-1040 USA
        [EMAIL PROTECTED]  phone: +1 515 294-1580 fax: +1 515 294-0258
        URL: http://www.cs.iastate.edu/~leavens/homepage.html

Reply via email to