{-# LANGUAGE CPP #-}
module Control.Monad.Interleave
( MonadInterleave(..)
) where
import qualified Control.Monad.ST as Strict (ST)
import qualified Control.Monad.ST.Lazy as Lazy (ST)
import System.IO.Unsafe
#if MIN_VERSION_base(4, 4, 0)
import qualified Control.Monad.ST.Lazy.Unsafe as Lazy (unsafeInterleaveST)
import qualified Control.Monad.ST.Unsafe as Strict (unsafeInterleaveST)
#else
import qualified Control.Monad.ST as Strict (unsafeInterleaveST)
import qualified Control.Monad.ST.Lazy as Lazy (unsafeInterleaveST)
#endif
class Monad m => MonadInterleave m where
unsafeInterleave :: m a -> m a
instance MonadInterleave IO where
{-# INLINE unsafeInterleave #-}
unsafeInterleave :: forall a. IO a -> IO a
unsafeInterleave = forall a. IO a -> IO a
unsafeInterleaveIO
instance MonadInterleave (Strict.ST s) where
{-# INLINE unsafeInterleave #-}
unsafeInterleave :: forall a. ST s a -> ST s a
unsafeInterleave = forall s a. ST s a -> ST s a
Strict.unsafeInterleaveST
instance MonadInterleave (Lazy.ST s) where
{-# INLINE unsafeInterleave #-}
unsafeInterleave :: forall a. ST s a -> ST s a
unsafeInterleave = forall s a. ST s a -> ST s a
Lazy.unsafeInterleaveST