Opened 10 years ago

Closed 9 years ago

#2116 closed feature request (duplicate)

ghci should try to read erroneous modules partially

Reported by: j.waldmann Owned by:
Priority: normal Milestone: 6.10 branch
Component: Compiler Version: 6.8.2
Keywords: Cc: claus
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

If ghci (re-)reads a module that contains some error, then it considers the module loading as a complete failure, and at the prompt I get the Prelude environment.

It is understandable that ghci rejects modules with syntax errors, but for syntactically correct modules with type errors I wish that at least the effect of import statements would be visible.

Perhaps even some partial type checking could be done, and declarations that pass this can be executed.

Change History (7)

comment:1 Changed 10 years ago by simonmar

difficulty: Unknown
Resolution: duplicate
Status: newclosed

Thanks for the report, this one will be fixed in 6.8.3. See #2049.

comment:2 Changed 10 years ago by simonmar

Resolution: duplicate
Status: closedreopened

oops, sorry, too trigger-happy there. I mis-read the ticket.

comment:3 Changed 10 years ago by igloo

Milestone: 6.10 branch

This would be nice, but sounds fiddly to do. I'll put it in the 6.10 branch for now, but I expect it will get punted.

comment:4 Changed 10 years ago by claus

Cc: claus added

i don't know whether type errors can be caught locally, without ghci losing its place during load, but if yes, one could try to replace each erroneous definition with calls to error:

f x = x+True

might become

f x = error "No instance for (Num Bool)
arising from a use of `+' at <interactive>:1:10-15
Possible fix: add an instance declaration for (Num Bool)
In the expression: x + True
In the definition of `f': f x = x + True"

while trying to continue loading the rest of the module (which should be marked as partially loaded). does that sound plausible?

comment:5 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 9 years ago by simonmar

Resolution: duplicate
Status: reopenedclosed

See #1341

Note: See TracTickets for help on using tickets.