
On Wed, Feb 10, 2010 at 09:52:48PM +0100, kane96@gmx.de wrote:
Hi, I want to add an element to a list inside a haskell file: mylist = [1,2,3,4] 0:mylist in Prelude it works fine, but when I do it in a file I get the error: parse error (possibly incorrect indentation) Failed, modules loaded: none. in a line after this two that doesn't exist
A Haskell file is simply a list of declarations, i.e. definitions of data types, classes, and functions. You cannot just have an expression by itself in a Haskell file. You can write expressions at a ghci prompt (which I assume is what you meant) because that is what ghci is for: evaluating expressions. Why do you want 0:mylist by itself in a Haskell file? What is its purpose? Note that it will not modify the value of mylist (indeed, you *cannot* modify the value of mylist once it has been defined). -Brent