{-# LANGUAGE Unsafe #-}
{-# LANGUAGE MagicHash, UnboxedTuples, DeriveDataTypeable, TypeFamilies, MultiParamTypeClasses, FlexibleInstances #-}
module GHC.Exts
(
Int(..),Word(..),Float(..),Double(..),
Char(..),
Ptr(..), FunPtr(..),
maxTupleSize,
module GHC.Prim,
shiftL#, shiftRL#, iShiftL#, iShiftRA#, iShiftRL#,
uncheckedShiftL64#, uncheckedShiftRL64#,
uncheckedIShiftL64#, uncheckedIShiftRA64#,
isTrue#,
build, augment,
IsString(..),
breakpoint, breakpointCond,
lazy, inline,
Data.Coerce.coerce, Data.Coerce.Coercible,
Down(..), groupWith, sortWith, the,
traceEvent,
SpecConstrAnnotation(..),
currentCallStack,
Constraint,
IsList(..)
) where
import Prelude
import GHC.Prim hiding (coerce, Coercible)
import GHC.Base hiding (coerce, Coercible)
import GHC.Word
import GHC.Int
import GHC.Ptr
import GHC.Stack
import qualified Data.Coerce
import Data.String
import Data.List
import Data.Data
import Data.Ord
import qualified Debug.Trace
maxTupleSize :: Int
maxTupleSize = 62
the :: Eq a => [a] -> a
the (x:xs)
| all (x ==) xs = x
| otherwise = error "GHC.Exts.the: non-identical elements"
the [] = error "GHC.Exts.the: empty list"
sortWith :: Ord b => (a -> b) -> [a] -> [a]
sortWith f = sortBy (\x y -> compare (f x) (f y))
{-# INLINE groupWith #-}
groupWith :: Ord b => (a -> b) -> [a] -> [[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 xs0 = groupByFBCore xs0
where groupByFBCore [] = n
groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs)
where (ys, zs) = span (eq x) xs
traceEvent :: String -> IO ()
traceEvent = Debug.Trace.traceEventIO
{-# DEPRECATED traceEvent "Use 'Debug.Trace.traceEvent' or 'Debug.Trace.traceEventIO'" #-}
data SpecConstrAnnotation = NoSpecConstr | ForceSpecConstr
deriving( Data, Typeable, Eq )
class IsList l where
type Item l
fromList :: [Item l] -> l
fromListN :: Int -> [Item l] -> l
fromListN _ = fromList
toList :: l -> [Item l]
instance IsList [a] where
type (Item [a]) = a
fromList = id
toList = id