It does work. I just ran that code and got
~ % ghci Hello.hs
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( Hello.hs, interpreted )
Ok, modules loaded: Main.
*Main> test1
8
*Main>
In other words, make sure you don't have any tab characters (\t
) in your code!