If you are in the REPL, you want to do `let sumOfElements [] = 0`
If you want multiline input, you open with `:{` and close with `:}`. Both of these need to be on their own line. For example:
Prelude>:{
Prelude| let sum [] = 0
Prelude| sum (x:xs) = x + sum xs
Prelude|:}
As tdinkar points out, it is often easier to define your functions if a file and load that file from the REPL.