Re: [Haskell-cafe] Static computation/inlining

2010-10-11 Thread Steve Schafer
On Sun, 10 Oct 2010 18:51:59 -0700, Alexander Solla wrote: >Although the list isn't huge, I would still rather get rid of the >O(2*n) operation of turning it into maps at run-time. I usually handle this as follows: 1) I create my data file in some human-friendly format (such as your list of tup

Re: [Haskell-cafe] Static computation/inlining

2010-10-11 Thread Felipe Lessa
On Sun, Oct 10, 2010 at 10:51 PM, Alexander Solla wrote: > Is there anyway to instruct GHC (and maybe other compilers) to compute these > maps statically? Are GHC and the other compilers smart enough to do it > automatically? Although the list isn't huge, I would still rather get rid of > the O(2*

Re: [Haskell-cafe] Static computation/inlining

2010-10-10 Thread Lennart Augustsson
I would not worry about doing that at runtime. The only reliable way to make sure it happens at compile time that I can think of would be some Template Haskell. (Or some really deep magic with dictionaries.) -- Lennart On Mon, Oct 11, 2010 at 3:51 AM, Alexander Solla wrote: > Hi everybody, > I

[Haskell-cafe] Static computation/inlining

2010-10-10 Thread Alexander Solla
Hi everybody, I'm working on a module that encodes "static" facts about "the real world". For now, I'm working on an ISO 3166 compliant list of countries, country names, and country codes. I've run into a bit of an optimization issue. There is a static bijective correspondence between c