i should have mentioned that Prelude.span is less strict, so:

span p l = span' p l id
 where
 span' p []     = \c->c ([],[])
span' p xs@(x:xs') | p x = span' p xs' . (\c (a,b)->c (x:a,b))
    | otherwise = \c->c ([],xs)

-- Prelude.span fails, span succeeds
test1 span = span (/=' ') $ replicate 1000000 'a' ++ [' ']
test2 span = span (/=' ') $ take 1000000 (cycle "abc") ++ [' ']

-- Prelude.span succeeds, span fails
test3 span = take 1000000 $ fst $ span (/=' ') $ repeat 'a'

claus

_______________________________________________
Hugs-Bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/hugs-bugs

Reply via email to