lazy :: a -> a
lazy x = x
--- SLPJ: this was transferred from the TH branch
--- and I've forgotten what it was for... so I'll
--- comment it back out for now. It conflicts with
--- 'assert' in GHC.Prim
-- Assertion function. This simply ignores its boolean argument.
-- The compiler may rewrite it to (assertError line)
--- assert :: Bool -> a -> a
--- assert pred r = r
+-- SLPJ: in 5.04 etc 'assert' is in GHC.Prim,
+-- but from Template Haskell onwards it's simply
+-- defined here in Base.lhs
+assert :: Bool -> a -> a
+assert pred r = r
-- constant function
const :: a -> b -> a
#endif
\end{code}
+%*********************************************************
+%* *
+\subsection{@getTag@}
+%* *
+%*********************************************************
+
+Returns the 'tag' of a constructor application; this function is used
+by the deriving code for Eq, Ord and Enum.
+
+The primitive dataToTag# requires an evaluated constructor application
+as its argument, so we provide getTag as a wrapper that performs the
+evaluation before calling dataToTag#. We could have dataToTag#
+evaluate its argument, but we prefer to do it this way because (a)
+dataToTag# can be an inline primop if it doesn't need to do any
+evaluation, and (b) we want to expose the evaluation to the
+simplifier, because it might be possible to eliminate the evaluation
+in the case when the argument is already known to be evaluated.
+
+\begin{code}
+{-# INLINE getTag #-}
+getTag :: a -> Int#
+getTag x = x `seq` dataToTag# x
+\end{code}
%*********************************************************
%* *