
12 Mar
2012
12 Mar
'12
3:48 a.m.
Clark Gaebel
In Haskell, what's the canonical way of declaring a top-level array (Data.Vector of a huge list of doubles, in my case)? Performance is key in my case.
The straightforward way would just be something like:
globalArray :: V.Vector Double globalArray = V.fromList [ huge list of doubles ] {-# NOINLINE globalArray #-}
However, I don't want to have to run the fromList at runtime.
I think GHC will convert it to an array (and in general evaluate constants) at compile time (probably requires -O). -k