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

Martin Drautzburg Martin.Drautzburg at web.de
Thu Jun 10 13:44:27 EDT 2010

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 

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.


More information about the Haskell-Cafe mailing list