{-# LANGUAGE NoImplicitPrelude #-}{-# OPTIONS_HADDOCK not-home #-}------------------------------------------------------------------------------- |-- Module : GHC.Internal.GHCi-- Copyright : (c) The University of Glasgow 2012-- License : see libraries/base/LICENSE---- Maintainer : ghc-devs@haskell.org-- Stability : internal-- Portability : non-portable (GHC Extensions)---- The GHCi Monad lifting interface.---- EXPERIMENTAL! DON'T USE.---- /The API of this module is unstable and not meant to be consumed by the general public./-- If you absolutely must depend on it, make sure to use a tight upper-- bound, e.g., @base < 4.X@ rather than @base < 5@, because the interface can-- change rapidly without much warning.-------------------------------------------------------------------------------moduleGHC.Internal.GHCi (GHCiSandboxIO (..),NoIO ())whereimportGHC.Internal.Base (IO (),Monad ,Functor (fmap ),Applicative (..),(>>=) ,id ,(.) ,ap )-- | A monad that can execute GHCi statements by lifting them out of-- m into the IO monad. (e.g state monads)class(Monad m )=>GHCiSandboxIO m whereghciStepIO ::m a ->IO a -- | @since base-4.4.0.0instanceGHCiSandboxIO IO whereghciStepIO :: forall a. IO a -> IO a
ghciStepIO =IO a -> IO a
forall a. a -> a
id -- | A monad that doesn't allow any IO.newtypeNoIO a =NoIO {forall a. NoIO a -> IO a
noio ::IO a }-- | @since base-4.8.0.0instanceFunctor NoIO wherefmap :: forall a b. (a -> b) -> NoIO a -> NoIO b
fmap a -> b
f (NoIO IO a
a )=IO b -> NoIO b
forall a. IO a -> NoIO a
NoIO ((a -> b) -> IO a -> IO b
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f IO a
a )-- | @since base-4.8.0.0instanceApplicative NoIO wherepure :: forall a. a -> NoIO a
pure a
a =IO a -> NoIO a
forall a. IO a -> NoIO a
NoIO (a -> IO a
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a )<*> :: forall a b. NoIO (a -> b) -> NoIO a -> NoIO b
(<*>) =NoIO (a -> b) -> NoIO a -> NoIO b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap -- | @since base-4.4.0.0instanceMonad NoIO where>>= :: forall a b. NoIO a -> (a -> NoIO b) -> NoIO b
(>>=) NoIO a
k a -> NoIO b
f =IO b -> NoIO b
forall a. IO a -> NoIO a
NoIO (NoIO a -> IO a
forall a. NoIO a -> IO a
noio NoIO a
k IO a -> (a -> IO b) -> IO b
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= NoIO b -> IO b
forall a. NoIO a -> IO a
noio (NoIO b -> IO b) -> (a -> NoIO b) -> a -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> NoIO b
f )-- | @since base-4.4.0.0instanceGHCiSandboxIO NoIO whereghciStepIO :: forall a. NoIO a -> IO a
ghciStepIO =NoIO a -> IO a
forall a. NoIO a -> IO a
noio 

AltStyle によって変換されたページ (->オリジナル) /