Explicitly lift throwIO and throwTo.

This commit is contained in:
Stephen Diehl
2016-07-02 20:11:20 -04:00
parent 2f619f3ebd
commit 245dd5190e
+17 -2
View File
@@ -15,6 +15,8 @@ module Protolude (
unsnoc, unsnoc,
applyN, applyN,
print, print,
throwIO,
throwTo,
show, show,
LText, LText,
@@ -326,12 +328,19 @@ import Control.Monad.ST as X
-- Concurrency and Parallelism -- Concurrency and Parallelism
import Control.Exception as X hiding ( import Control.Exception as X hiding (
throw throw -- Impure throw is forbidden.
, throwIO
, throwTo
, assert , assert
, displayException , displayException
) )
import qualified Control.Exception
import Control.Monad.STM as X import Control.Monad.STM as X
import Control.Concurrent as X import Control.Concurrent as X hiding (
throwTo
)
import Control.Concurrent.Async as X import Control.Concurrent.Async as X
import Foreign.Storable as X (Storable) import Foreign.Storable as X (Storable)
@@ -376,6 +385,12 @@ applyN n f = X.foldr (.) identity (X.replicate n f)
print :: (X.MonadIO m, PBase.Show a) => a -> m () print :: (X.MonadIO m, PBase.Show a) => a -> m ()
print = liftIO . PBase.print print = liftIO . PBase.print
throwIO :: (X.MonadIO m, Exception e) => e -> m a
throwIO = liftIO . Control.Exception.throwIO
throwTo :: (X.MonadIO m, Exception e) => ThreadId -> e -> m ()
throwTo tid e = liftIO (Control.Exception.throwTo tid e)
show :: (Show a, StringConv String b) => a -> b show :: (Show a, StringConv String b) => a -> b
show x = toS (PBase.show x) show x = toS (PBase.show x)
{-# SPECIALIZE show :: Show a => a -> Text #-} {-# SPECIALIZE show :: Show a => a -> Text #-}