I wrote 2 different source files.When I compile the code compiler gave an error message "conflicting types for bar".if,I write entire program in 1 file , it works.
It's because you have to put the prototypes before the definitions of the functions. Also, you should use .cpps to store the code/stuff, and the .hs to store protoypes/other declarations.