{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module H.Prelude.Interactive
( module H.Prelude
, PrintR(..)
, p
, printQuote
)
where
import qualified Foreign.R as R
import H.Prelude hiding (withEmbeddedR)
instance MonadR IO where
io = id
data ExecContext IO = ExecContext
getExecContext = return ExecContext
unsafeRunWithExecContext = const
class PrintR a where
printR :: MonadR m => a -> m ()
instance PrintR (SEXP s a) where
printR = io . R.printValue
instance PrintR (R.SomeSEXP s) where
printR s = R.unSomeSEXP s printR
p :: (MonadR m, PrintR a) => m a -> m ()
p = (>>= printR)
{-# DEPRECATED printQuote "Use 'p' instead." #-}
printQuote :: (MonadR m, PrintR a) => m a -> m ()
printQuote = p