-- Copyright 2025 Lennart Augustsson-- See LICENSE file for full license.module Control.DeepSeq.Class(module Control.DeepSeq.Class) whereimport qualified Prelude()import Primitivesimport Data.Boolimport Data.Charimport Data.Eqimport Data.Eitherimport Data.Function--import Data.Int.Intimport Data.Integerimport Data.Integralimport Data.List_Typeimport Data.Maybe_Typeimport Data.Ordimport Data.Ratioimport Data.Tuple--import Data.Word.Wordimport Mhs.Builtin-- NFData class and instances for primitive types.class NFData a where rnf :: a -> () rnf a = seq a ()infixr 0 `deepseq`deepseq :: NFData a => a -> b -> bdeepseq a b = rnf a `seq` binfixr 0 $!!($!!) :: (NFData a) => (a -> b) -> a -> bf $!! x = x `deepseq` f xforce :: (NFData a) => a -> aforce x = x `deepseq` xinstance NFData Intinstance NFData Wordinstance NFData Int64instance NFData Word64instance NFData Doubleinstance NFData Floatinstance NFData Charinstance NFData Boolinstance NFData Orderinginstance NFData ()instance NFData Integer where rnf x = (x == 0) `seq` ()instance NFData a => NFData (Ratio a) where rnf x = rnf (numerator x, denominator x)instance NFData a => NFData (Maybe a) where rnf Nothing = () rnf (Just a) = rnf ainstance NFData a => NFData [a] where rnf [] = () rnf (x:xs) = rnf x `seq` rnf xsinstance (NFData a, NFData b) => NFData (Either a b) where rnf (Left a) = rnf a rnf (Right b) = rnf binstance (NFData a, NFData b) => NFData (a, b) where rnf (a, b) = rnf a `seq` rnf b