Hi all,
I have a question about optimization of shared values in local definitions. I
frequently use this scheme:
fun a b c d x = r where
q = costly computation depending only on a, b, c, and d
r = depends only on q and x
g1 = fun 1 2 3 4
g2 = fun 5 4 2 7
(etc.)
When I compute (using
On Thu, 2006-05-18 at 11:00 +0200, Alberto Ruiz wrote:
When I compute (using ghc -O) things like
map g1 [1 .. 1000]
the common q is evaluated only once, which is very nice. But the problem
is that in some strange cases this kind of optimization is not applied, and
the same q is
Consider
f x y = let r = expensive x in r+y
g vs = map (f 2) vs
You are expecting (expensive 2) to be computed just once. That is
indeed what will happen if you write
f_opt x = let r = expensive x in \y - r+y
g_opt vs = map (f_opt 2) vs
It's easy enough to
It sort of depends on whether you are a client, a server, or an
intermediary.
HAppS has a wrapper around HaXML designed to make it really easy to
generate XML. My HAppS apps use it to generate XML and then rely on
external XSLT processors to transform that XML to HTML or MIME as
needed.
At Thu, 18 May 2006 02:37:56 -0700,
Juan Carlos Arevalo Baeza wrote:
I'd be worried about the performance you can get from this
breadth-first approach. I sort of like the fine-tuning control that the
try approach gives in parsec. I'll finish the paper before giving this
any more
On Wednesday 17 May 2006 19:55, [EMAIL PROTECTED] wrote:
Daniel McAllansmith wrote:
I'm trying to control the scope within which functions can be used by
putting them in a type class. Unfortunately I can't seem to figure
out how to get it done. Any advice would be much appreciated.
I am trying to write a function 'applyArguments' which takes a function and
a list and recursively uses element each in the list as an argument to the
function. I want to do this for any function taking any number of arguments.
applyArgument f (arg) = f arg
applyArgument f (arg:args) =
You can't do this in Haskell, if you try to type the function
carefully, you'll know the reason.
Shiqi
On 5/18/06, Aditya Siram [EMAIL PROTECTED] wrote:
I am trying to write a function 'applyArguments' which takes a function and
a list and recursively uses element each in the list as an
G'day all.
Quoting Simon Peyton-Jones [EMAIL PROTECTED]:
So the best way to transform f depends on how it is used. When it's
used locally and just once, GHC inlines it at the call site and all is
good. But when it's exported or called many times, GHC never floats a
let *between* two