[Haskell-cafe] How to "Show" an Operation?

Chris BROWN chrisb at cs.st-andrews.ac.uk
Thu Jun 10 14:19:35 EDT 2010

Hi Martin,

Can you not just use trace?


f x = trace "in f " x

g x = trace "in g" x

That should show the order of evaluation.

On 10 Jun 2010, at 18:44, Martin Drautzburg wrote:

> On Thursday, 10. June 2010 00:08:34 Luke Palmer wrote:
>> Or just:
>> apply = val_of
>> So, to summarize:  if you have something that isn't a function and you
>> want to use it like a function, convert it to a function (using
>> another function :-P).  That's all.  No syntax magic, just say what
>> you're doing.
> Thanks Luke
> The reason I was asking is the following: suppose I have some code which uses 
> some functions, and what it primarily does with those functions is CALL them 
> in different orders.
> Now at a later point in time I decide I need to give names to  those functions 
> because at the end I need to print information about the functions which 
> together solved a certain problem. Think of my problem as "In which order do 
> I have to call f,g,h such that (f.g.h) 42 = 42?".
> I don't want to change all places where those functions are called 
> into "apply" style. Therefore I was looking for some idiom like the python 
> __call__() method, which, when present, can turn just about anything into a 
> callable.
> I could change the *definition* of my original functions into "apply" style 
> and the rest of the code would not notice any difference. But that does not 
> really help, because in the end I want to Show something like [g,h,f], but my 
> functions would no longer carry names.
> Alternatively I could associate functions with names in some association 
> function, but that function simply has to "know to much" for my taste.
> The thing is, I only need the names at the very end. Throughout the majority 
> of the computation they should stay out of the way.
> -- 
> Martin
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list