31
The following code:
data HelloWorld = HelloWorld;
instance Show HelloWorld where show _ = "hello world";
hello_world = "hello world"
main = putStr $ show $ (HelloWorld, hello_world)
Prints:
(hello world,"hello world")
I'd like it to print:
(hello world,hello world)
i.e. I want behaviour like the following:
f "hello world" = "hello world"
f HelloWorld = "hello world"
Unfortunately, show does not satisfy this, as:
show "hello world" = "\"hello world\""
Is there a function that works like f that I've described above?