constants and functions without arguments

Andreas Leitner
Thu, 29 Mar 2001 18:54:01 +0200


I hope this is the right forum to post my question to.

Given a lazy pure functional language do we need to differntiate (in
syntax) between constants and functions without agruments? And if we
don't need to, does Haskell make a difference?

In a language with eager evaluation (let's take SML) we must
differentiat. Given we have a function that takes one argument of type
int, is different than a function that takes unit->int. Because of
that in SML, whenever I have a function (say "h") that takes an int,
and I want to apply a function (without arguments), let's call it g)
on it I need to add "()" at the end.
h g()
but for any constant i of type int I write:
h i
Now, this leads to my question: In a lazy language do I need to write
those "()", or could the compiler tell the difference and always do
the correct thing?

many thanks in advance,