[Haskell-cafe] Help debugging code broken after upgrading debian to
GHC 6.12: "invalid argument"
Brandon Simmons
brandon.m.simmons at gmail.com
Fri May 14 20:24:57 EDT 2010
I developed my Befunge interpreter that I posted here:
http://coder.bsimmons.name/blog/2010/01/a-befunge-93-interpreter/
...under GHC 6.8 Debian packages, and after revisiting the code, my
interpreter fails on a particular file in a way that is truly baffling
me. I don't even know where to begin. I am certain this code was
working before, because the Befunge source it fails on is in my darcs
test suite:
The error I get is an InvalidArgument IOError. I'm not even sure what
that means.
Here are the imports I'm using in the module in case that makes the
problem with my upgrade obvious:
import System.Environment
import Data.Char
import Control.Arrow (first,second,(&&&),(|||))
import Data.Array.Unboxed
import Control.Monad.State.Strict
import System.Random
import System.IO
import System.IO.Error
If anyone wants to look at my code and help me with this, they can
download the three attached files and run the following:
$> runghc Befunge.hs aturley.bf
$> runghc Befunge.hs --quiet aturley.bf
...which should both print a pretty picture. Now try the file giving
me problems:
$> runghc Befunge.hs --quiet mycology.b98
... which should give correct output (a bunch of line of "GOOD:
blah...."). And finally:
$> runghc Befunge.hs mycology.b98
...which will (for me) simply print: "error processing options:
invalid argument"
The problem seems to have to do with line 427 and the call to
`buildGrid` and the Bool value `wasBig`: while debugging I can print
the array returned on that line, but trying to print the Bool simply
fails with the error.
The other baffling thing is this: if the debugging line 426 is
uncommented, then even running:
$> runghc Befunge.hs --quiet mycology.b98
...will fail. But all we're doing is a call to `putStr`! Why would
that trigger an error?! Maybe there was a bug in my code that was
there before, but wasn't showing its head because something was being
lazier than it is now?
If anyone wants to take the time to help me with this, I would be most
grateful.
SIncerely,
Brandon Simmons
http://coder.bsimmons.name/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Befunge.hs
Type: text/x-haskell
Size: 15795 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100514/9dbc8c43/Befunge-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aturley.bf
Type: application/octet-stream
Size: 311 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100514/9dbc8c43/aturley-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mycology.b98
Type: application/octet-stream
Size: 120197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100514/9dbc8c43/mycology-0001.obj
More information about the Haskell-Cafe
mailing list