[Haskell-cafe] Expanding do notation
Lennart Augustsson
lennart at augustsson.net
Sun Jan 8 09:45:16 EST 2006
Daniel Fischer wrote:
> Cool. So let's see if I got it.
> If I have
>
> n <- readIO
> ...
> mapM_ (func n) list
> ...
>
> in my programme, the runtime system will/might build object code for
> func n that is then used instead of using the general code for func and
> supplying both arguments to that?
>
> That'd be wow, triple wow!
> And run-time compilation is a fitting name for that.
Well, it's possible to do that. But I don't know of any Haskell
implementation that does. Sure, you might get a little bit of
that if func is defined suitably, like
func 0 = foo
func 1 = bar
func n = baz
Implementations that have the "full laziness" property will handle
one argument at a time to a function, and may do some work with just
one argument to func. But it's nothing like having real run-time code
generation.
-- Lennart
More information about the Haskell-Cafe
mailing list