[Solved] Run multiple commands in invoked program

Hi,
I have coded a program in Haskell using the compiler Hugs and the program requires multiple commands (with parameters) to be entered into it, it then outputs the result of its execution. I need to test a lot of different options (i.e. the parameters) so it would be obvious to automate the process. Using BASH I have managed to invoke the program and pass it a command, but only 1 command is executed and then the program closes.

How do I process sequential commands in the program from the script and then store the output of the execution, and then loop the process to test different parameters?

The program in question is invoked like this, followed by the commands, with the output following the last command:

$ hugs Net.hs
Net> command1 params
Net> command2 params
etc.
Net> lastcommand params
{output is displayed}

Thanks for your help.

EDIT:

I just worked out a solution, for anyone who has this similar problem here is my solution:

echo -e "command 1 params\ncommand2 params" | hugs Net.hs