[Haskell-cafe] Global Arrays

Clark Gaebel cgaebel at csclub.uwaterloo.ca
Mon Mar 12 15:42:28 CET 2012


Is there any proof of this? I'm not familiar enough with core to check.

On Mon, Mar 12, 2012 at 3:48 AM, Ketil Malde <ketil at malde.org> wrote:
> Clark Gaebel <cgaebel at csclub.uwaterloo.ca> writes:
>
>> 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
>



More information about the Haskell-Cafe mailing list