We allow both programs and functions. Some challenges, mostly kolmogorov-complexity challenges, do not require input. This means that for some challenges you can write a function that takes no input. In many languages this is rather straight forward. For example if a challenge asked you to output 26 python function to do these it would look like this:
lambda:26
In Haskell this is a bit stranger. There are two arguments to be had:
Haskell does not have functions that take no inputs so you must write a complete program. You should write:
main=print 26
Everything in Haskell is a function, input-less functions are just objects. You can just write:
26
and that's a function that takes no args and returns 26.
I don't very much like either of these arguments. The first seems to me to be treating Haskell as if it were Python while the second seems to be arguing that snippets are ok, which I certainly don't believe.
What should be allowed in Haskell for challenges that don't allow input?
Before anyone says, "Why does this even matter? A challenge this simple would be closed anyway." Often these types of challenges have further stipulations for example this answer-chaining question requires each entry only to output a number, but has source restrictions on each answer.
f _=26
which can take any argument and then returns26
. You can call it withf()
, which looks kind of natural for functions one might be used to from other language, but it really isn't the Haskell way ... \$\endgroup\$f _=26
as I wrote in the comment above. \$\endgroup\$_
s all over the place. \$\endgroup\$