From: simonpj@microsoft.com Date: Mon, 18 Oct 2010 13:58:57 +0000 (+0000) Subject: Define SpecConstrAnnotation in GHC.Exts, and import it from there X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=4e7e4530c1157ff21d0bb5c5b69249a4e7ee0f29;p=ghc-base.git 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 --- diff --git a/GHC/Exts.hs b/GHC/Exts.hs index 661f5aa..ea4b8ff 100644 --- a/GHC/Exts.hs +++ b/GHC/Exts.hs @@ -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 ) +