[Haskell-cafe] Re: Memoization

Andrew Coppin andrewcoppin at btinternet.com
Sun May 27 06:17:52 EDT 2007


apfelmus wrote:
> Note that due to parametricity, any function of this type is necessarily
> either id or _|_. In other words, there are only two functions of type
>
>   ∀a∀b. (a->b) -> (a->b)
>
>   

You managed to type ∀  but you couldn't find ⊥ ?

OOC, can anybody tell me what ∀ actually means anyway?

> That's because the functions has to work for all types a and b in the
> same way, i.e. it may not even inspect how the given types a or b look
> like. You need type classes to get a reasonable type for the function
> you want
>
>   memoize :: Memoizable a => (a->b) -> (a->b)
>
>   

Ah... most optimal!



More information about the Haskell-Cafe mailing list