[Haskell-cafe] Re: [newbie question] Memoization automatic in Haskell?

apfelmus apfelmus at quantentunnel.de
Sun Jan 13 04:17:54 EST 2008


Luke Palmer wrote:
> David Benbennick wrote:
>
>> It would be nice if I could just tell the compiler "I command you to
>> memoize this function", and have it produce the required code
>> automatically.
> 
> Tru dat!
> 
> But it's not clear what the best way for the compiler writer to do
> that is.  For example, if I know the access patterns of the function,
> I can design the aforementioned data structure to favor those.
> Also, not every type admits memoization, for example functions.

Indeed. There are plenty of choices of data structures for memo "tables" 
and hash tables are not the best of them. Such choices are better left 
to the programmer.


Regards,
apfelmus



More information about the Haskell-Cafe mailing list