[Haskell-cafe] Help debugging code broken after upgrading debian to GHC 6.12: "invalid argument"

Brandon Simmons brandon.m.simmons at gmail.com
Sat May 15 09:35:01 EDT 2010


> > GHC 6.12's runtime handles input and output encoding, instead of
> > simply truncating Chars; my guess is it's locale-related.  And sure
> > enough, I see several non-ASCII characters in mycology.b98 which are
> > likely to do the wrong thing if the runtime doesn't know which
> > character set to use.
>
> Yup. Converting mycology.b98 to utf-8 makes it run.
> However, why does it run with --quiet on the original file??

That actually makes sense. That mycology Befunge source is actually a
combination of Befunge-98 (which can use non-ascii characters. I'd
forgotten that) and befunge-93 which uses only printable ascii
characters.

Without the --quiet flag, we end up inspecting a Bool value returned
after taking the `length` of a row and a column, which looks to see if
the grid is bigger than 80x25 characters.

I guess with the --quiet flag, we ignore that Bool value and so the
program never has to take the length of a line, and consequently never
sees any of the non-ascii characters (because the source file is
written in such a way that a befunge-93 interpreter will naturally
stop execution after the '93 section of code.

That also explains why simply printing the file string causes the
interpreter to fail, even with --quiet.

Thanks for the help,


More information about the Haskell-Cafe mailing list