[Haskell-cafe] Parse error

Arthur Baars arthurb at cs.uu.nl
Thu Mar 17 15:23:24 EST 2005


You need { } around the declaration of matrix1. Otherwise the semicolon  
at the end of its definition is considered to be part of the 'let':

let { matrix1 = (array ((1,1),(3,3)) [((1,1), 0.0), ((1,2), 0.0),  
((1,3),-2.0), ((2,1), 0.0), ((2,2), 7.0),  ((2,3), 0.0), ((3,1), 0),  
((3,2), 0), ((3,3), -3)])} ;

The layout rule will otherwise add { } as follows:
do { let x = 10 ;
      putStr "hello" ;
    }
-->
do { let { x = 10 ; <empty decl> }
      putStr "hello" ;
    }
which is wrong, because there is no semicolon separating the  
'let'-declaration from the 'putStr' expression.

A solution is to use layout instead of { ; } or write semicolons in  
front of declarations:

do { let x = 10
    ; putStr "hello"
    }
This translates into:
do { let { x = 10 }
    ; putStr "hello"
    }
The semicolon is not part of the 'let' declaration, because it is  
indented less than 'x' .

For more information, see:
http://haskell.org/onlinereport/syntax-iso.html#layout

Hope this helps,

Arthur



On 17-mrt-05, at 20:42, Dmitri Pissarenko wrote:

> Hello!
>
> In the attachment you will find a file, in which I try to access Java  
> from
> Haskell using the Java bridge for functional languages.
>
> For details see
>
> http://sourceforge.net/projects/jvm-bridge/
>
> and
>
> http://dapissarenko.com/resources/2005_02_17_eigenvaluesJava/ 
> 2005_02_17_eigenva
> luesJava.pdf
>
> When I try to compile the attached file using
>
> ghc +RTS -c -RTS -package javavm  -c EigenvalueCalculatorHaskell.hs -o
> EigenvalueCalculatorHaskell.o
>
> I get the error
>
> EigenvalueCalculatorHaskell.hs:28: parse error on input `putStrLn'
>
> Unfortunately, I have not the slightest idea about how to fix/isolate  
> it (I
> already commented out almost the whole code).
>
> Please tell me what I could try to correct the error. I appreciate ANY  
> hint.
>
> Many thanks in advance
>
>
> Dmitri Pissarenko
>
> PS: The source code of the files related to  
> EigenvalueCalculatorHaskell.hs is
> located at
>
> http://dapissarenko.com/resources/2005_02_17_eigenvaluesJava/ 
> 2005_02_17_lik.zip
>
> --
> Dmitri Pissarenko
> Software Engineer
> http://dapissarenko.com
> <EigenvalueCalculatorHaskell.hs>_______________________________________ 
> ________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list