on master help sign in
Remove INLINEs for faster jsaddle-dom compilation
commitd023035f4f27826eefb30f00bbdd2d02e7f051f0 authorHamish Mackenzie <Hamish.K.Mackenzie@googlemail.com> dateFri 3 Jun 2016, 21:58 (10 years ago) parent0fa0910
9 files changed−128
src/Language/Javascript/JSaddle/Arguments.hs−7 src/Language/Javascript/JSaddle/Classes.hs−2 src/Language/Javascript/JSaddle/Evaluate.hs−3 src/Language/Javascript/JSaddle/Monad.hs−5 src/Language/Javascript/JSaddle/Native.hs−1 src/Language/Javascript/JSaddle/Object.hs−51 src/Language/Javascript/JSaddle/Properties.hs−8 src/Language/Javascript/JSaddle/String.hs−2 src/Language/Javascript/JSaddle/Value.hs−49
src/Language/Javascript/JSaddle/Arguments.hs−7
@@ -28,18 +28,15 @@ class MakeArgs this where
2828
2929instance MakeArgs arg => MakeArgs (JSM arg) where
3030 makeArgs arg = arg >>= makeArgs
31− {-# INLINE makeArgs #-}
3231
3332instance ToJSVal arg => MakeArgs [arg] where
3433 makeArgs = mapM toJSVal
35− {-# INLINE makeArgs #-}
3634
3735instance (ToJSVal arg1, ToJSVal arg2) => MakeArgs (arg1, arg2) where
3836 makeArgs (arg1, arg2) = do
3937 rarg1 <- toJSVal arg1
4038 rarg2 <- toJSVal arg2
4139 return [rarg1, rarg2]
42− {-# INLINE makeArgs #-}
4340
4441instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3) => MakeArgs (arg1, arg2, arg3) where
4542 makeArgs (arg1, arg2, arg3) = do
@@ -47,7 +44,6 @@ instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3) => MakeArgs (arg1, arg2, arg
4744 rarg2 <- toJSVal arg2
4845 rarg3 <- toJSVal arg3
4946 return [rarg1, rarg2, rarg3]
50− {-# INLINE makeArgs #-}
5147
5248instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4) => MakeArgs (arg1, arg2, arg3, arg4) where
5349 makeArgs (arg1, arg2, arg3, arg4) = do
@@ -56,7 +52,6 @@ instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4) => MakeArgs (a
5652 rarg3 <- toJSVal arg3
5753 rarg4 <- toJSVal arg4
5854 return [rarg1, rarg2, rarg3, rarg4]
59− {-# INLINE makeArgs #-}
6055
6156instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5) => MakeArgs (arg1, arg2, arg3, arg4, arg5) where
6257 makeArgs (arg1, arg2, arg3, arg4, arg5) = do
@@ -66,7 +61,6 @@ instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5)
6661 rarg4 <- toJSVal arg4
6762 rarg5 <- toJSVal arg5
6863 return [rarg1, rarg2, rarg3, rarg4, rarg5]
69− {-# INLINE makeArgs #-}
7064
7165
7266instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5, ToJSVal arg6) => MakeArgs (arg1, arg2, arg3, arg4, arg5, arg6) where
@@ -78,5 +72,4 @@ instance (ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5,
7872 rarg5 <- toJSVal arg5
7973 rarg6 <- toJSVal arg6
8074 return [rarg1, rarg2, rarg3, rarg4, rarg5, rarg6]
81− {-# INLINE makeArgs #-}
8275
src/Language/Javascript/JSaddle/Classes.hs−2
@@ -38,10 +38,8 @@ class MakeObject this where
3838
3939instance ToJSVal Object where
4040 toJSVal (Object r) = return r
41− {-# INLINE toJSVal #-}
4241
4342-- | If we already have a Object we are fine
4443instance MakeObject Object where
4544 makeObject = return
46− {-# INLINE makeObject #-}
4745
src/Language/Javascript/JSaddle/Evaluate.hs−3
@@ -63,7 +63,6 @@ evaluateScript :: (ToJSString script, MakeObject this, ToJSString url)
6363 -> JSM JSVal
6464#ifdef ghcjs_HOST_OS
6565evaluateScript script this url line = liftIO $ js_eval (toJSString script)
66−{-# INLINE evaluateScript #-}
6766foreign import javascript unsafe "$r = eval($1);"
6867 js_eval :: JSString -> IO JSVal
6968#else
@@ -76,7 +75,6 @@ evaluateScript script this url line = do
7675 withJSString (toJSString url) $ \url' ->
7776 rethrow $ liftIO . jsevaluatescript gctxt script' this' url' line
7877 makeNewJSVal result
79−{-# INLINE evaluateScript #-}
8078#endif
8179
8280-- | Evaluates a script (like eval in java script)
@@ -87,4 +85,3 @@ eval :: ToJSString script
8785 => script -- ^ JavaScript to evaluate
8886 -> JSM JSVal
8987eval script = evaluateScript script nullObject nullJSString 1
90−{-# INLINE eval #-}
src/Language/Javascript/JSaddle/Monad.hs−5
@@ -87,7 +87,6 @@ catch :: (MonadIO m, E.Exception e)
8787t `catch` c = do
8888 r <- ask
8989 liftIO (runReaderT t r `E.catch` \e -> runReaderT (c e) r)
90−{-# INLINE catch #-}
9190
9291-- | Wrapped version of 'E.bracket' that runs in a MonadIO that works
9392-- a bit better with 'JSM'
@@ -98,7 +97,6 @@ bracket aquire release f = do
9897 (runReaderT aquire r)
9998 (\x -> runReaderT (release x) r)
10099 (\x -> runReaderT (f x) r)
101−{-# INLINE bracket #-}
102100
103101-- | Handle JavaScriptCore functions that take a MutableJSArray in order
104102-- to throw exceptions.
@@ -132,7 +130,6 @@ runJSaddle webView f = do
132130 withForeignPtr gctxt $ \ptr ->
133131 runReaderT f (castPtr ptr)
134132#endif
135−{-# INLINE runJSaddle #-}
136133
137134postGUIAsyncJS :: JSM () -> JSM ()
138135#ifdef ghcjs_HOST_OS
@@ -142,7 +139,6 @@ postGUIAsyncJS f = do
142139 r <- ask
143140 liftIO . postGUIAsync $ runReaderT f r
144141#endif
145−{-# INLINE postGUIAsyncJS #-}
146142
147143postGUISyncJS :: JSM a -> JSM a
148144#ifdef ghcjs_HOST_OS
@@ -152,5 +148,4 @@ postGUISyncJS f = do
152148 r <- ask
153149 liftIO . postGUISync $ runReaderT f r
154150#endif
155−{-# INLINE postGUISyncJS #-}
156151
src/Language/Javascript/JSaddle/Native.hs−1
@@ -97,6 +97,5 @@ withToJSVal :: ToJSVal val => val -> (JSValueRef -> JSM a) -> JSM a
9797withToJSVal val f = do
9898 v <- toJSVal val
9999 withJSVal v f
100−{-# INLINE withToJSVal #-}
101100#endif
102101
src/Language/Javascript/JSaddle/Object.hs−51
@@ -155,7 +155,6 @@ import Data.Text (Text)
155155-- as it returns something we can make into a Object.
156156instance MakeObject v => MakeObject (JSM v) where
157157 makeObject v = v >>= makeObject
158− {-# INLINE makeObject #-}
159158
160159-- | Lookup a property based on its name.
161160--
@@ -172,7 +171,6 @@ this ! name = do
172171 rethrow $ objGetPropertyByName rthis rname
173172 where
174173 rname = toJSString name
175−{-# INLINE (!) #-}
176174
177175-- | Lookup a property based on its index.
178176--
@@ -187,7 +185,6 @@ this ! name = do
187185this !! index = do
188186 rthis <- makeObject this
189187 rethrow $ objGetPropertyAtIndex rthis index
190−{-# INLINE (!!) #-}
191188
192189-- | Makes a getter for a particular property name.
193190--
@@ -201,7 +198,6 @@ js :: (MakeObject s, ToJSString name)
201198 => name -- ^ Name of the property to find
202199 -> IndexPreservingGetter s (JSM JSVal)
203200js name = to (!name)
204−{-# INLINE js #-}
205201
206202-- | Makes a setter for a particular property name.
207203--
@@ -216,7 +212,6 @@ jss :: (ToJSString name, ToJSVal val)
216212 -> val
217213 -> forall o . MakeObject o => IndexPreservingGetter o (JSM ())
218214jss name val = to (\o -> o <# name $ val)
219−{-# INLINE jss #-}
220215
221216-- | Handy way to call a function
222217--
@@ -226,7 +221,6 @@ jss name val = to (\o -> o <# name $ val)
226221-- 6
227222jsf :: (ToJSString name, MakeArgs args) => name -> args -> JSF
228223jsf name args = to (\o -> o # name $ args)
229−{-# INLINE jsf #-}
230224
231225-- | Java script function applications have this type
232226type JSF = forall o . MakeObject o => IndexPreservingGetter o (JSM JSVal)
@@ -239,7 +233,6 @@ type JSF = forall o . MakeObject o => IndexPreservingGetter o (JSM JSVal)
239233-- hello world
240234js0 :: (ToJSString name) => name -> JSF
241235js0 name = jsf name ()
242−{-# INLINE js0 #-}
243236
244237-- | Handy way to call a function that expects one argument
245238--
@@ -249,32 +242,27 @@ js0 name = jsf name ()
249242-- 6
250243js1 :: (ToJSString name, ToJSVal a0) => name -> a0 -> JSF
251244js1 name a0 = jsf name [a0]
252−{-# INLINE js1 #-}
253245
254246-- | Handy way to call a function that expects two arguments
255247js2 :: (ToJSString name, ToJSVal a0, ToJSVal a1) => name -> a0 -> a1 -> JSF
256248js2 name a0 a1 = jsf name (a0, a1)
257−{-# INLINE js2 #-}
258249
259250-- | Handy way to call a function that expects three arguments
260251js3 :: (ToJSString name, ToJSVal a0, ToJSVal a1, ToJSVal a2)
261252 => name -> a0 -> a1 -> a2 -> JSF
262253js3 name a0 a1 a2 = jsf name (a0, a1, a2)
263−{-# INLINE js3 #-}
264254
265255-- | Handy way to call a function that expects four arguments
266256js4 :: (ToJSString name, ToJSVal a0, ToJSVal a1, ToJSVal a2,
267257 ToJSVal a3)
268258 => name -> a0 -> a1 -> a2 -> a3 -> JSF
269259js4 name a0 a1 a2 a3 = jsf name (a0, a1, a2, a3)
270−{-# INLINE js4 #-}
271260
272261-- | Handy way to call a function that expects five arguments
273262js5 :: (ToJSString name, ToJSVal a0, ToJSVal a1, ToJSVal a2,
274263 ToJSVal a3, ToJSVal a4)
275264 => name -> a0 -> a1 -> a2 -> a3 -> a4 -> JSF
276265js5 name a0 a1 a2 a3 a4 = jsf name (a0, a1, a2, a3, a4)
277−{-# INLINE js5 #-}
278266
279267
280268-- | Handy way to get and hold onto a reference top level javascript
@@ -289,7 +277,6 @@ js5 name a0 a1 a2 a3 a4 = jsf name (a0, a1, a2, a3, a4)
289277-- undefined
290278jsg :: ToJSString a => a -> JSM JSVal
291279jsg name = global ! name
292−{-# INLINE jsg #-}
293280
294281-- | Handy way to call a function
295282--
@@ -301,7 +288,6 @@ jsg name = global ! name
301288-- 5
302289jsgf :: (ToJSString name, MakeArgs args) => name -> args -> JSM JSVal
303290jsgf name = global # name
304−{-# INLINE jsgf #-}
305291
306292-- | Handy way to call a function that expects no arguments
307293--
@@ -311,7 +297,6 @@ jsgf name = global # name
311297-- TypeError:...undefined...is not an objec...
312298jsg0 :: (ToJSString name) => name -> JSM JSVal
313299jsg0 name = jsgf name ()
314−{-# INLINE jsg0 #-}
315300
316301-- | Handy way to call a function that expects one argument
317302--
@@ -321,32 +306,27 @@ jsg0 name = jsgf name ()
321306-- 5
322307jsg1 :: (ToJSString name, ToJSVal a0) => name -> a0 -> JSM JSVal
323308jsg1 name a0 = jsgf name [a0]
324−{-# INLINE jsg1 #-}
325309
326310-- | Handy way to call a function that expects two arguments
327311jsg2 :: (ToJSString name, ToJSVal a0, ToJSVal a1) => name -> a0 -> a1 -> JSM JSVal
328312jsg2 name a0 a1 = jsgf name (a0, a1)
329−{-# INLINE jsg2 #-}
330313
331314-- | Handy way to call a function that expects three arguments
332315jsg3 :: (ToJSString name, ToJSVal a0, ToJSVal a1, ToJSVal a2)
333316 => name -> a0 -> a1 -> a2 -> JSM JSVal
334317jsg3 name a0 a1 a2 = jsgf name (a0, a1, a2)
335−{-# INLINE jsg3 #-}
336318
337319-- | Handy way to call a function that expects four arguments
338320jsg4 :: (ToJSString name, ToJSVal a0, ToJSVal a1, ToJSVal a2,
339321 ToJSVal a3)
340322 => name -> a0 -> a1 -> a2 -> a3 -> JSM JSVal
341323jsg4 name a0 a1 a2 a3 = jsgf name (a0, a1, a2, a3)
342−{-# INLINE jsg4 #-}
343324
344325-- | Handy way to call a function that expects five arguments
345326jsg5 :: (ToJSString name, ToJSVal a0, ToJSVal a1, ToJSVal a2,
346327 ToJSVal a3, ToJSVal a4)
347328 => name -> a0 -> a1 -> a2 -> a3 -> a4 -> JSM JSVal
348329jsg5 name a0 a1 a2 a3 a4 = jsgf name (a0, a1, a2, a3, a4)
349−{-# INLINE jsg5 #-}
350330
351331-- | Call a JavaScript function
352332--
@@ -362,7 +342,6 @@ infixr 2 #
362342 f <- rethrow $ objGetPropertyByName rthis name
363343 f' <- valToObject f
364344 rethrow $ objCallAsFunction f' rthis args
365−{-# INLINE (#) #-}
366345
367346-- | Call a JavaScript function
368347--
@@ -378,7 +357,6 @@ infixr 2 ##
378357 f <- rethrow $ objGetPropertyAtIndex rthis index
379358 f' <- valToObject f
380359 rethrow $ objCallAsFunction f' rthis args
381−{-# INLINE (##) #-}
382360
383361-- | Set a JavaScript property
384362--
@@ -395,7 +373,6 @@ infixr 1 <#
395373(<#) this name val = do
396374 rthis <- makeObject this
397375 rethrow $ objSetPropertyByName rthis name val 0
398−{-# INLINE (<#) #-}
399376
400377-- | Set a JavaScript property
401378--
@@ -412,7 +389,6 @@ infixr 1 <##
412389(<##) this index val = do
413390 rthis <- makeObject this
414391 rethrow $ objSetPropertyAtIndex rthis index val
415−{-# INLINE (<##) #-}
416392
417393-- | Use this to create a new JavaScript object
418394--
@@ -428,7 +404,6 @@ new :: (MakeObject constructor, MakeArgs args)
428404new constructor args = do
429405 f <- makeObject constructor
430406 rethrow $ objCallAsConstructor f args
431−{-# INLINE new #-}
432407
433408-- | Call function with a given @this@. In most cases you should use '#'.
434409--
@@ -442,7 +417,6 @@ call f this args = do
442417 rfunction <- makeObject f
443418 rthis <- makeObject this
444419 rethrow $ objCallAsFunction rfunction rthis args
445−{-# INLINE call #-}
446420
447421-- | Make an empty object using the default constuctor
448422--
@@ -458,7 +432,6 @@ obj = do
458432 gctxt <- ask
459433 Object <$> (liftIO (jsobjectmake gctxt nullPtr nullPtr) >>= makeNewJSVal)
460434#endif
461−{-# INLINE obj #-}
462435
463436-- | Type used for Haskell functions called from JavaScript.
464437type JSCallAsFunction = JSVal -- ^ Function object
@@ -482,7 +455,6 @@ type JSCallAsFunction = JSVal -- ^ Function object
482455-- undefined
483456fun :: JSCallAsFunction -> JSCallAsFunction
484457fun = id
485−{-# INLINE fun #-}
486458
487459#ifdef ghcjs_HOST_OS
488460type HaskellCallback = Callback (JSVal -> JSVal -> IO ())
@@ -538,20 +510,17 @@ freeFunction (Function callback _) = liftIO $
538510
539511instance ToJSVal Function where
540512 toJSVal (Function _ f) = toJSVal f
541− {-# INLINE toJSVal #-}
542513
543514-- | A callback to Haskell can be used as a JavaScript value. This will create
544515-- an anonymous JavaScript function object. Use 'function' to create one with
545516-- a name.
546517instance ToJSVal JSCallAsFunction where
547518 toJSVal f = functionObject <$> function nullJSString f >>= toJSVal
548− {-# INLINE toJSVal #-}
549519
550520instance MakeArgs JSCallAsFunction where
551521 makeArgs f = do
552522 rarg <- functionObject <$> function nullJSString f >>= toJSVal
553523 return [rarg]
554− {-# INLINE makeArgs #-}
555524
556525makeArray :: MakeArgs args => args -> MutableJSArray -> JSM Object
557526#ifdef ghcjs_HOST_OS
@@ -568,7 +537,6 @@ makeArray args exceptions = do
568537 jsobjectmakearray gctxt (fromIntegral len) ptr exceptions
569538 Object <$> makeNewJSVal result
570539#endif
571−{-# INLINE makeArray #-}
572540
573541-- | Make an JavaScript array from a list of values
574542--
@@ -586,45 +554,35 @@ array = rethrow . makeArray
586554-- Make an array out of various lists
587555instance ToJSVal [JSVal] where
588556 toJSVal = toJSVal . array
589− {-# INLINE toJSVal #-}
590557
591558instance ToJSVal [JSM JSVal] where
592559 toJSVal = toJSVal . array
593− {-# INLINE toJSVal #-}
594560
595561instance ToJSVal [Double] where
596562 toJSVal = toJSVal . array
597− {-# INLINE toJSVal #-}
598563
599564instance ToJSVal [Float] where
600565 toJSVal = toJSVal . array
601− {-# INLINE toJSVal #-}
602566
603567instance ToJSVal [Int] where
604568 toJSVal = toJSVal . array
605− {-# INLINE toJSVal #-}
606569
607570instance ToJSVal [JSString] where
608571 toJSVal = toJSVal . array
609− {-# INLINE toJSVal #-}
610572
611573instance ToJSVal [String] where
612574 toJSVal = toJSVal . array
613− {-# INLINE toJSVal #-}
614575
615576instance ToJSVal [Text] where
616577 toJSVal = toJSVal . array
617− {-# INLINE toJSVal #-}
618578
619579instance ToJSVal [Bool] where
620580 toJSVal = toJSVal . array
621− {-# INLINE toJSVal #-}
622581
623582-- | JavaScript's global object
624583global :: JSM Object
625584#ifdef ghcjs_HOST_OS
626585global = liftIO js_window
627−{-# INLINE global #-}
628586foreign import javascript unsafe "$r = window"
629587 js_window :: IO Object
630588#else
@@ -632,7 +590,6 @@ global = do
632590 gctxt <- ask
633591 result <- liftIO $ jscontextgetglobalobject gctxt
634592 Object <$> makeNewJSVal result
635−{-# INLINE global #-}
636593#endif
637594
638595-- | Get an array containing the property names present on a given object
@@ -643,36 +600,30 @@ copyPropertyNames this = do
643600 this' <- makeObject this
644601 withObject this' $ \rthis ->
645602 liftIO $ jsobjectcopypropertynames gctxt rthis
646−{-# INLINE copyPropertyNames #-}
647603
648604-- | Get the number of names in a property name array
649605propertyNamesCount :: MonadIO m => JSPropertyNameArray -> m CSize
650606propertyNamesCount names = liftIO $ jspropertynamearraygetcount names
651−{-# INLINE propertyNamesCount #-}
652607
653608-- | Get a name out of a property name array
654609propertyNamesAt :: MonadIO m => JSPropertyNameArray -> CSize -> m JSString
655610propertyNamesAt names index = liftIO $ jspropertynamearraygetnameatindex names index >>= makeNewJSString
656−{-# INLINE propertyNamesAt #-}
657611
658612-- | Convert property array to a list
659613propertyNamesList :: MonadIO m => JSPropertyNameArray -> m [JSString]
660614propertyNamesList names = do
661615 count <- propertyNamesCount names
662616 mapM (propertyNamesAt names) $ enumFromTo 0 (count - 1)
663−{-# INLINE propertyNamesList #-}
664617#endif
665618
666619-- | Get a list containing the property names present on a given object
667620propertyNames :: MakeObject this => this -> JSM [JSString]
668621#ifdef ghcjs_HOST_OS
669622propertyNames this = makeObject this >>= liftIO . js_propertyNames >>= liftIO . (fmap (map pFromJSVal)) . Array.toListIO
670−{-# INLINE propertyNames #-}
671623foreign import javascript unsafe "$r = []; h$forIn($1, function(n){$r.push(n);})"
672624 js_propertyNames :: Object -> IO JSArray
673625#else
674626propertyNames this = copyPropertyNames this >>= propertyNamesList
675−{-# INLINE propertyNames #-}
676627#endif
677628
678629-- | Get a list containing references to all the properties present on a given object
@@ -690,7 +641,6 @@ objCallAsFunction :: MakeArgs args
690641objCallAsFunction f this args exceptions = do
691642 rargs <- makeArgs args >>= liftIO . Array.fromListIO
692643 liftIO $ js_apply f this rargs exceptions
693−{-# INLINE objCallAsFunction #-}
694644foreign import javascript unsafe "try { $r = $1.apply($2, $3) } catch(e) { $4[0] = e }"
695645 js_apply :: Object -> Object -> MutableJSArray -> MutableJSArray -> IO JSVal
696646#else
@@ -704,7 +654,6 @@ objCallAsFunction f this args exceptions = do
704654 liftIO $ withArrayLen rargs' $ \ largs pargs ->
705655 jsobjectcallasfunction gctxt rfunction rthis (fromIntegral largs) pargs exceptions
706656 makeNewJSVal result
707−{-# INLINE objCallAsFunction #-}
708657#endif
709658
710659-- | Call a JavaScript object as a constructor. Consider using 'new'.
src/Language/Javascript/JSaddle/Properties.hs−8
@@ -58,7 +58,6 @@ objGetPropertyByName :: ToJSString name
5858 -> JSM JSVal -- ^ returns the property value.
5959#ifdef ghcjs_HOST_OS
6060objGetPropertyByName this name = liftIO . js_tryGetProp (toJSString name) this
61−{-# INLINE objGetPropertyByName #-}
6261foreign import javascript unsafe "try { $r=$2[$1] } catch(e) { $3[0] = e }"
6362 js_tryGetProp :: JSString -> Object -> MutableJSArray -> IO JSVal
6463#else
@@ -67,7 +66,6 @@ objGetPropertyByName this name exceptions = do
6766 withObject this $ \rthis ->
6867 withJSString (toJSString name) $ \name' ->
6968 (liftIO $ jsobjectgetproperty gctxt rthis name' exceptions) >>= makeNewJSVal
70−{-# INLINE objGetPropertyByName #-}
7169#endif
7270
7371-- | Get a property value given the object and the index of the property.
@@ -77,7 +75,6 @@ objGetPropertyAtIndex :: Object -- ^ object to find the property on.
7775 -> JSM JSVal -- ^ returns the property value.
7876#ifdef ghcjs_HOST_OS
7977objGetPropertyAtIndex this index = liftIO . js_tryIndex index this
80−{-# INLINE objGetPropertyAtIndex #-}
8178foreign import javascript unsafe "try { $r=$2[$1] } catch(e) { $3[0] = e }"
8279 js_tryIndex :: Index -> Object -> MutableJSArray -> IO JSVal
8380#else
@@ -85,7 +82,6 @@ objGetPropertyAtIndex this index exceptions = do
8582 gctxt <- ask
8683 withObject this $ \rthis ->
8784 (liftIO $ jsobjectgetpropertyatindex gctxt rthis index exceptions) >>= makeNewJSVal
88−{-# INLINE objGetPropertyAtIndex #-}
8985#endif
9086
9187-- | Set a property value given the object and the name of the property.
@@ -100,7 +96,6 @@ objSetPropertyByName :: (ToJSString name, ToJSVal val)
10096objSetPropertyByName this name val attributes exceptions = do
10197 vref <- toJSVal val
10298 liftIO $ js_trySetProp (toJSString name) this vref exceptions
103−{-# INLINE objSetPropertyByName #-}
10499foreign import javascript unsafe "try { $2[$1]=$3 } catch(e) { $4[0] = e }"
105100 js_trySetProp :: JSString -> Object -> JSVal -> MutableJSArray -> IO ()
106101#else
@@ -110,7 +105,6 @@ objSetPropertyByName this name val attributes exceptions = do
110105 withJSString (toJSString name) $ \name' ->
111106 withToJSVal val $ \rval ->
112107 liftIO $ jsobjectsetproperty gctxt rthis name' rval attributes exceptions
113−{-# INLINE objSetPropertyByName #-}
114108#endif
115109
116110-- | Set a property value given the object and the index of the property.
@@ -124,7 +118,6 @@ objSetPropertyAtIndex :: (ToJSVal val)
124118objSetPropertyAtIndex this index val exceptions = do
125119 vref <- toJSVal val
126120 liftIO $ js_trySetAtIndex index this vref exceptions
127−{-# INLINE objSetPropertyAtIndex #-}
128121foreign import javascript unsafe "try { $2[$1]=$3 } catch(e) { $4[0] = e }"
129122 js_trySetAtIndex :: Index -> Object -> JSVal -> MutableJSArray -> IO ()
130123#else
@@ -133,6 +126,5 @@ objSetPropertyAtIndex this index val exceptions = do
133126 withObject this $ \rthis ->
134127 withToJSVal val $ \rval ->
135128 liftIO $ jsobjectsetpropertyatindex gctxt rthis index rval exceptions
136−{-# INLINE objSetPropertyAtIndex #-}
137129#endif
138130
src/Language/Javascript/JSaddle/String.hs−2
@@ -54,7 +54,6 @@ strToText jsstring' = liftIO $ withJSString jsstring' $ \jsstring -> do
5454 p <- jsstringgetcharactersptr jsstring
5555 T.fromPtr (castPtr p) (fromIntegral l)
5656#endif
57−{-# INLINE strToText #-}
5857
5958-- | Convert a Haskell 'Text' to a JavaScript string
6059textToStr :: Text -> JSString
@@ -65,7 +64,6 @@ textToStr text = unsafePerformIO $
6564 useAsPtr text $ \p l ->
6665 jsstringcreatewithcharacters (castPtr p) (fromIntegral l) >>= makeNewJSString
6766#endif
68−{-# INLINE textToStr #-}
6967
7068nullJSString :: JSString
7169#ifdef ghcjs_HOST_OS
src/Language/Javascript/JSaddle/Value.hs−49
@@ -170,7 +170,6 @@ valToBool value = do
170170 withToJSVal value $ \rval ->
171171 liftIO $ jsvaluetoboolean gctxt rval
172172#endif
173−{-# INLINE valToBool #-}
174173
175174-- | Given a JavaScript value get its numeric value.
176175-- May throw JSException.
@@ -194,14 +193,12 @@ valToBool value = do
194193valToNumber :: ToJSVal value => value -> JSM Double
195194#ifdef ghcjs_HOST_OS
196195valToNumber value = jsrefToNumber <$> toJSVal value
197−{-# INLINE valToNumber #-}
198196foreign import javascript unsafe "$r = Number($1);" jsrefToNumber :: JSVal -> Double
199197#else
200198valToNumber value = do
201199 gctxt <- ask
202200 withToJSVal value $ \rval ->
203201 rethrow $ liftIO . jsvaluetonumber gctxt rval
204−{-# INLINE valToNumber #-}
205202#endif
206203
207204-- | Given a JavaScript value get its string value (as a JavaScript string).
@@ -226,14 +223,12 @@ valToNumber value = do
226223valToStr :: ToJSVal value => value -> JSM JSString
227224#ifdef ghcjs_HOST_OS
228225valToStr value = jsrefToString <$> toJSVal value
229−{-# INLINE valToStr #-}
230226foreign import javascript unsafe "$r = $1.toString();" jsrefToString :: JSVal -> JSString
231227#else
232228valToStr value = do
233229 gctxt <- ask
234230 withToJSVal value $ \rval ->
235231 rethrow (liftIO . jsvaluetostringcopy gctxt rval) >>= wrapJSString
236−{-# INLINE valToStr #-}
237232#endif
238233
239234-- | Given a JavaScript value get its string value (as a Haskell 'Text').
@@ -257,7 +252,6 @@ valToStr value = do
257252-- "1"
258253valToText :: ToJSVal value => value -> JSM Text
259254valToText jsvar = valToStr jsvar >>= strToText
260−{-# INLINE valToText #-}
261255
262256-- | Given a JavaScript value get a JSON string value.
263257-- May throw JSException.
@@ -283,14 +277,12 @@ valToText jsvar = valToStr jsvar >>= strToText
283277valToJSON :: ToJSVal value => Word -> value -> JSM JSString
284278#ifdef ghcjs_HOST_OS
285279valToJSON indent value = jsrefToJSON <$> toJSVal value
286−{-# INLINE valToJSON #-}
287280foreign import javascript unsafe "$r = JSON.stringify($1);" jsrefToJSON :: JSVal -> JSString
288281#else
289282valToJSON indent value = do
290283 gctxt <- ask
291284 withToJSVal value $ \rval ->
292285 rethrow (liftIO . jsvaluecreatejsonstring gctxt rval (fromIntegral indent)) >>= wrapJSString
293−{-# INLINE valToJSON #-}
294286#endif
295287
296288-- | Given a JavaScript value get its object value.
@@ -321,34 +313,28 @@ valToObject value = Object <$>
321313 withToJSVal value $ \rval ->
322314 rethrow (liftIO . jsvaluetoobject gctxt rval) >>= makeNewJSVal
323315#endif
324−{-# INLINE valToObject #-}
325316
326317instance MakeObject JSVal where
327318 makeObject = valToObject
328− {-# INLINE makeObject #-}
329319
330320-- | Convert to a JavaScript value (just an alias for 'toJSVal')
331321val :: ToJSVal value
332322 => value -- ^ value to convert to a JavaScript value
333323 -> JSM JSVal
334324val = toJSVal
335−{-# INLINE val #-}
336325
337326-- | If we already have a JSVal we are fine
338327instance ToJSVal JSVal where
339328 toJSVal = return
340− {-# INLINE toJSVal #-}
341329
342330-- | A single JSVal can be used as the argument list
343331instance MakeArgs JSVal where
344332 makeArgs arg = return [arg]
345− {-# INLINE makeArgs #-}
346333
347334-- | JSVal can be made by evaluating a function in 'JSM' as long
348335-- as it returns something we can make into a JSVal.
349336instance ToJSVal v => ToJSVal (JSM v) where
350337 toJSVal v = v >>= toJSVal
351− {-# INLINE toJSVal #-}
352338
353339----------- null ---------------
354340-- | Make a @null@ JavaScript value
@@ -358,23 +344,19 @@ valMakeNull = return jsNull
358344#else
359345valMakeNull = ask >>= (liftIO . jsvaluemakenull) >>= makeNewJSVal
360346#endif
361−{-# INLINE valMakeNull #-}
362347
363348-- | Makes a @null@ JavaScript value
364349instance ToJSVal JSNull where
365350 toJSVal = const valMakeNull
366− {-# INLINE toJSVal #-}
367351
368352-- | Makes an argument list with just a single @null@ JavaScript value
369353instance MakeArgs JSNull where
370354 makeArgs _ = valMakeNull >>= (\ref -> return [ref])
371− {-# INLINE makeArgs #-}
372355
373356-- | Makes a JSVal or @null@ JavaScript value
374357instance ToJSVal a => ToJSVal (Maybe a) where
375358 toJSVal Nothing = valMakeNull
376359 toJSVal (Just a) = toJSVal a
377− {-# INLINE toJSVal #-}
378360
379361-- | Test a JavaScript value to see if it is @null@
380362valIsNull :: ToJSVal value => value -> JSM Bool
@@ -386,7 +368,6 @@ valIsNull value = do
386368 withToJSVal value $ \rval ->
387369 liftIO $ jsvalueisnull gctxt rval
388370#endif
389−{-# INLINE valIsNull #-}
390371
391372----------- undefined ---------------
392373-- | Make an @undefined@ JavaScript value
@@ -396,12 +377,10 @@ valMakeUndefined = return jsUndefined
396377#else
397378valMakeUndefined = ask >>= (liftIO . jsvaluemakeundefined) >>= makeNewJSVal
398379#endif
399−{-# INLINE valMakeUndefined #-}
400380
401381-- | Makes an @undefined@ JavaScript value
402382instance ToJSVal JSUndefined where
403383 toJSVal = const valMakeUndefined
404− {-# INLINE toJSVal #-}
405384
406385--We can't allow this if JSUndefined is () as () is no args not "(null)".
407386--Use [()] instead.
@@ -411,7 +390,6 @@ instance ToJSVal JSUndefined where
411390-- | This allows us to pass no arguments easily (altenative would be to use @[]::[JSVal]@).
412391instance MakeArgs () where
413392 makeArgs _ = return []
414− {-# INLINE makeArgs #-}
415393
416394-- | Test a JavaScript value to see if it is @undefined@
417395valIsUndefined :: ToJSVal value => value -> JSM Bool
@@ -423,7 +401,6 @@ valIsUndefined value = do
423401 withToJSVal value $ \rval ->
424402 liftIO $ jsvalueisundefined gctxt rval
425403#endif
426−{-# INLINE valIsUndefined #-}
427404
428405-- | Convert a JSVal to a Maybe JSVal (converting null and undefined to Nothing)
429406maybeNullOrUndefined :: ToJSVal value => value -> JSM (Maybe JSVal)
@@ -435,7 +412,6 @@ maybeNullOrUndefined value = do
435412 valIsUndefined rval >>= \case
436413 True -> return Nothing
437414 _ -> return (Just rval)
438−{-# INLINE maybeNullOrUndefined #-}
439415
440416maybeNullOrUndefined' :: ToJSVal value => (JSVal -> JSM a) -> value -> JSM (Maybe a)
441417maybeNullOrUndefined' f value = do
@@ -446,7 +422,6 @@ maybeNullOrUndefined' f value = do
446422 valIsUndefined rval >>= \case
447423 True -> return Nothing
448424 _ -> Just <$> f rval
449−{-# INLINE maybeNullOrUndefined' #-}
450425
451426----------- booleans ---------------
452427-- | Make a JavaScript boolean value
@@ -458,17 +433,14 @@ valMakeBool b = do
458433 gctxt <- ask
459434 liftIO (jsvaluemakeboolean gctxt b) >>= makeNewJSVal
460435#endif
461−{-# INLINE valMakeBool #-}
462436
463437-- | Make a JavaScript boolean value
464438instance ToJSVal Bool where
465439 toJSVal = valMakeBool
466− {-# INLINE toJSVal #-}
467440
468441-- | Makes an argument list with just a single JavaScript boolean value
469442instance MakeArgs Bool where
470443 makeArgs b = valMakeBool b >>= (\ref -> return [ref])
471− {-# INLINE makeArgs #-}
472444
473445----------- numbers ---------------
474446-- | Make a JavaScript number
@@ -480,45 +452,35 @@ valMakeNumber n = do
480452 gctxt <- ask
481453 liftIO (jsvaluemakenumber gctxt n) >>= makeNewJSVal
482454#endif
483−{-# INLINE valMakeNumber #-}
484455
485456-- | Makes a JavaScript number
486457instance ToJSVal Double where
487458 toJSVal = valMakeNumber
488− {-# INLINE toJSVal #-}
489459
490460instance ToJSVal Float where
491461 toJSVal = valMakeNumber . realToFrac
492− {-# INLINE toJSVal #-}
493462
494463instance ToJSVal Word where
495464 toJSVal = valMakeNumber . fromIntegral
496− {-# INLINE toJSVal #-}
497465
498466instance ToJSVal Word32 where
499467 toJSVal = valMakeNumber . fromIntegral
500− {-# INLINE toJSVal #-}
501468
502469instance ToJSVal Word64 where
503470 toJSVal = valMakeNumber . fromIntegral
504− {-# INLINE toJSVal #-}
505471
506472instance ToJSVal Int where
507473 toJSVal = valMakeNumber . fromIntegral
508− {-# INLINE toJSVal #-}
509474
510475instance ToJSVal Int32 where
511476 toJSVal = valMakeNumber . fromIntegral
512− {-# INLINE toJSVal #-}
513477
514478instance ToJSVal Int64 where
515479 toJSVal = valMakeNumber . fromIntegral
516− {-# INLINE toJSVal #-}
517480
518481-- | Makes an argument list with just a single JavaScript number
519482instance MakeArgs Double where
520483 makeArgs n = valMakeNumber n >>= (\ref -> return [ref])
521− {-# INLINE makeArgs #-}
522484
523485-- | Make a JavaScript string from `Text`
524486valMakeText :: Text -> JSM JSVal
@@ -530,7 +492,6 @@ valMakeText text = do
530492 withJSString (textToStr text) $ \s ->
531493 liftIO (jsvaluemakestring gctxt s) >>= makeNewJSVal
532494#endif
533−{-# INLINE valMakeText #-}
534495
535496-- | Make a JavaScript string from `JSString`
536497valMakeString :: JSString -> JSM JSVal
@@ -542,40 +503,32 @@ valMakeString str = do
542503 withJSString str $ \s ->
543504 liftIO (jsvaluemakestring gctxt s) >>= makeNewJSVal
544505#endif
545−{-# INLINE valMakeString #-}
546506
547507-- | Makes a JavaScript string
548508instance ToJSVal Text where
549509 toJSVal = valMakeText
550− {-# INLINE toJSVal #-}
551510
552511-- | Makes an argument list with just a single JavaScript string
553512instance MakeArgs Text where
554513 makeArgs t = valMakeText t >>= (\ref -> return [ref])
555− {-# INLINE makeArgs #-}
556514
557515-- | Makes a JavaScript string
558516instance ToJSVal String where
559517 toJSVal = valMakeText . T.pack
560− {-# INLINE toJSVal #-}
561518
562519-- | Makes a JavaScript string
563520instance ToJSVal JSString where
564521 toJSVal = valMakeString
565− {-# INLINE toJSVal #-}
566522
567523-- | If we already have a JSString we are fine
568524instance ToJSString JSString where
569525 toJSString = id
570− {-# INLINE toJSString #-}
571526
572527instance ToJSString Text where
573528 toJSString = textToStr
574− {-# INLINE toJSString #-}
575529
576530instance ToJSString String where
577531 toJSString = textToStr . T.pack
578− {-# INLINE toJSString #-}
579532
580533-- | Derefernce a value reference.
581534--
@@ -653,12 +606,10 @@ valMakeRef value =
653606-- | Makes a JavaScript value from a 'JSValue' ADT.
654607instance ToJSVal JSValue where
655608 toJSVal = valMakeRef
656− {-# INLINE toJSVal #-}
657609
658610-- | Makes an argument list with just a single JavaScript value from a 'JSValue' ADT.
659611instance MakeArgs JSValue where
660612 makeArgs v = valMakeRef v >>= (\ref -> return [ref])
661− {-# INLINE makeArgs #-}
662613
663614--instance MakeObjectRef JSNull where
664615-- makeObjectRef _ = Object <$> valMakeNull