diff options
Diffstat (limited to 'libraries/base/GHC/IO/Exception.hs')
-rw-r--r-- | libraries/base/GHC/IO/Exception.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs index 69d2c330c9..a8d63d3b28 100644 --- a/libraries/base/GHC/IO/Exception.hs +++ b/libraries/base/GHC/IO/Exception.hs @@ -24,6 +24,8 @@ module GHC.IO.Exception ( Deadlock(..), AllocationLimitExceeded(..), allocationLimitExceeded, AssertionFailed(..), + CompactionFailed(..), + cannotCompactFunction, cannotCompactPinned, cannotCompactMutable, SomeAsyncException(..), asyncExceptionToException, asyncExceptionFromException, @@ -127,6 +129,35 @@ allocationLimitExceeded = toException AllocationLimitExceeded ----- +-- |Compaction found an object that cannot be compacted. Functions +-- cannot be compacted, nor can mutable objects or pinned objects. +-- See 'Data.Compact.compact'. +-- +-- @since 4.10.0.0 +data CompactionFailed = CompactionFailed String + +-- | @since 4.10.0.0 +instance Exception CompactionFailed where + +-- | @since 4.10.0.0 +instance Show CompactionFailed where + showsPrec _ (CompactionFailed why) = + showString ("compaction failed: " ++ why) + +cannotCompactFunction :: SomeException -- for the RTS +cannotCompactFunction = + toException (CompactionFailed "cannot compact functions") + +cannotCompactPinned :: SomeException -- for the RTS +cannotCompactPinned = + toException (CompactionFailed "cannot compact pinned objects") + +cannotCompactMutable :: SomeException -- for the RTS +cannotCompactMutable = + toException (CompactionFailed "cannot compact mutable objects") + +----- + -- |'assert' was applied to 'False'. newtype AssertionFailed = AssertionFailed String |