diff options
author | RyanGlScott <ryan.gl.scott@gmail.com> | 2016-02-12 09:24:38 -0500 |
---|---|---|
committer | RyanGlScott <ryan.gl.scott@gmail.com> | 2016-02-12 09:24:49 -0500 |
commit | be3d7f661968a7b8c6751c0be3bf23e703b32c3e (patch) | |
tree | d32fea604192a2c6e6f5a402f79a982f8ee17f32 /libraries/base/GHC/Exts.hs | |
parent | 8da6a162416d448309ced16b00f54a32b5ee750b (diff) | |
download | haskell-be3d7f661968a7b8c6751c0be3bf23e703b32c3e.tar.gz |
Add IsList instance for CallStack, restore Show instance for CallStack
Summary:
Ties up loose ends from D1894.
GHC 7.10.2 and 7.10.3 featured a `Show` instance for `CallStack`, but since it
was derived, it broke encapsulation. This adds a `Show` instance which displays
the `CallStack` as if it were a `[(String, SrcLoc)]`.
To ensure that the output of `Show` is technically a valid Haskell term, we
also add a corresponding `IsList CallStack` instance.
Reviewers: gridaphobe, austin, hvr, bgamari
Reviewed By: gridaphobe, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1903
Diffstat (limited to 'libraries/base/GHC/Exts.hs')
-rwxr-xr-x | libraries/base/GHC/Exts.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs index dc943e068d..31e70ebd21 100755 --- a/libraries/base/GHC/Exts.hs +++ b/libraries/base/GHC/Exts.hs @@ -191,3 +191,12 @@ instance IsList Version where type (Item Version) = Int fromList = makeVersion toList = versionBranch + +-- | Be aware that 'fromList . toList = id' only for unfrozen 'CallStack's, +-- since 'toList' removes frozenness information. +-- +-- @since 4.9.0.0 +instance IsList CallStack where + type (Item CallStack) = (String, SrcLoc) + fromList = fromCallSiteList + toList = getCallStack |