I'm on my Mac trying out Haskell and to my surprise, when I defined a function, I got an error:
Prelude System.IO> :set prompt "ghci> "
ghci> addMe :: Int -> Int -> Int
<interactive>:11:1: error:
Variable not in scope: addMe :: Int -> Int -> Int
ghci>
How can I define functions on the ghci?
如果要在GHCi中的定义中添加类型签名,则可以按照《 GHC用户指南》中的说明,使用通过:set +m
或:{ ... :}
多行输入,或使用分号来指定它。在:
mulme x y = [x*y| x /= 0, y/= 0]; mulme :: Int -> Int -> [Int]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.