考虑以下是我的代码
import Data.Char
import Data.List
-- square
square :: Int -> Int
square n = n * n
虽然这个方形函数看起来整洁清晰,但当我运行它时
ghci ./square.hs
它返回
[1 of 1] Compiling Main ( ./LabSheet1-solns.hs, interpreted )
./LabSheet1-solns.hs:5:1:
parse error on input `square'
Failed, modules loaded: none.
我的解释器应该有问题。
我在 OS X 10.8.1 上运行
$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 7.4.2
有什么线索吗?