[Haskell-cafe] Unwrapping long lines in text files

Felipe Lessa felipe.lessa at gmail.com
Sat Aug 14 09:17:52 EDT 2010

On Sat, Aug 14, 2010 at 9:59 AM, Bill Atkins <watkins at alum.rpi.edu> wrote:
>  | otherwise                                        = let (line, rest) = splitAt maxLineLength line in
>                                                                 line : wrapLine rest

I haven't tested myself, but does this work at all?  If I am reading
it correctly, this is the same as

  let (foo, rest) = splitAt maxLineLength foo
  in foo : wrapLine rest

In other words, no mention of wrapLine's argument 'line', and a
recursive call that will bottom out and be the same as 'undefined' :).
 GHC would warn you, though, if you used -Wall.  That expression
should read:

  let (thisLine, rest) = splitAt maxLineLength line
  in thisLine : wrapLine rest



More information about the Haskell-Cafe mailing list