Opened 11 years ago

Closed 7 years ago

Last modified 6 years ago

#125 closed feature request (fixed)

GHCi Usability

Reported by: nobody Owned by: nobody
Priority: lowest Milestone: 6.8.1
Component: None Version: None
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo)

About GHCi

I find that Haskell interpreter is rather difficult to use:
1."f=3" is a legal statement in Haskell, i.e. define "f" as 
a 
   constant function, but a parse error occurs.
  "let f=3" is illegal, "let" and "in" are used together, but
   it works in GHCi. 
2. if I happen to print out an infinite list, I don't know how 
   to interrupt it, when press Ctrl+C, GHCi just quit.
3. I can't use "import" to import modules. There are 
many sub 
   directories in the imports directory, but I don't know 
how to 
   import libraries in concurrent, win32, util, lang and 
objectio

Change History (7)

comment:1 Changed 11 years ago by wthaller

  • Summary changed from GHCi Problems to GHCi Usability
Logged In: YES 
user_id=566359

Moved from Bugs to Feature Requests.
Mr. Nobody obviously expected to be able to...
*) use "import" in GHCi. It might be a bit more obvious than
:l and :m.
*) Write things like 'f = 3' instead of 'let f = 3'. Again,
it would be just slightly more obvious to beginners.

Low priority because people should Read The Fine Manual anyway.

And while we're at it, what about
*) data type declarations
*) foreign import
at the GHCi prompt?


comment:2 Changed 11 years ago by haeleth

Logged In: YES 
user_id=187756

Regarding 1, this is the case because the GHCi prompt 
behaves as a `do' clause in the IO monad.  This can be 
demonstrated by the fact that the syntax for opening a file is 
`hfile <- openFile "foo.txt" ReadMode', rather than 
`openFile "foo.txt" ReadMode >>= \hfile -> do'.  Hence

(a) you cannot type `import' because this is only valid at the 
start of a module;

(b) you must type `let x = n' rather than `x = n', and `in' is 
not required, because this is the `do' syntax.

I'm not sure if this is made explicit in the manual, but it might 
be an idea to make it so if it isn't.

comment:3 Changed 7 years ago by igloo

  • Architecture set to Unknown
  • Description modified (diff)
  • Difficulty set to Unknown
  • Milestone set to 6.8
  • Operating System set to Unknown

comment:4 Changed 7 years ago by simonmar

  • Resolution changed from None to fixed
  • Status changed from assigned to closed

I made it so you can say import M at the prompt; it has the same effect as :module +M. I think we can close this bug now.

comment:5 Changed 6 years ago by igloo

  • Milestone changed from 6.8 branch to 6.8.1

comment:6 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:7 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.