z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y None35The JSM- monad keeps track of the JavaScript context.Given a JSM function and a ' you can run the function like this... (runReaderT jsmFunction javaScriptContextCFor an example of how to set up WebKitGTK+ see tests/TestJSaddle.hs     None35 ?Anything that can be used to make a JavaScript object reference?Anything that can be used to make a JavaScript string reference>Anything that can be used to make a JavaScript value referencez'If we already have a Object we are fine z{    z{None |} |}NoneWrapped version of ~8 that runs in a MonadIO that works a bit better with Wrapped version of 8 that runs in a MonadIO that works a bit better with [Handle JavaScriptCore functions that take a MutableJSArray in order to throw exceptions.None+"4Catch JavaScript exceptions and rethrow Haskell ones !" !" !" !"None35#hAnything that can be used to make a list of JavaScript value references for use as function arguments #$#$#$#$None35%)Convert a JavaScript string to a Haskell &Convert a Haskell  to a JavaScript string%&'%&'%&'%&'None35NU.(UAn algebraic data type that can represent a JavaScript value. Any JavaScriptCore  ! can be converted into this type.)null* undefined+ true or false,a number-a string. an object1pType that represents a value that can only be null. Haskell of course has no null so we are adding this type.2IShow a JSValue but just say "object" if the value is a JavaScript object.3\Given a JavaScript value get its boolean value. All values in JavaScript convert to bool.testJSaddle $ valToBool JSNullfalsetestJSaddle $ valToBool ()falsetestJSaddle $ valToBool TruetruetestJSaddle $ valToBool Falsefalse'testJSaddle $ valToBool (1.0 :: Double)true'testJSaddle $ valToBool (0.0 :: Double)falsetestJSaddle $ valToBool ""falsetestJSaddle $ valToBool "1"true4IGiven a JavaScript value get its numeric value. May throw JSException.)testJSaddle $ show <$> valToNumber JSNull0.0%testJSaddle $ show <$> valToNumber ()NaN'testJSaddle $ show <$> valToNumber True1.0(testJSaddle $ show <$> valToNumber False0.02testJSaddle $ show <$> valToNumber (1.0 :: Double)1.02testJSaddle $ show <$> valToNumber (0.0 :: Double)0.0%testJSaddle $ show <$> valToNumber ""0.0&testJSaddle $ show <$> valToNumber "1"1.05aGiven a JavaScript value get its string value (as a JavaScript string). May throw JSException.+testJSaddle $ valToStr JSNull >>= strToTextnull'testJSaddle $ valToStr () >>= strToText undefined)testJSaddle $ valToStr True >>= strToTexttrue*testJSaddle $ valToStr False >>= strToTextfalse4testJSaddle $ valToStr (1.0 :: Double) >>= strToText14testJSaddle $ valToStr (0.0 :: Double) >>= strToText0'testJSaddle $ valToStr "" >>= strToText(testJSaddle $ valToStr "1" >>= strToText16<Given a JavaScript value get its string value (as a Haskell ). May throw JSException.'testJSaddle $ show <$> valToText JSNull"null"#testJSaddle $ show <$> valToText () "undefined"%testJSaddle $ show <$> valToText True"true"&testJSaddle $ show <$> valToText False"false"0testJSaddle $ show <$> valToText (1.0 :: Double)"1"0testJSaddle $ show <$> valToText (0.0 :: Double)"0"#testJSaddle $ show <$> valToText """"$testJSaddle $ show <$> valToText "1""1"7KGiven a JavaScript value get a JSON string value. May throw JSException. .testJSaddle $ valToJSON 0 JSNull >>= strToTextnull*testJSaddle $ valToJSON 0 () >>= strToText,testJSaddle $ valToJSON 0 True >>= strToTexttrue-testJSaddle $ valToJSON 0 False >>= strToTextfalse7testJSaddle $ valToJSON 0 (1.0 :: Double) >>= strToText17testJSaddle $ valToJSON 0 (0.0 :: Double) >>= strToText0*testJSaddle $ valToJSON 0 "" >>= strToText""+testJSaddle $ valToJSON 0 "1" >>= strToText"1"/testJSaddle $ obj >>= valToJSON 0 >>= strToText{}8HGiven a JavaScript value get its object value. May throw JSException.YtestJSaddle $ (valToObject JSNull >>= valToText) `catch` \ (JSException e) -> valToText e$TypeError:...null...is not an objectUtestJSaddle $ (valToObject () >>= valToText) `catch` \ (JSException e) -> valToText e)TypeError:...undefined...is not an objecttestJSaddle $ valToObject TruetruetestJSaddle $ valToObject Falsefalse)testJSaddle $ valToObject (1.0 :: Double)1)testJSaddle $ valToObject (0.0 :: Double)0testJSaddle $ valToObject ""testJSaddle $ valToObject "1"191Convert to a JavaScript value (just an alias for ):Make a null JavaScript value;(Test a JavaScript value to see if it is null<Make an  undefined JavaScript value=(Test a JavaScript value to see if it is  undefined>KConvert a JSVal to a Maybe JSVal (converting null and undefined to Nothing)@Make a JavaScript boolean valueAMake a JavaScript numberMake a JavaScript string from BMake a JavaScript string from CDerefernce a value reference. -testJSaddle $ showJSValue <$> deRefVal JSNullnull)testJSaddle $ showJSValue <$> deRefVal () undefined+testJSaddle $ showJSValue <$> deRefVal Truetrue,testJSaddle $ showJSValue <$> deRefVal Falsefalse6testJSaddle $ showJSValue <$> deRefVal (1.0 :: Double)1.06testJSaddle $ showJSValue <$> deRefVal (0.0 :: Double)0.0)testJSaddle $ showJSValue <$> deRefVal """"*testJSaddle $ showJSValue <$> deRefVal "1""1"=testJSaddle $ showJSValue <$> (valToObject True >>= deRefVal)objectD!Make a JavaScript value out of a ( ADT. testJSaddle $ valMakeRef ValNullnull%testJSaddle $ valMakeRef ValUndefined undefined'testJSaddle $ valMakeRef (ValBool True)true&testJSaddle $ valMakeRef (ValNumber 1)15testJSaddle $ valMakeRef (ValString $ T.pack "Hello")HelloBMakes an argument list with just a single JavaScript value from a ( ADT. Makes a JavaScript value from a ( ADT.)If we already have a JSString we are fineMakes a JavaScript stringMakes a JavaScript string;Makes an argument list with just a single JavaScript stringMakes a JavaScript string;Makes an argument list with just a single JavaScript numberMakes a JavaScript numberBMakes an argument list with just a single JavaScript boolean valueMake a JavaScript boolean valueGThis allows us to pass no arguments easily (altenative would be to use  []::[JSVal]). Makes an  undefined JavaScript valueMakes a JSVal or null JavaScript value*Makes an argument list with just a single null JavaScript valueMakes a null JavaScript value.JSVal can be made by evaluating a function in = as long as it returns something we can make into a JSVal./A single JSVal can be used as the argument list&If we already have a JSVal we are fine=()*+,-./A type that can only be undefined in JavaScript. Using () because functions in JavaScript that have no return, impicitly return undefined. type JSBool = Bool -- ^ JavaScript boolean values map the U haskell type. type JSNumber = Double -- ^ A number in JavaScript maps nicely to Y. type JSString = Text -- ^ JavaScript strings can be represented with the Haskell  type.0123456789&value to convert to a JavaScript value:;<=>?@ABCDEF# ()*+,-./0123456789:;<=>?@ABCDEF# 01/()*+,-.23458679:;<=>?@ABCDEF6()*+,-./0123456789:;<=>?@ABCDEF None35GCGet a property value given the object and the name of the property.HDGet a property value given the object and the index of the property.ICSet a property value given the object and the name of the property.JDSet a property value given the object and the index of the property.Gobject to find the property on.name of the property.exception if one is raised.returns the property value.Hobject to find the property on.index of the property.exception if one is raised.returns the property value.Iobject to set the property on.name of the property.!new value to set the property to.)property attributes to give the property.exception if one is raised.Jobject to find property on.index of the property.!new value to set the property to.exception if one is raised.GHIJGHIJGHIJ None35IN*K@Make a JavaScript function object that wraps a Haskell function.O7Type used for Haskell functions called from JavaScript.P0Java script function applications have this typeQ$Lookup a property based on its name.)testJSaddle $ eval "'Hello World'.length"11*testJSaddle $ val "Hello World" ! "length"11R%Lookup a property based on its index.%testJSaddle $ eval "'Hello World'[6]"W$testJSaddle $ val "Hello World" !! 6WS.Makes a getter for a particular property name. js name = to (!name))testJSaddle $ eval "'Hello World'.length"11.testJSaddle $ val "Hello World" ^. js "length"11T.Makes a setter for a particular property name. jss name = to (<#name))testJSaddle $ eval "'Hello World'.length"11.testJSaddle $ val "Hello World" ^. js "length"11UHandy way to call a function %jsf name = to (\o -> o # name $ args):testJSaddle $ val "Hello World" ^. jsf "indexOf" ["World"]6V6Handy way to call a function that expects no arguments js0 name = jsf name ()4testJSaddle $ val "Hello World" ^. js0 "toLowerCase" hello worldW6Handy way to call a function that expects one argument js1 name a0 = jsf name [a0]8testJSaddle $ val "Hello World" ^. js1 "indexOf" "World"6X7Handy way to call a function that expects two argumentsY9Handy way to call a function that expects three argumentsZ8Handy way to call a function that expects four arguments[8Handy way to call a function that expects five arguments\?Handy way to get and hold onto a reference top level javascript6testJSaddle $ eval "w = console; w.log('Hello World')"-** Message: console message: @1: Hello World undefinedAtestJSaddle $ do w <- jsg "console"; w ^. js1 "log" "Hello World".** Message: console message:...@0: Hello World undefined]Handy way to call a function "jsgf name = jsg name . to (# args)AtestJSaddle $ eval "globalFunc = function (x) {return x.length;}"function (x) {return x.length;})testJSaddle $ jsgf "globalFunc" ["World"]5^6Handy way to call a function that expects no arguments jsg0 name = jsgf name ()testJSaddle $ jsg0 "globalFunc"+TypeError:...undefined...is not an objec..._6Handy way to call a function that expects one argument jsg1 name a0 = jsgf name [a0]'testJSaddle $ jsg1 "globalFunc" "World"5`7Handy way to call a function that expects two argumentsa9Handy way to call a function that expects three argumentsb8Handy way to call a function that expects four argumentsc8Handy way to call a function that expects five argumentsdCall a JavaScript function3testJSaddle $ eval "'Hello World'.indexOf('World')"67testJSaddle $ val "Hello World" # "indexOf" $ ["World"]6eCall a JavaScript functionhtestJSaddle $ eval "something = {}; something[6]=function (x) {return x.length;}; something[6]('World')"5.testJSaddle $ jsg "something" ## 6 $ ["World"]5fSet a JavaScript property-testJSaddle $ eval "var j = {}; j.x = 1; j.x"10testJSaddle $ do {j <- obj; (j <# "x") 1; j!"x"}1gSet a JavaScript property/testJSaddle $ eval "var j = {}; j[6] = 1; j[6]"1.testJSaddle $ do {j <- obj; (j <## 6) 1; j!!6}1h*Use this to create a new JavaScript object|If you pass more than 7 arguments to a constructor for a built in JavaScript type (like Date) then this function will fail.+testJSaddle $ new (jsg "Date") (2013, 1, 1)&Fri Feb 01 2013 00:00:00 GMT+... (...)iCall function with a given this . In most cases you should use '#'.BtestJSaddle $ eval "(function(){return this;}).apply('Hello', [])"HelloZtestJSaddle $ do { test <- eval "(function(){return this;})"; call test (val "Hello") () }Helloj1Make an empty object using the default constuctor3testJSaddle $ eval "var a = {}; a.x = 'Hello'; a.x"Hello>testJSaddle $ do { a <- obj; (a <# "x") "Hello"; a ^. js "x" }Hellok Short hand ::JSCallAsFunction@ so a haskell function can be passed to a to a JavaScipt one.OtestJSaddle $ eval "(function(f) {f('Hello');})(function (a) {console.log(a)})"'** Message: console message: @1: Hello undefinedtestJSaddle $ call (eval "(function(f) {f('Hello');})") global [fun $ \ _ _ args -> valToText (head args) >>= (liftIO . putStrLn . T.unpack) ]Hello undefinedn.Make an JavaScript array from a list of values*testJSaddle $ eval "['Hello', 'World'][1]"World+testJSaddle $ array ["Hello", "World"] !! 1World8testJSaddle $ eval "['Hello', null, undefined, true, 1]"Hello,,,true,1<testJSaddle $ array ("Hello", JSNull, (), True, 1.0::Double)Hello,,,true,1oJavaScript's global objectDGet an array containing the property names present on a given object0Get the number of names in a property name array'Get a name out of a property name array Convert property array to a listpBGet a list containing the property names present on a given objectqQGet a list containing references to all the properties present on a given objectr6Call a JavaScript object as function. Consider using '#'.s:Call a JavaScript object as a constructor. Consider using h.|If you pass more than 7 arguments to a constructor for a built in JavaScript type (like Date) then this function will fail.|A callback to Haskell can be used as a JavaScript value. This will create an anonymous JavaScript function object. Use l to create one with a name..Object can be made by evaluating a fnction in > as long as it returns something we can make into a Object.=KLMNOFunction objectthisFunction argumentsOnly / can be returned because the function may need to be executed in a different thread. If you need to get a value out pass in a continuation function as an argument and invoke it from haskell.PQObject to look onName of the property to findProperty referenceRObject to look onIndex of the property to lookupProperty referenceSName of the property to findTName of the property to findUVWXYZ[\]^_`abcdefObject to set the property onName of the property to setValue to set it togObject to set the property onIndex of the property to setValue to set it tohijklName of the functionHaskell function to callXReturns a JavaScript function object that will call the Haskell one when it is calledmnopqrst- KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst- QRSTPUVWXYZ[\]^_`abcfgdehijKLMNlmkOnopqrst:KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstdefg None35u7Evaluates a script (like eval in java script). Unlike ve this function lets you specify a source URL and starting line number for beter error information.testJSaddle $ (evaluateScript "\n\n{" global "FileName" 53 >>= valToText) `catch` \(JSException e) -> array (e,e!"sourceURL", e!"line") >>= valToTextSyntaxError: ...,FileName,55v-Evaluates a script (like eval in java script)testJSaddle $ eval "1+1"2uJavaScript to evaluate/The Line number of the first line of the scriptvJavaScript to evaluateuvuvuv Noneo  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv None wxywxywxywxy !"#$%&'()*+,-.//0123456789:;<=>>?@ABCDEFGHIJKLMNOPQRS T U V W X X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  )*    jsadd_D8MUGq0tsDbGMvR4qzQrPL!Language.Javascript.JSaddle.Types#Language.Javascript.JSaddle.Classes"Language.Javascript.JSaddle.Native!Language.Javascript.JSaddle.Monad%Language.Javascript.JSaddle.Exception%Language.Javascript.JSaddle.Arguments"Language.Javascript.JSaddle.String!Language.Javascript.JSaddle.Value&Language.Javascript.JSaddle.Properties"Language.Javascript.JSaddle.Object$Language.Javascript.JSaddle.Evaluate Language.Javascript.JSaddle.TestLanguage.Javascript.JSaddlewebki_LB4ryA9OceEIqr7JrpSD2W1Graphics.UI.Gtk.WebKit.JavaScriptCore.JSObjectRefJSPropertyAttributes,Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase JSContextRefJSMNullableJSStringObjectIndexJSPropertyNameArrayMutableJSArrayJSVal MakeObject makeObject ToJSString toJSStringToJSValtoJSVal makeNewJSValmakeNewJSString wrapJSString withJSVal withJSVals withObject withJSString withToJSValcatchbracketcatchval runJSaddlepostGUIAsyncJS postGUISyncJS JSExceptionrethrowMakeArgsmakeArgs strToText textToStr nullJSStringJSValueValNull ValUndefinedValBool ValNumber ValString ValObject JSUndefinedJSNull showJSValue valToBool valToNumbervalToStr valToText valToJSON valToObjectval valMakeNull valIsNullvalMakeUndefinedvalIsUndefinedmaybeNullOrUndefinedmaybeNullOrUndefined' valMakeBool valMakeNumber valMakeStringdeRefVal valMakeRef strictEqual instanceOfobjGetPropertyByNameobjGetPropertyAtIndexobjSetPropertyByNameobjSetPropertyAtIndexFunctionfunctionCallbackfunctionObjectJSCallAsFunctionJSF!!!jsjssjsfjs0js1js2js3js4js5jsgjsgfjsg0jsg1jsg2jsg3jsg4jsg5###<#<##newcallobjfunfunction freeFunctionarrayglobal propertyNames propertiesobjCallAsFunctionobjCallAsConstructor nullObjectevaluateScripteval testJSaddle showJSaddlelistWindowProperties$fMakeObjectObject$fToJSValObjectjsStringReleasejsValueUnprotectbaseControl.Exception.Base$fExceptionJSException$fShowJSException$fMakeArgs(,,,,,)$fMakeArgs(,,,,)$fMakeArgs(,,,)$fMakeArgs(,,) $fMakeArgs(,) $fMakeArgs[]$fMakeArgsReaderTtext_HmqVQnZSpjaC156ABqPhneData.Text.InternalText valMakeText$fMakeArgsJSValue$fToJSValJSValue$fToJSStringForeignPtr$fToJSValForeignPtr $fToJSVal[]$fMakeArgsText $fToJSValText$fMakeArgsDouble$fToJSValDouble$fMakeArgsBool $fToJSValBool $fMakeArgs() $fToJSVal()$fToJSValMaybe$fMakeArgsJSNull$fToJSValJSNull$fToJSValReaderT$fMakeArgsForeignPtr$fToJSValForeignPtr0ghc-prim GHC.TypesBoolDouble$fToJSString[]$fToJSStringText$fToJSValInt64$fToJSValInt32 $fToJSValInt$fToJSValWord64$fToJSValWord32 $fToJSValWord$fToJSValFloat$fMakeObjectForeignPtrcopyPropertyNamespropertyNamesCountpropertyNamesAtpropertyNamesList $fToJSVal(->)$fMakeObjectReaderTHaskellCallback makeArray $fToJSVal[]0 $fToJSVal[]1 $fToJSVal[]2 $fToJSVal[]3 $fToJSVal[]4 $fToJSVal[]5 $fToJSVal[]6 $fToJSVal[]7$fMakeArgs(->)$fToJSValFunction TestState jsContextwindowstatedonedebugLog testJSaddle'