I’ve written a program that reads a Excel file, parses the contents and generates a haskell module. Every cell in the xls has it’s own function in the module. This worked fine.

Now I have a bigger xls. The resulting module Xls.hs contains 30000 lines haskell code (without comment). I created a testprogram test.hs that calculates and prints one cell.

I did ghc --make test.hs and everything works fine.  The generated execuatable is very slow.

I did ghc --make –O2 test.hs. The compilations takes 15 minutes and aborts with   ‘ghc: out of memory’. I’am working on Win 7 64 bits , ghc version = 7.8.3.

 

What can I do to fix this? I do need –O2. I found with smaller xls’s that optimization speeds up the executable dramatically.

Before I start experimenting, does it help to split up the xls .hs in seperate  files? I.e. the cells that refer to other cells and cells that don’t refer to other cells. Or will I still get ‘out of memory’ because the optimization is global?

 

Kees