Ticket #1441 (closed feature request: duplicate)

Opened 6 years ago

Last modified 4 years ago

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: Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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

Change History

Changed 6 years ago by igloo

  • milestone set to 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.

Changed 6 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.

Changed 6 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)

Changed 6 years ago by simonmar

  • difficulty changed from Unknown to Easy (1 hr)
  • milestone changed from 6.8 branch to _|_

Changed 5 years ago by PHO

  • cc pho@… added

Changed 5 years ago by Isaac Dupree

  • cc id@… added

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #960

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 4 years ago by simonmar

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