
On Tue, Oct 29, 2002 at 11:20:47AM +0200, George Kosmidis wrote:
I am sure there are a billion errors in this. This is the first one:
Line:17 - Last generator in do {...} must be an expression Can Anyone point the errors and maybe tell me if there is a possibility for this to work?
I strongly recommend getting started with a MUCH simpler function, and starting out with some of the excellent tutorials available on the web. It looks like you are trying to do imperative programing here, rather than functional programming. In fact, it looks like it would be much easier to translate your program into pascal, rather than into haskell. A few errors:
main=do userText<-getText ________getText::IO String
It looks here sort of like you're trying to declare the getText function within main. All declarations are 'top level' in haskell, so this won't work.
________PatientList=[("Robson, Brian",(2,"MJH")), _____________________("Hitchin, Linda",(1,"ILR")), _____________________("Reeve, Paul", (2,"ILR"))]
All functions in haskell start with a lowercase letter (or a punctuation, if it's an inline function), never with capital letter.
________getWards::Int->Int ________getWards PatientList=[Room | (Name,(Room,Dr)) <- PatientList, Room==getText]
This syntax doesn't exist for defining what I think you're intending to be a variable, 'PatientList'.
_________________do putSpc (length Room) _________________return(RoomLength)
do is only used (by beginners anyways, there are other uses, but they're much more advanced) by functions which return an IO monad, which should generally be a small minority of your functions. Almost every time you use 'do' in your program, it is just plain wrong. Basically, you should start out with a single function and a main that prints its result, and work up from there, testing your code each time you add a new function. I recommend starting with the "Gentle Introduction" (http://www.haskell.org/tutorial/). Good luck on your haskelling! -- David Roundy http://civet.berkeley.edu/droundy/