Safe Haskell | None |
---|---|
Language | Haskell98 |
Foreign.JavaScript.TH
Synopsis
- newtype JSUint8Array x = JSUint8Array {
- unJSUint8Array :: JSRef x
- newtype JSArray a = JSArray {
- unJSArray :: [a]
- class ToJS x a where
- class FromJS x a where
- newtype WithJSContext x m a = WithJSContext {
- unWithJSContext :: ReaderT JSContextRef m a
- type HasJS' = HasJS (JSCtx_JavaScriptCore ())
- data JSCtx_JavaScriptCore x
- class Monad m => MonadJS x m | m -> x where
- class (Monad m, MonadJSM (JSX m), MonadFix (JSX m), MonadJS x (JSX m)) => HasJS x m | m -> x where
- class IsJSContext x where
- data JSRef x
- data JSFun x = JSFun {
- unJSFun :: JSRef x
- unJSFunction :: Function
- newtype JSFFI = JSFFI String
- newtype JSContextSingleton x = JSContextSingleton {}
- newtype WithJSContextSingleton x m a = WithJSContextSingleton {
- unWithJSContextSingleton :: ReaderT (JSContextSingleton x) m a
- type HasWebView = HasJSContext
- class Monad m => HasJSContext m where
- type JSContextPhantom m :: *
- runWithJSContextSingleton :: WithJSContextSingleton x m a -> JSContextSingleton x -> m a
- withJSContextSingleton :: MonadJSM m => (forall x. JSContextSingleton x -> m r) -> m r
- withJSContextSingletonMono :: MonadJSM m => (JSContextSingleton () -> m r) -> m r
- runWithJSContext :: WithJSContext x m a -> JSContextRef -> m a
- lowerWithJSContext :: MonadJSM m => WithJSContext x IO a -> m a
- liftWithJSContextSingletonThroughWithJSContext :: (HasJSContext m, MonadJSM m, MonadTrans t, Monad m1) => ((t1 -> t m1 a) -> WithJSContext x IO b) -> (t1 -> WithJSContextSingleton (JSContextPhantom m) m1 a) -> m b
- withJSArrayFromList :: (ToJS x a, MonadJS x m) => [a] -> (JSRef x -> m r) -> m r
- importJS :: Safety -> String -> String -> Q Type -> Q [Dec]
- mkJSFFI :: Safety -> String -> Q ([Dec], Exp)
- parseType :: Type -> ([Type], Type)
- data Safety
- = Unsafe
- | Safe
- | Interruptible
Documentation
newtype JSUint8Array x Source #
Constructors
JSUint8Array | |
Fields
|
Instances
ToJS x (JSUint8Array x) Source # | |
Defined in Foreign.JavaScript.TH | |
FromJS x (JSUint8Array x) Source # | |
Defined in Foreign.JavaScript.TH |
Minimal complete definition
Instances
ToJS x Node Source # | |
ToJS x Double Source # | |
ToJS x Int Source # | |
ToJS x Word8 Source # | |
ToJS x Text Source # | |
ToJS x String Source # | |
ToJS x Bool Source # | |
ToJS x (JSUint8Array x) Source # | |
Defined in Foreign.JavaScript.TH | |
ToJS x a => ToJS x (JSArray a) Source # | |
ToJS x (JSRef x) Source # | |
ToJS x (JSFun x) Source # | |
class FromJS x a where Source #
Minimal complete definition
Instances
FromJS x Double Source # | |
FromJS x Int Source # | |
FromJS x Text Source # | |
FromJS x String Source # | |
FromJS x Bool Source # | |
FromJS x () Source # | |
FromJS x (JSUint8Array x) Source # | |
Defined in Foreign.JavaScript.TH | |
FromJS x a => FromJS x (JSArray a) Source # | |
FromJS x (JSRef x) Source # | |
FromJS x a => FromJS x (Maybe a) Source # | |
newtype WithJSContext x m a Source #
Constructors
WithJSContext | |
Fields
|
Instances
type HasJS' = HasJS (JSCtx_JavaScriptCore ()) Source #
data JSCtx_JavaScriptCore x Source #
Instances
class Monad m => MonadJS x m | m -> x where Source #
A Monad that is capable of executing JavaScript
Minimal complete definition
runJS, forkJS, mkJSUndefined, isJSNull, isJSUndefined, fromJSBool, fromJSString, fromJSArray, fromJSUint8Array, fromJSNumber, withJSBool, withJSString, withJSNumber, withJSArray, withJSUint8Array, mkJSFun, freeJSFun, setJSProp, getJSProp, withJSNode
Methods
runJS :: JSFFI -> [JSRef x] -> m (JSRef x) Source #
forkJS :: m () -> m ThreadId Source #
mkJSUndefined :: m (JSRef x) Source #
isJSNull :: JSRef x -> m Bool Source #
isJSUndefined :: JSRef x -> m Bool Source #
fromJSBool :: JSRef x -> m Bool Source #
fromJSString :: JSRef x -> m String Source #
fromJSArray :: JSRef x -> m [JSRef x] Source #
fromJSUint8Array :: JSRef x -> m ByteString Source #
fromJSNumber :: JSRef x -> m Double Source #
withJSBool :: Bool -> (JSRef x -> m r) -> m r Source #
withJSString :: String -> (JSRef x -> m r) -> m r Source #
withJSNumber :: Double -> (JSRef x -> m r) -> m r Source #
withJSArray :: [JSRef x] -> (JSRef x -> m r) -> m r Source #
withJSUint8Array :: ByteString -> (JSUint8Array x -> m r) -> m r Source #
mkJSFun :: ([JSRef x] -> m (JSRef x)) -> m (JSFun x) Source #
Create a JSFun with zero arguments; should be equilvant to `syncCallback AlwaysRetain True` in GHCJS
freeJSFun :: JSFun x -> m () Source #
setJSProp :: String -> JSRef x -> JSRef x -> m () Source #
getJSProp :: String -> JSRef x -> m (JSRef x) Source #
withJSNode :: Node -> (JSRef x -> m r) -> m r Source #
Instances
class (Monad m, MonadJSM (JSX m), MonadFix (JSX m), MonadJS x (JSX m)) => HasJS x m | m -> x where Source #
Minimal complete definition
Instances
class IsJSContext x Source #
Instances
IsJSContext (JSCtx_JavaScriptCore x) Source # | |
Defined in Foreign.JavaScript.TH Associated Types data JSRef (JSCtx_JavaScriptCore x) :: * Source # |
Constructors
JSFun | |
Fields
|
newtype JSContextSingleton x Source #
A singleton type for a given JSContext; we use this to statically guarantee that different JSContexts don't get mixed up
Constructors
JSContextSingleton | |
Fields |
newtype WithJSContextSingleton x m a Source #
Constructors
WithJSContextSingleton | |
Fields
|
Instances
type HasWebView = HasJSContext Source #
class Monad m => HasJSContext m where Source #
Minimal complete definition
Associated Types
type JSContextPhantom m :: * Source #
Methods
askJSContext :: m (JSContextSingleton (JSContextPhantom m)) Source #
Instances
runWithJSContextSingleton :: WithJSContextSingleton x m a -> JSContextSingleton x -> m a Source #
withJSContextSingleton :: MonadJSM m => (forall x. JSContextSingleton x -> m r) -> m r Source #
withJSContextSingletonMono :: MonadJSM m => (JSContextSingleton () -> m r) -> m r Source #
Warning: withJSContextSingletonMono
does not provide the same guarantees that withJSContextSingleton
does.
runWithJSContext :: WithJSContext x m a -> JSContextRef -> m a Source #
lowerWithJSContext :: MonadJSM m => WithJSContext x IO a -> m a Source #
liftWithJSContextSingletonThroughWithJSContext :: (HasJSContext m, MonadJSM m, MonadTrans t, Monad m1) => ((t1 -> t m1 a) -> WithJSContext x IO b) -> (t1 -> WithJSContextSingleton (JSContextPhantom m) m1 a) -> m b Source #
Constructors
Unsafe | |
Safe | |
Interruptible |
Instances
Eq Safety | |
Data Safety | |
Defined in Language.Haskell.TH.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Safety -> c Safety # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Safety # toConstr :: Safety -> Constr # dataTypeOf :: Safety -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Safety) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Safety) # gmapT :: (forall b. Data b => b -> b) -> Safety -> Safety # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r # gmapQ :: (forall d. Data d => d -> u) -> Safety -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Safety -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Safety -> m Safety # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety # | |
Ord Safety | |
Show Safety | |
Generic Safety | |
type Rep Safety | |
Defined in Language.Haskell.TH.Syntax |