In the following little program, why does the definition of p, and the second
definition of q, work, but the first does not? Do I not understand Haskell,
or is this a feature of ghc?
Van Snyder = [EMAIL PROTECTED]
----------------------------------------------------------------------------
module Main (main) where
main = appendChan stdout ((show p)++"\n") exit d
d = appendChan stdout ((show q)++"\n") exit done
p :: (Integral d) => Array d (Array d d)
p = array (1,2) [1 := array (1,3) [j := j | j <- [1..3]],
2 := p!1 ]
{-
q :: (Integral d) => Array d (Array d d)
q = array (1,2) [1 := array (1,3) [j := j | j <- [1..3]]] ++
[2 := q!1]
-}
q :: (Integral d) => Array d (Array d d)
q = array (1,2) [i := if i == 1 then array(1,3) [j := j | j <- [1..3]]
else q!(i-1) | i <- [1..2]]