+{-# LANGUAGE MagicHash, UnboxedTuples, DeriveDataTypeable #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : GHC.Exts
Char(..),
Ptr(..), FunPtr(..),
+ -- * The maximum tuple size
+ maxTupleSize,
+
-- * Primitive operations
module GHC.Prim,
shiftL#, shiftRL#, iShiftL#, iShiftRA#, iShiftRL#,
lazy, inline,
-- * Transform comprehensions
- Down(..), groupWith, sortWith, the
+ Down(..), groupWith, sortWith, the,
+
+ -- * Event logging
+ traceEvent,
+
+ -- * SpecConstr annotations
+ SpecConstrAnnotation(..)
) where
import GHC.Prim
import GHC.Base
+import GHC.Magic
import GHC.Word
import GHC.Int
-import GHC.Num
-import GHC.Float
+-- import GHC.Float
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
+maxTupleSize = 62
-- | The 'Down' type allows you to reverse sort order conveniently. A value of type
-- @'Down' a@ contains a value of type @a@ (represented as @'Down' a@).
groupWith f xs = build (\c n -> groupByFB c n (\x y -> f x == f y) (sortWith f xs))
groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst
-groupByFB c n eq xs = groupByFBCore xs
+groupByFB c n eq xs0 = groupByFBCore xs0
where groupByFBCore [] = n
groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs)
where (ys, zs) = span (eq x) xs
+
+-- -----------------------------------------------------------------------------
+-- tracing
+
+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 )
+