diff options
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/ghci/GHCi/RemoteTypes.hs | 5 | ||||
-rw-r--r-- | libraries/ghci/SizedSeq.hs | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libraries/ghci/GHCi/RemoteTypes.hs b/libraries/ghci/GHCi/RemoteTypes.hs index 5bc0136113..3b4dee75c5 100644 --- a/libraries/ghci/GHCi/RemoteTypes.hs +++ b/libraries/ghci/GHCi/RemoteTypes.hs @@ -17,6 +17,7 @@ module GHCi.RemoteTypes , unsafeForeignRefToRemoteRef, finalizeForeignRef ) where +import Control.DeepSeq import Data.Word import Foreign hiding (newForeignPtr) import Foreign.Concurrent @@ -49,6 +50,7 @@ castRemotePtr (RemotePtr a) = RemotePtr a deriving instance Show (RemotePtr a) deriving instance Binary (RemotePtr a) +deriving instance NFData (RemotePtr a) -- ----------------------------------------------------------------------------- -- HValueRef @@ -91,6 +93,9 @@ freeRemoteRef (RemoteRef w) = -- | An HValueRef with a finalizer newtype ForeignRef a = ForeignRef (ForeignPtr ()) +instance NFData (ForeignRef a) where + rnf x = x `seq` () + type ForeignHValue = ForeignRef HValue -- | Create a 'ForeignRef' from a 'RemoteRef'. The finalizer diff --git a/libraries/ghci/SizedSeq.hs b/libraries/ghci/SizedSeq.hs index e5bb37c2f1..503544a9ed 100644 --- a/libraries/ghci/SizedSeq.hs +++ b/libraries/ghci/SizedSeq.hs @@ -8,6 +8,7 @@ module SizedSeq , sizeSS ) where +import Control.DeepSeq import Data.Binary import Data.List import GHC.Generics @@ -26,6 +27,9 @@ instance Traversable SizedSeq where instance Binary a => Binary (SizedSeq a) +instance NFData a => NFData (SizedSeq a) where + rnf (SizedSeq _ xs) = rnf xs + emptySS :: SizedSeq a emptySS = SizedSeq 0 [] |