Hello Café,
An idea came to me: unless the compiler notices that stuffA and stuffB are
equivalent, would it be correct to suppose that A is better than B?
stuffA x = if someComputationallyExpensiveTest x
then doSomething else doSomethingElse
stuffB x y = if someComputationallyExpensiveTest x
then doSomething y else doSomethingElse y
I explain: in stuffA, the function only depends on x, so when doing:
a = stuffA xxx
runs the expensive test once and for all, and a can directly be bound to
doSomething or doSomethingElse
so calling after:
a foo
a bar
won't run the test
Whereas:
b = stuffB xxx
is valid due to curryfication, but:
b foo
b bar
will both run the expensive test
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe