-----------------------------------------------------------------------------
--
-- Module      :  Language.Javascript.JSaddle.Native
-- Copyright   :  (c) Hamish Mackenzie
-- License     :  MIT
--
-- Maintainer  :  Hamish Mackenzie <Hamish.K.Mackenzie@googlemail.com>
--
-- |
--
-----------------------------------------------------------------------------

module Language.Javascript.JSaddle.Native (
    module Language.Javascript.JSaddle.Native.Internal
  , withToJSVal
) where

import GHCJS.Marshal.Internal (ToJSVal(..))
import Language.Javascript.JSaddle.Types
       (JSM(..), JSValueForSend(..))
import Language.Javascript.JSaddle.Native.Internal

withToJSVal :: ToJSVal val => val -> (JSValueForSend -> JSM a) -> JSM a
withToJSVal :: forall val a.
ToJSVal val =>
val -> (JSValueForSend -> JSM a) -> JSM a
withToJSVal val
val JSValueForSend -> JSM a
f = do
    JSVal
v <- val -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal val
val
    JSVal -> (JSValueForSend -> JSM a) -> JSM a
forall (m :: * -> *) a.
MonadIO m =>
JSVal -> (JSValueForSend -> m a) -> m a
withJSVal JSVal
v JSValueForSend -> JSM a
f