[Haskell] whereis the lazyness ?

Fred Nicolier f.nicolier at iut-troyes.univ-reims.fr
Fri Dec 3 07:21:28 EST 2004


I'am a little bit confused by the following error messages :

\begin{code}
import Array
type SignalOf = Array Int

funcSignal :: (Num a, Num b) => (Int, Int) -> (a -> b) -> SignalOf b
funcSignal b f = listArray b [f (fromIntegral k) | k <- range b]

instance (Num a) => Num (SignalOf a) where
    fromInteger k = funcSignal (minB, maxB) (const i)
        where minB = (minBound :: Int) + 1
              maxB = (maxBound :: Int) - 1
              i = fromInteger k
\end{code}

When testing on ghci -> 
*Main> let x = 1::SignalOf Int
Loading package haskell98 ... linking ... done.
*Main> bounds x
zsh: segmentation fault (core dumped)  ghci infArray.hs

Is it not possible to define a really huge array ?

Fred




More information about the Haskell mailing list