-- | Intended for unqualified import:
--
-- > import Codec.Compression.SnappyC.Internal.Util

module Codec.Compression.SnappyC.Internal.Util
  ( -- * Exceptions
    throwLeft
  ) where

import Control.Exception

-- | If a 'Left' is given, throw the contained value as an exception.
throwLeft :: Exception e => Either e a -> a
throwLeft :: forall e a. Exception e => Either e a -> a
throwLeft (Left e
err) = e -> a
forall a e. Exception e => e -> a
throw e
err
throwLeft (Right a
x)  = a
x