[clean-list] Layout rule

Pieter Koopman pieter@cs.kun.nl
Tue, 13 Jan 2004 12:34:18 +0100


Hello Matthew,

At 16:09 11-01-2004 +0000, Matthew wrote:
>I am hoping you can help me the the following problem.  Consider the
>following program:
>
>   module test
>
>   import StdEnv
>
>   Start = let f 0 = 0
>               f x = y + 1
>               where y = 1
>           in f 1
>
>This fails to compile and gives the following error messages:
>
>   Parse error [test.icl,8;9,RHS expression]: <expression> expected instead
>   of offside token (end group)
>
>   Parse error [test.icl,8;12,want definitions]: End of file expected
>   instead of f
>
>Have I correctly understood the layout rule?

Yes, you understood the layout rule very well. You have spotted an error in 
the Clean 2.1 compiler. It seems that the error is caused by the let 
expression in combination with where. Fortunately there are plenty ways to 
work around, like

Start = f 1
where
     f 0 = 0
     f x = y+1
     where y = 1

or

Start = let f 0 = 0
             f x = y + 1
             where y = 1
             a = 3
         in f 1

Thank you for reporting this error.

Have fun,

Pieter Koopman


The University of Nijmegen will be named Radboud University Nijmegen as of 
September 1st, 2004