| Copyright | 2013 (C) Amgen Inc |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Language.R
Contents
Description
Wrappers for low-level R functions.
Synopsis
- data SomeSEXP s = forall a. SomeSEXP !(SEXP s a)
- data SEXP s (a :: SEXPTYPE)
- unSomeSEXP :: SomeSEXP s -> (forall a. SEXP s a -> r) -> r
- typeOf :: SEXP s a -> SEXPTYPE
- cast :: SSEXPTYPE a -> SomeSEXP s -> SEXP s a
- asTypeOf :: SomeSEXP s -> SEXP s a -> SEXP s a
- unsafeCoerce :: SEXP s a -> SEXP s b
- module Foreign.R.Type
- module Language.R.Instance
- module Language.R.Globals
- module Language.R.GC
- module Language.R.Literal
- eval :: MonadR m => SEXP s a -> m (SomeSEXP (Region m))
- eval_ :: MonadR m => SEXP s a -> m ()
- evalEnv :: MonadR m => SEXP s a -> SEXP s 'Env -> m (SomeSEXP (Region m))
- install :: MonadR m => String -> m (SEXP V 'Symbol)
- cancel :: IO ()
- throwR :: MonadR m => SEXP s 'Env -> m a
- throwRMessage :: MonadR m => String -> m a
- parseFile :: FilePath -> (SEXP s 'Expr -> IO a) -> IO a
- parseText :: String -> Bool -> IO (SEXP V 'Expr)
- string :: String -> IO (SEXP V 'Char)
- strings :: String -> IO (SEXP V 'String)
Documentation
A SEXP of unknown form.
Instances
| ToJSON (SomeSEXP s) Source # | |
Defined in Language.R.Debug | |
| Storable (SomeSEXP s) Source # | |
Defined in Foreign.R.Internal Methods alignment :: SomeSEXP s -> Int # peekElemOff :: Ptr (SomeSEXP s) -> Int -> IO (SomeSEXP s) # pokeElemOff :: Ptr (SomeSEXP s) -> Int -> SomeSEXP s -> IO () # peekByteOff :: Ptr b -> Int -> IO (SomeSEXP s) # pokeByteOff :: Ptr b -> Int -> SomeSEXP s -> IO () # | |
| Show (SomeSEXP s) Source # | |
| NFData (SomeSEXP s) Source # | |
Defined in Foreign.R.Internal | |
| PrintR (SomeSEXP s) Source # | |
| Literal (SomeSEXP s) 'Any Source # | |
data SEXP s (a :: SEXPTYPE) Source #
The basic type of all R expressions, classified by the form of the expression, and the memory region in which it has been allocated.
Instances
| ToJSON (SEXP s a) Source # | |
Defined in Language.R.Debug | |
| Storable (SEXP s a) Source # | |
Defined in Foreign.R.Internal | |
| Show (SEXP s a) Source # | |
| NFData (SEXP s a) Source # | |
Defined in Foreign.R.Internal | |
| Eq (SEXP s a) Source # | |
| Ord (SEXP s a) Source # | |
Defined in Foreign.R.Internal | |
| PrintR (SEXP s a) Source # | |
| SingI a => Literal (SEXP s a) a Source # | |
unSomeSEXP :: SomeSEXP s -> (forall a. SEXP s a -> r) -> r Source #
typeOf :: SEXP s a -> SEXPTYPE Source #
Return the "type" tag (aka the form tag) of the given SEXP. This
function is pure because the type of an object does not normally change over
the lifetime of the object.
cast :: SSEXPTYPE a -> SomeSEXP s -> SEXP s a Source #
Cast the type of a SEXP into another type. This function is partial: at
runtime, an error is raised if the source form tag does not match the target
form tag.
asTypeOf :: SomeSEXP s -> SEXP s a -> SEXP s a Source #
Cast form of first argument to that of the second argument.
unsafeCoerce :: SEXP s a -> SEXP s b Source #
Unsafe coercion from one form to another. This is unsafe, in the sense that
using this function improperly could cause code to crash in unpredictable
ways. Contrary to cast, it has no runtime cost since it does not introduce
any dynamic check at runtime.
module Foreign.R.Type
module Language.R.Instance
module Language.R.Globals
module Language.R.GC
module Language.R.Literal
Evaluation
eval :: MonadR m => SEXP s a -> m (SomeSEXP (Region m)) Source #
Evaluate a (sequence of) expression(s) in the global environment.
eval_ :: MonadR m => SEXP s a -> m () Source #
Silent version of eval function that discards it's result.
evalEnv :: MonadR m => SEXP s a -> SEXP s 'Env -> m (SomeSEXP (Region m)) Source #
Evaluate a (sequence of) expression(s) in the given environment, returning the value of the last.
Cancel any ongoing R computation in the current process. After interruption
an RError exception will be raised.
This call is safe to run in any thread. If there is no R computation running, the next computaion will be immediately cancelled. Note that R will only interrupt computations at so-called "safe points" (in particular, not in the middle of a C call).
Exceptions
Throw an R error as an exception.
throwRMessage :: MonadR m => String -> m a Source #
Throw an R exception with specified message.
Deprecated
parseFile :: FilePath -> (SEXP s 'Expr -> IO a) -> IO a Source #
Deprecated: Use [r| parse(file="pathtofile") |] instead.
Parse file and perform some actions on parsed file.
This function uses continuation because this is an easy way to make operations GC-safe.
Arguments
| :: String | Text to parse |
| -> Bool | Whether to annotate the AST with source locations. |
| -> IO (SEXP V 'Expr) |
Deprecated: Use [r| parse(text=...) |] instead.