简体   繁体   中英

Executing Haskell expressions in GHCI

I am trying out Haskell using Learn You a Haskell and the interactive online environment Try 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. If you want to try GHC online, check out http://www.fpcomplete.com .

in your .hs file, calling :t will NOT read into the ghci as "has type" : will be read as cons. If you want to find out the type of "hello" simply type it into ghci as :t "Hello"

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM