[Haskell-cafe] Another Question

Navin Rustagi navin_kunta at yahoo.com
Thu Feb 3 08:18:38 CET 2011

hi , 

I am stuck in the following problem. 

I am maintaining  a list of  tuples of the form 
([Char],Int,Int, Int,Int) . The purpose of maintaining the tuples is that the 
program reads from a file line by line , Matches the contents with the first 
element of the tuple and updates the tuple respectively.

The precise function I am using is as follows 

tupup val elf els elr ell elx ys= if val then 
                                          case ys of  'A'  -> (elf, 
                                                      'G'  -> (elf,els, elr 
                                                      'C'  -> (elf,els,elr,  ell 
                                                      'T'  -> (elf,els,elr,ell, 
 elx +1)
                                           else (elf,els,elr,ell,elx)

uptable (xf:xs) main_array = map (\(x,y,z,r,t)-> tupup (x==xf) x y z r t 
(secvalue xs) ) main_array
It gives the error ERROR - Control stack overflow. I assume it is because of the 
lazy evaluation . 
Is there a way to enforce strict evaluation only for the function tupup. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110202/96f96467/attachment.htm>

More information about the Haskell-Cafe mailing list