[Haskell-cafe] Re: Debugging methods for haskell

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Sat Jul 18 04:57:49 EDT 2009

Henning Thielemann <lemming at henning-thielemann.de> writes:

> On Thu, 16 Jul 2009, Fernan Bolando wrote:
>> Hi all
>> I recently used 2 hours of work looking for a bug that was causing
>> Program error: Prelude.!!: index too large
> A good way to avoid such problems is to avoid partial
> functions at all. (!!) is also inefficient. Is it possible
> to define the function in terms of foldl?

I've looked at the code a bit more, and, with apologies to the original
poster, it doesn't look much like Haskell. For example, in
there's stuff beginning with

   tADM :: Int
   tADM = 1

   tVSRC :: Int
   tVSRC = 2 

   tISRC :: Int
   tISRC = 3


that I think probably should be

   data Something = ADM | VSRC | ISRC ... deriving (Enum, ...)

though when I get to "(((fst z0)!!pMSET)!!pMTYPE) == mOP" I'm at a loss
to determine quite what the intention is. Maybe it should be an array
indexed by enum types, maybe a function, maybe something that can be
pattern matched on? I don't know.

Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk

More information about the Haskell-Cafe mailing list