
afraid not the given example is too strict, the requirement is to generate the matched portion lazilly, and return the tail (unconsumed portion). In principle the function should be capable of being written to run in constant space which the given example dose not.
From: "Claus Reinke"
To: "john lask" , , Subject: Re: [Haskell-cafe] RE: simple function: stack overflow in hugs vs nonein ghc Date: Mon, 24 Sep 2007 13:05:24 +0100 return (repeat 'a') >>= \ x -> print $ span (const True) x
with hugs you will get a stack error, in ghc it executes in constant space, i.e. indefinitely. In essenece the above example does exactly the same as my ealier code.
this thread might be relevant:
http://www.haskell.org/pipermail/hugs-bugs/2007-June/001815.html http://www.haskell.org/pipermail/hugs-bugs/2007-June/001816.html http://www.haskell.org/pipermail/hugs-bugs/2007-June/001817.html
claus
_________________________________________________________________ Advertisement: Love Footy? Get AFL, NRL, Rugby live scores and video now! http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=819&referral=hotmailtagline&URL=http://sports.ninemsn.com.au