[Haskell-cafe] Unwrapping long lines in text files
Bill Atkins
watkins at alum.rpi.edu
Sat Aug 14 09:31:30 EDT 2010
Oof, that's what I get for making "just one little change" without testing.
You're right.
On Saturday Aug 14, 2010, at 9:17 AM, Felipe Lessa wrote:
> 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
>
> Cheers,
>
> --
> Felipe.
More information about the Haskell-Cafe
mailing list