<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
Dear all,<BR>
<BR>
Today I spend nearly one day's time to debug this exception, but still haven't got a solution. My code is pasted [<A HREF="http://hpaste.org/47460/haskell_array_index_out_of_ran">here</A>][1]. <BR>
The program throws an exception when evaluating this line:<BR>
        points = assert (len &gt; 0) $ A.listArray (1::Int, len) $ map (\(u,i,r) -&gt; [u,i]) rts<BR>
Below is my ghci debug session. I still don't understand why it has a range of (0, -193459561) when the 'len' binding is actually 90570.<BR>
<BR>
        *Main&gt; :break 125<BR>
        Breakpoint 4 activated at SVMCF.hs:125:13-86<BR>
        *Main&gt; :trace main<BR>
        Stopped at SVMCF.hs:125:13-86<BR>
        _result :: UA.Array Int [User] = _<BR>
        len :: Int = 90570<BR>
        rts :: [RTuple] = (1,1,5.0) : (1,2,3.0) : (1,3,4.0) : (1,4,3.0) :<BR>
                                        &nbsp; (1,5,3.0) : ....<BR>
        [SVMCF.hs:125:13-86] *Main&gt; :lis<BR>
        124&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points :: A.Array Int [Int]<BR>
        125&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points = assert (len &gt; 0) $ A.listArray (1::Int, len) $ map (\(u,i,r) -&gt; [u,i]) rts<BR>
        126&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values :: UA.UArray Int Double<BR>
        [SVMCF.hs:125:13-86] *Main&gt; :ste<BR>
        Stopped at SVMCF.hs:125:13-28<BR>
        _result :: UA.Array Int [User] -&gt; UA.Array Int [User] = _<BR>
        len :: Int = 90570<BR>
        [SVMCF.hs:125:13-28] *Main&gt; :ste<BR>
        Stopped at SVMCF.hs:125:21-27<BR>
        _result :: Bool = _<BR>
        len :: Int = 90570<BR>
        [SVMCF.hs:125:21-27] *Main&gt; :ste<BR>
        Stopped at SVMCF.hs:125:32-86<BR>
        _result :: UA.Array Int [User] = _<BR>
        len :: Int = 90570<BR>
        rts :: [RTuple] = (1,1,5.0) : (1,2,3.0) : (1,3,4.0) : (1,4,3.0) :<BR>
                                        &nbsp; (1,5,3.0) : ....<BR>
        [SVMCF.hs:125:32-86] *Main&gt; :ste<BR>
        Stopped at SVMCF.hs:125:32-56<BR>
        _result :: [[User]] -&gt; UA.Array Int [User] = _<BR>
        len :: Int = 90570<BR>
        [SVMCF.hs:125:32-56] *Main&gt; :lis<BR>
        124&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points :: A.Array Int [Int]<BR>
        125&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points = assert (len &gt; 0) $ A.listArray (1::Int, len) $ map (\(u,i,r) -&gt; [u,i]) rts<BR>
        126&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values :: UA.UArray Int Double<BR>
        [SVMCF.hs:125:32-56] *Main&gt; len<BR>
        90570<BR>
        [SVMCF.hs:125:32-56] *Main&gt; :ste<BR>
        Stopped at SVMCF.hs:125:60-86<BR>
        _result :: [[User]] = _<BR>
        rts :: [RTuple] = (1,1,5.0) : (1,2,3.0) : (1,3,4.0) : (1,4,3.0) :<BR>
                                        &nbsp; (1,5,3.0) : ....<BR>
        [SVMCF.hs:125:60-86] *Main&gt; :ste<BR>
        *** Exception: Ix{Int}.index: Index (1) out of range ((1,-193459561))<BR>
<BR>
<BR>
&nbsp; [1]: <A HREF="http://hpaste.org/47460/haskell_array_index_out_of_ran">http://hpaste.org/47460/haskell_array_index_out_of_ran</A>
</BODY>
</HTML>