<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Filipe, Bill<br><br>Your corrected version works, while the original didn't, but it still produces incorrect<br>output:<br><br>However mean your life is, meet it and live it: do not shun it and call <br>it hard names. Cultivate poverty like a garden herb, like sage. Do not t<br>rouble yourself much to get new things, whether clothes or friends. Thin<br>gs do not change, we change. Sell your clothes and keep your thoughts. G<br>od will see that you do want society.<br>Men have become the tools of their tools.<br>I know of no more encouraging fact than the unquestioned ability of a ma<br>n to elevate his life by conscious endeavor.<br>I once had a sparrow alight upon my shoulder for a moment, while I was h<br>oeing in a village garden, and I felt that I was more distinguished by t<br>hat circumstance that I should have been by any epaulet I could have
 wor<br>n.<br>-Thoreau<br><br>I don't want to break lines in the middle of words and I want to retain the original structure of the text with respect to blank lines between individual quotes. THe only thing in the input text that should change are the lines longer than 72 characters, and they should be reformatted to one or more lines less than or equal to 72 characters.<br><br>Michael<br><br>--- On <b>Sat, 8/14/10, Felipe Lessa <i>&lt;felipe.lessa@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Felipe Lessa &lt;felipe.lessa@gmail.com&gt;<br>Subject: Re: [Haskell-cafe] Unwrapping long lines in text files<br>To: "Bill Atkins" &lt;watkins@alum.rpi.edu&gt;<br>Cc: "michael rice" &lt;nowgate@yahoo.com&gt;, haskell-cafe@haskell.org<br>Date: Saturday, August 14, 2010, 9:17 AM<br><br><div class="plainMail">On Sat, Aug 14, 2010 at 9:59 AM, Bill Atkins &lt;<a
 ymailto="mailto:watkins@alum.rpi.edu" href="/mc/compose?to=watkins@alum.rpi.edu">watkins@alum.rpi.edu</a>&gt; wrote:<br>&gt; &nbsp;| otherwise &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= let (line, rest) = splitAt maxLineLength line in<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; line : wrapLine rest<br><br>I haven't tested myself, but does this work at all?&nbsp; If I am reading<br>it correctly, this is the same as<br><br>&nbsp; let (foo, rest) = splitAt maxLineLength foo<br>&nbsp; in foo : wrapLine rest<br><br>In other words, no mention of wrapLine's argument 'line', and a<br>recursive call that will bottom out and be the same as 'undefined' :).<br> GHC would warn you,
 though, if you used -Wall.&nbsp; That expression<br>should read:<br><br>&nbsp; let (thisLine, rest) = splitAt maxLineLength line<br>&nbsp; in thisLine : wrapLine rest<br><br>Cheers,<br><br>-- <br>Felipe.<br></div></blockquote></td></tr></table><br>