constants and functions without arguments

Tom Pledger Tom.Pledger@peace.com
Fri, 30 Mar 2001 10:15:00 +1200


Andreas Leitner writes:
 :
 | 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?

Haskell always treats a declaration of the form

    foo = ...

as a pattern binding, not as a function binding.  Sections 4.4.3 and
4.5 of the Haskell 98 report give more details.

So, in that sense, every function in Haskell takes an argument.
There's nothing to prevent you from adding a dummy parameter to turn a
constant (i.e. a simple pattern binding) into a function.  The only
reason I've heard for doing so, is to work around the monomorphism
restriction.

HTH.
Tom