summaryrefslogtreecommitdiff
path: root/libraries/ghc-prim
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-10-02 15:50:34 +0200
committerBen Gamari <ben@smart-cactus.org>2015-10-02 16:34:21 +0200
commit74424346415f4e3a4d888236b3eb993f8aef4c6b (patch)
treee1320e90891c2118c0d8792c18d8febca8f8c76b /libraries/ghc-prim
parent953940850f7f2aaf53d91e882a3216bfcf30c8f5 (diff)
downloadhaskell-74424346415f4e3a4d888236b3eb993f8aef4c6b.tar.gz
Move CallStack back to base
CallStack requires tuples, instances of which are defined in GHC.Tuple. Unfortunately the change made in D757 to the `Typeable` deriving mechanism means that `GHC.Tuple` must import `GHC.Types` for types necessary to generate type representations. This results in a cycle. Test Plan: Validate Reviewers: gridaphobe, austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1298
Diffstat (limited to 'libraries/ghc-prim')
-rw-r--r--libraries/ghc-prim/GHC/Types.hs51
1 files changed, 1 insertions, 50 deletions
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index 6dcd5f1a7f..294f15e6e4 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -29,8 +29,7 @@ module GHC.Types (
isTrue#,
SPEC(..),
Nat, Symbol,
- Coercible,
- SrcLoc(..), CallStack(..)
+ Coercible
) where
import GHC.Prim
@@ -309,51 +308,3 @@ you're reading this in 2023 then things went wrong). See #8326.
-- Libraries can specify this by using 'SPEC' data type to inform which
-- loops should be aggressively specialized.
data SPEC = SPEC | SPEC2
-
--- | A single location in the source code.
---
--- @since 4.8.2.0
-data SrcLoc = SrcLoc
- { srcLocPackage :: [Char]
- , srcLocModule :: [Char]
- , srcLocFile :: [Char]
- , srcLocStartLine :: Int
- , srcLocStartCol :: Int
- , srcLocEndLine :: Int
- , srcLocEndCol :: Int
- }
-
-----------------------------------------------------------------------
--- Explicit call-stacks built via ImplicitParams
-----------------------------------------------------------------------
-
--- | @CallStack@s are an alternate method of obtaining the call stack at a given
--- point in the program.
---
--- When an implicit-parameter of type @CallStack@ occurs in a program, GHC will
--- solve it with the current location. If another @CallStack@ implicit-parameter
--- is in-scope (e.g. as a function argument), the new location will be appended
--- to the one in-scope, creating an explicit call-stack. For example,
---
--- @
--- myerror :: (?loc :: CallStack) => String -> a
--- myerror msg = error (msg ++ "\n" ++ showCallStack ?loc)
--- @
--- ghci> myerror "die"
--- *** Exception: die
--- CallStack:
--- ?loc, called at MyError.hs:7:51 in main:MyError
--- myerror, called at <interactive>:2:1 in interactive:Ghci1
---
--- @CallStack@s do not interact with the RTS and do not require compilation with
--- @-prof@. On the other hand, as they are built up explicitly using
--- implicit-parameters, they will generally not contain as much information as
--- the simulated call-stacks maintained by the RTS.
---
--- A @CallStack@ is a @[(String, SrcLoc)]@. The @String@ is the name of
--- function that was called, the 'SrcLoc' is the call-site. The list is
--- ordered with the most recently called function at the head.
---
--- @since 4.8.2.0
-data CallStack = CallStack { getCallStack :: [([Char], SrcLoc)] }
- -- See Note [Overview of implicit CallStacks]