
If I call "main" in ghci, my program runs as it should, but if I try compiling it, and then running the result of that compilation, i.e.: $ ghc -o animal_game game.hs $ ./animal_game unexpected things occur, particularly "getChar" does not work correctly, and if I take a route that doesn't lead to getChar needing to be called, the program stops running at the end of 2nd run despite your response to the do-you-want-to-play-again-question. $ ./animal_game .... Do you want to play again? (y/n) y .... Do you want to play again? (y/n) y Thanks for playing! $ The source code is here: http://rafb.net/p/7fYlEV72.html I don't know how long that will stay up there, so let me know if it's gone and I'll repaste or find a better alternative. What would also be nice is any comments on the actual code; as a begginner, it's nice to get some feedback, and I might as well also ask the following question. Originally I wanted to the types to be as such: data Animal = Animal String data Question a b = Question String a b -- where a is a Question or an Animal, as is b The problem is I wanted methods that had types that were able to accept an argument of type Animal or Question, and for it to act appropriately on that type, I tried adding them to common type classes (a new one I created called 'Askable' which contained a method 'ask'), but I ran into a whole bunch of problems. Is there any easy way to do it?