Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#1441 closed feature request (duplicate)

Evaluating undefined should return line number and module of location of undefined

Reported by: iampure@… Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.6.1
Keywords: Cc: pho@…, id@…
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

Evaluating undefined should return line number and module of location of undefined when no optimizations are enabled.

Change History (11)

comment:1 Changed 12 years ago by igloo

Milestone: 6.8

The problem is that it's hard to do in a non-adhoc fashion. You can't just define

undefined :: a
undefined = "Undefined in " ++ magicIn ++ " at " ++ magicLocation

as that will just tell you something like "Undefined in undefined at GHC.Base line 15".

You can hack it up with CPP's LINE, but that's a bit nasty.

It would be possible to have a Template Haskell function that you'd use like

foo _ = $mkUndefined

except it doesn't look like we currently have a TH primitive to get the splice lication.

comment:3 Changed 12 years ago by simonmar

We could give undefined the same treatment that assert currently gets, that wouldn't be hard and addresses the original complaint.

comment:4 Changed 12 years ago by SamB

This sounds like John Meacham's "magic underscore" (see the JHC documentation).

Then again, it also reminds me of the Haskell 98 report (see just above undefined's definition)

comment:5 Changed 12 years ago by simonmar

difficulty: UnknownEasy (1 hr)
Milestone: 6.8 branch_|_

comment:6 Changed 11 years ago by PHO

Cc: pho@… added

comment:7 Changed 11 years ago by Isaac Dupree

Cc: id@… added

comment:8 Changed 11 years ago by igloo

Resolution: duplicate
Status: newclosed

Duplicate of #960

comment:9 Changed 11 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:10 Changed 11 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:11 Changed 10 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.