From the instructions of the “Hello World” exercise of the Haskell track:
The objectives are simple:
- Write a function that returns the string “Hello, World!”.
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.
If everything goes well, you will be ready to fetch your first real exercise.
To complete this exercise, you need to implement the
hello
function.You will find the type signature for
hello
already in place, but it is up to you to define the function.
(emphasis by me)
However, that given signature is hello :: String
and indeed also the test expects a simple String
value. Is such a value considered a function in Haskell? And if so, is the value’s type considered to be the return type of the function?
While I’m aware that functions are first-class values in Haskell, that doesn’t necessarily imply that every value is (considered) a function.
I’m further aware, that in pure lambda calculus, every representable value can be encoded as a function, but that’s just that—an encoding based on a choice of conventions (and only unambiguously decodable if that specific choice of conventions is known, as there are various possible ones), it doesn’t mean that a value actually is (nor is considered do be) the function used to represent it.
If all values are considered functions, the instructions should probably mention that. If values without ->
in their type aren’t considered functions, either the exercise and corresponding test, or the wording of the instructions should be changed for them to be consistent with each other.
(As I don’t know which stance is the “correct” one, I didn’t open an issue or PR on GitHub - exercism/haskell: Exercism exercises in Haskell., yet.)