-- |
-- Module      : Data.Memory.Internal.DeepSeq
-- License     : BSD-style
-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
-- Stability   : experimental
-- Portability : unknown
--
-- Simple abstraction module to allow compilation without deepseq
-- by defining our own NFData class if not compiling with deepseq
-- support.
--
{-# LANGUAGE CPP #-}
module Data.Memory.Internal.DeepSeq
    ( NFData(..)
    ) where

#ifdef WITH_DEEPSEQ_SUPPORT
import Control.DeepSeq
#else
import Data.Word

class NFData a where rnf :: a -> ()

instance NFData Word8 where rnf :: Word8 -> ()
rnf Word8
w = Word8
w Word8 -> () -> ()
forall a b. a -> b -> b
`seq` ()
instance NFData Word16 where rnf :: Word16 -> ()
rnf Word16
w = Word16
w Word16 -> () -> ()
forall a b. a -> b -> b
`seq` ()
instance NFData Word32 where rnf :: Word32 -> ()
rnf Word32
w = Word32
w Word32 -> () -> ()
forall a b. a -> b -> b
`seq` ()
instance NFData Word64 where rnf :: Word64 -> ()
rnf Word64
w = Word64
w Word64 -> () -> ()
forall a b. a -> b -> b
`seq` ()
#endif