Different outputs on a program??? Is it possible?

Derek Elkins ddarius@hotpop.com
Tue, 29 Apr 2003 10:04:36 -0400


On Tue, 29 Apr 2003 15:34:36 +0200
"Alexandre Weffort Thenorio" <alethenorio@home.se> wrote:

> I've made a program that just writes a text file. So the user runs the
> program and it does its job. What I want to do is that when the user
> runs the program with a flag (Lets say -h) it just shows a text file
> on the screen with the program explanation (Or better say help file)
> but otherwise if no flag given the program does it job. The problem is
> that writing the file on haskell is IO[] (I think) and outputting a
> text is IO[String] and then haskell doesn't allow me to have a
> function where it checks if there is flag, creating a text file if not
> or outputting a String if so because they are different types of
> output.
> 
> Can anybody help me here??

[] isn't a type.

Both outputting text and writing to file both have type IO (). (Heck,
they are the same function.)

Have you tried this?  The most straightforward code works.
If you have what errors did you get, what's your code?