Opened 4 years ago

Closed 4 years ago

#11510 closed bug (fixed)

Missing Show instance for GHC.Stack.SrcLoc

Reported by: SimonHengel Owned by:
Priority: high Milestone: 8.0.1
Component: Core Libraries Version: 8.0.1-rc1
Keywords: Cc: gridaphobe, ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1886
Wiki Page:

Description

With GHC 7.10.2 the Show instance was still present and for me it's somewhat inconvenient not to have one.

Change History (7)

comment:1 Changed 4 years ago by bgamari

Cc: gridaphobe ekmett added
Component: CompilerCore Libraries
Milestone: 8.0.1
Priority: normalhigh

We should really make sure something happens on this before 8.0.1.

comment:2 Changed 4 years ago by gridaphobe

I don't have a problem with adding the Show instance for SrcLoc back, I didn't think it would be very useful.

There was also a Show instance for CallStack in 7.10.2, is there a reason to want that? I think not, because the user shouldn't care about the representation. If you want a machine-readable formatting of a CallStack you can use getCallStack stk to get a list of the call-sites, which is then Showable (assuming a Show SrcLoc instance).

comment:3 Changed 4 years ago by gridaphobe

Differential Rev(s): Phab:D1886
Status: newpatch

comment:4 Changed 4 years ago by bgamari

There was also a Show instance for CallStack in 7.10.2, is there a reason to want that? I think not, because the user shouldn't care about the representation. If you want a machine-readable formatting of a CallStack you can use getCallStack stk to get a list of the call-sites, which is then Showable (assuming a Show SrcLoc instance).

I see the argument here but then again I think there is little harm in providing the instance.

comment:5 Changed 4 years ago by Ben Gamari <ben@…>

In 38af3d1/ghc:

Add a derived `Show SrcLoc` instance

Test Plan:
```
ghci> import GHC.Stack
ghci> SrcLoc "f" "b" "c" 1 2 3 4
SrcLoc {srcLocPackage = "f", srcLocModule = "b", srcLocFile = "c",
srcLocStartLine = 1, srcLocStartCol = 2, srcLocEndLine = 3,
srcLocEndCol = 4}
```

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Projects: #ghc

Differential Revision: https://phabricator.haskell.org/D1886

GHC Trac Issues: #11510

comment:6 Changed 4 years ago by thomie

Status: patchmerge

comment:7 Changed 4 years ago by bgamari

Resolution: fixed
Status: mergeclosed

This was merged to ghc-8.0 as bffb7afbde197763b5897b16efb02f5ec4833828.

Note: See TracTickets for help on using tickets.