Re: Data.List.partition on infinite lists

2004-11-01 Thread Iavor S. Diatchki
hi, the foldr definition can be fixed by putting a ~ on the pattern in 'select'. -iavor Remi Turk wrote: On Sun, Oct 31, 2004 at 06:37:20PM +0100, Lemming wrote: I encountered that the implementation of 'partition' in GHC 6.2.1 fails on infinite lists: partition :: (a -> Bool) -> [a] -> ([a

Re: Data.List.partition on infinite lists

2004-10-31 Thread Remi Turk
On Sun, Oct 31, 2004 at 06:37:20PM +0100, Lemming wrote: > I encountered that the implementation of 'partition' in GHC 6.2.1 fails > on infinite lists: > > >partition :: (a -> Bool) -> [a] -> ([a],[a]) > >partition p xs = foldr (select p) ([],[]) xs > > >select p x (ts,fs) | p x = (x:ts,fs)