{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_HADDOCK hide #-}
module GHC.GHCi {-# WARNING "This is an unstable interface." #-} (
GHCiSandboxIO(..), NoIO()
) where
import GHC.Base (IO(), Monad, Functor(fmap), Applicative(..), (>>=), id, (.), ap)
class (Monad m) => GHCiSandboxIO m where
ghciStepIO :: m a -> IO a
instance GHCiSandboxIO IO where
ghciStepIO = id
newtype NoIO a = NoIO { noio :: IO a }
instance Functor NoIO where
fmap f (NoIO a) = NoIO (fmap f a)
instance Applicative NoIO where
pure a = NoIO (pure a)
(<*>) = ap
instance Monad NoIO where
(>>=) k f = NoIO (noio k >>= noio . f)
instance GHCiSandboxIO NoIO where
ghciStepIO = noio