Commit 686bce8f authored by simonpj@microsoft.com's avatar simonpj@microsoft.com

Define SpecConstrAnnotation in GHC.Exts, and import it from there

  
Reason: avoid having to link the entire ghc package in modules
that use compile-time annotations:
  
       import GHC.Exts( SpecConstrAnnotation )
       {-# ANN type T ForceSpecConstr #-}
  
It's a kind of bug that the package exporting SpecConstrAnnotation
is linked even though it is only needed at compile time, but putting
the data type declaration in GHC.Exts is a simple way to sidestep
the problem
  
See See Note [SpecConstrAnnotation] in SpecConstr
parent bb0e8353
......@@ -44,7 +44,10 @@ module GHC.Exts
Down(..), groupWith, sortWith, the,
-- * Event logging
traceEvent
traceEvent,
-- * SpecConstr annotations
SpecConstrAnnotation(..)
) where
......@@ -60,6 +63,7 @@ import GHC.Ptr
import Data.String
import Data.List
import Foreign.C
import Data.Data
-- XXX This should really be in Data.Tuple, where the definitions are
maxTupleSize :: Int
......@@ -110,3 +114,22 @@ traceEvent :: String -> IO ()
traceEvent msg = do
withCString msg $ \(Ptr p) -> IO $ \s ->
case traceEvent# p s of s' -> (# s', () #)
{- **********************************************************************
* *
* SpecConstr annotation *
* *
********************************************************************** -}
-- Annotating a type with NoSpecConstr will make SpecConstr
-- not specialise for arguments of that type.
-- This data type is defined here, rather than in the SpecConstr module
-- itself, so that importing it doesn't force stupidly linking the
-- entire ghc package at runtime
data SpecConstrAnnotation = NoSpecConstr | ForceSpecConstr
deriving( Data, Typeable, Eq )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment