summaryrefslogtreecommitdiff
path: root/compiler/simplStg
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-09-12 14:54:30 -0400
committerBen Gamari <ben@smart-cactus.org>2016-09-15 09:19:50 -0400
commit626db8f82e734e48eef5ce7676a5233f98fe7145 (patch)
treeddbb493a24e2565b4f756c6c8ef97a832c4e0bee /compiler/simplStg
parent912384535d2ac7452d3bcda34cdee238e30600c9 (diff)
downloadhaskell-626db8f82e734e48eef5ce7676a5233f98fe7145.tar.gz
Unify CallStack handling in ghc
Here we introduce compatibility wrappers for HasCallStack constraints. This is necessary as we must support GHC 7.10.1 which lacks sane call stack support. We also introduce another constraint synonym, HasDebugCallStack, which only provides a call stack when DEBUG is set.
Diffstat (limited to 'compiler/simplStg')
-rw-r--r--compiler/simplStg/RepType.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/simplStg/RepType.hs b/compiler/simplStg/RepType.hs
index ca8438eec1..6309aecb3a 100644
--- a/compiler/simplStg/RepType.hs
+++ b/compiler/simplStg/RepType.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE FlexibleContexts #-}
module RepType
( -- * Code generator views onto Types
@@ -332,14 +333,14 @@ fitsIn ty1 ty2
********************************************************************** -}
-- | Discovers the primitive representation of a more abstract 'UnaryType'
-typePrimRep :: UnaryType -> PrimRep
+typePrimRep :: HasDebugCallStack => UnaryType -> PrimRep
typePrimRep ty = kindPrimRep (text "kindRep ty" <+> ppr ty $$ ppr (typeKind ty))
(typeKind ty)
-- | Find the runtime representation of a 'TyCon'. Defined here to
-- avoid module loops. Do not call this on unboxed tuples or sums,
-- because they don't /have/ a runtime representation
-tyConPrimRep :: TyCon -> PrimRep
+tyConPrimRep :: HasDebugCallStack => TyCon -> PrimRep
tyConPrimRep tc
= ASSERT2( not (isUnboxedTupleTyCon tc), ppr tc )
ASSERT2( not (isUnboxedSumTyCon tc), ppr tc )
@@ -350,7 +351,7 @@ tyConPrimRep tc
-- | Take a kind (of shape @TYPE rr@) and produce the 'PrimRep'
-- of values of types of this kind.
-kindPrimRep :: SDoc -> Kind -> PrimRep
+kindPrimRep :: HasDebugCallStack => SDoc -> Kind -> PrimRep
kindPrimRep doc ki
| Just ki' <- coreViewOneStarKind ki
= kindPrimRep doc ki'