Hi there folks, I'm trying to learn some functional programming in Haskell, well, at the College, but they don't teach anything, lol, so I have a very simple question about type creation.
This is a new type that contains the int and the new infinity number
data NatInf = Infinity | Num Int
At this point every seems to be ok, but when I load the file in Hugs, and then write
Num 5 (or Infinity)
the following error appears:
ERROR – Cannot find "show" function for:
*** Expression : Num 5
*** Of type: : NatInf
Surely I have to create a new show function, but I don't know where or how write this. It must be easy but hard to learn for myself, so if any of you can explain me this it would be great, thank you and greetings!