layout problem
Malcolm Wallace
Malcolm.Wallace@cs.york.ac.uk
Thu, 19 Sep 2002 13:49:15 +0100
"Γιώργος Κοσμίδης" <gkosmidis@epsilon7.gr> writes:
> This is the error that I have: ERROR "c:\textanalysis.HS":48 - Syntax
> error in declaration (unexpected `->')
Line 48:
> ________________________putWordStat(Word,WordCount)->IO()
There is a :: missing between the function name and its type.
> ________________________putWordStat::(Word,WordCount)->IO()
The function definition is also missing an = sign:
> ________________________putWordStat(w,wc)
> ________________________do
should be
> ________________________putWordStat(w,wc)=
> ________________________do
Finally, in this whole block:
> ________printFreq wl=do sequence (map putWordStat wl)
> ________________________where
> ________________________putWordStat::(Word,WordCount)->IO()
> ________________________putWordStat(w,wc)=
> ________________________do ...
> ________________________return()
> ________________________wlLength-countWords wl;
the indentation is incorrect. You probably meant to write something
along these lines:
> ________printFreq wl=do sequence (map putWordStat wl)
> ____________________________where
> ______________________________putWordStat::(Word,WordCount)->IO()
> ______________________________putWordStat(w,wc)=
> ________________________________do ...
> ___________________________________return()
> ________________________wlLength-countWords wl;
but even this has two faults. First, a `where' clause can only be
attached to a whole definition, not to a single statement within a
`do'. Second, the final statement of the outer `do' should be a
statement e.g. "return (wlLength-countWords wl)", not a simple value.
Regards,
Malcolm