[英]Executing Haskell expressions in GHCI
I am trying out Haskell using Learn You a Haskell and the interactive online environment Try Haskell 我正在尝试使用Learn You a Haskell和交互式在线环境尝试Haskell尝试Haskell
I noticed that the interpreter on the page gives me weird errors when I try to define something or when I use certain functions. 我注意到,当我尝试定义某些内容或使用某些函数时,页面上的解释器给出了奇怪的错误。
For instance: 例如:
λ let nouns = [" hobo "," frog "," pope "]
not an expression: `let nouns = [" hobo "," frog "," pope "]'
or I get a parse error for something as simple as: 或者我得到一个简单的解析错误:
λ :t "hello"
<hint>:1:1: parse error on input `:'
λ
The expressions are taken verbatim from the book. 这些表达是从书中逐字逐句的。
Try Haskell is not full GHCi, since it is a relatively small project and giving you full access can present security risks. 尝试Haskell并不是完整的GHCi,因为它是一个相对较小的项目,并且为您提供完全访问权限可能会带来安全风险。 If you want to try GHC online, check out http://www.fpcomplete.com . 如果您想在线试用GHC,请访问http://www.fpcomplete.com 。
in your .hs file, calling :t will NOT read into the ghci as "has type" : will be read as cons. 在你的.hs文件中,调用:t不会读入ghci作为“has type”:将被视为缺点。 If you want to find out the type of "hello" simply type it into ghci as :t "Hello" 如果你想找出“你好”的类型,只需将其输入为ghci:t“Hello”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.