{- | A quasiquoter to help with calling R () from ghc. -} module RlangQQ ( -- * the quasiquoter r, ToRVal, -- ** TODO -- $TODO ) where import RlangQQ.Internal import Language.Haskell.TH.Quote {- $TODO [R -> haskell] Currently nothing is done to the output. It should be possible to return the original hs_foo variables in an extensible record, (possibly limited to the case where they have been modified?). ie.if there is a @[r| hs_foo <- \"abc\" |]@, then at the very bottom of the generated R file we should have be calling an R function like @serialize(hs_foo)@. then on the haskell side we have: > return (label foo $ deserialize "hs_foo" `asTypeOf` hs_foo, > label abc $ deserialize "hs_abc" `asTypeOf` hs_abc, > ... ) Where the tuple is an extensible record, and the IO needed to get the result is also sequenced. Variables whose first occurence is an assignment do not need a corresponding variable to be sent into R: > [r| hs_x <- rnorm(5); hs_x <- sum(hs_x) |] [better IPC] perhaps communicating through files is not the best idea. When there are multiple quasi quotes, maybe they should be connecting to the same session. Marshalling other types (Vector, Array, Map etc.). Use 'FromRVal' -}