\      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ [ None24 NoneiA reference to a property. Implemented as a reference to an object and something to find the property. Object and property index. Object and property name.   None The 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 Wrapped version of \8 that runs in a MonadIO that works a bit better with  ZHandle JavaScriptCore functions that take a JSValueRefRef in order to throw exceptions.     None+4Catch JavaScript exceptions and rethrow Haskell ones]]NoneAAnything that can be used to make a JavaScript property reference?Anything that can be used to make a JavaScript object referencehAnything that can be used to make a list of JavaScript value references for use as function arguments?Anything that can be used to make a JavaScript string reference>Anything that can be used to make a JavaScript value reference    None24^_`abc^_`abcNone24)Convert a JavaScript string to a Haskell dConvert a Haskell d to a JavaScript stringe,If we already have a JSStringRef we are finefgefgeNone24M&UAn algebraic data type that can represent a JavaScript value. Any JavaScriptCore ! can be converted into this type.  an object!a string"a number# true or false$ undefined%null+pType that represents a value that can only be null. Haskell of course has no null so we are adding this type.,\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"true-IGiven 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.0.aGiven 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" >>= strToText1/<Given a JavaScript value get its string value (as a Haskell d). 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"0KGiven 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{}1HGiven 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"121Convert to a JavaScript value (just an alias for )3Make a null JavaScript value4Make an  undefined JavaScript value5Make a JavaScript boolean value6Make a JavaScript number7Make a JavaScript string8Derefernce a value reference. &testJSaddle $ show <$> deRefVal JSNullValNull"testJSaddle $ show <$> deRefVal () ValUndefined$testJSaddle $ show <$> deRefVal True ValBool True%testJSaddle $ show <$> deRefVal False ValBool False/testJSaddle $ show <$> deRefVal (1.0 :: Double) ValNumber 1.0/testJSaddle $ show <$> deRefVal (0.0 :: Double) ValNumber 0.0"testJSaddle $ show <$> deRefVal "" ValString ""#testJSaddle $ show <$> deRefVal "1" ValString "1"4testJSaddle $ show <$> valToObject True >>= deRefValValObject 0x...9!Make a JavaScript value out of a  ADT. testJSaddle $ valMakeRef ValNull"null"%testJSaddle $ valMakeRef ValUndefined "undefined"'testJSaddle $ valMakeRef (ValBool True)"true"&testJSaddle $ valMakeRef (ValNumber 1)"1"3testJSaddle $ valMakeRef (ValString $ pack "Hello")"Hello"hBMakes an argument list with just a single JavaScript value from a  ADT.i Makes a JavaScript value from a  ADT.jMakes a JavaScript stringk;Makes an argument list with just a single JavaScript stringlMakes a JavaScript stringm;Makes an argument list with just a single JavaScript numbernMakes a JavaScript numberoBMakes an argument list with just a single JavaScript boolean valuepMake a JavaScript boolean valueqGThis allows us to pass no arguments easily (altenative would be to use []::[JSValueRef]).r Makes an  undefined JavaScript values*Makes an argument list with just a single null JavaScript valuetMakes a null JavaScript valueu3JSValueRef can be made by evaluating a function in  B as long as it returns something we can make into a JSValueRef.v4A single JSValueRef can be used as the argument listw+If we already have a JSValueRef we are fine, !"#$%&7JavaScript strings can be represented with the Haskell d type.'&A number in JavaScript maps nicely to x.("JavaScript boolean values map the y haskell type.)A type that can only be undefined in JavaScript. Using () because functions in JavaScript that have no return, impicitly return undefined.*+,-./012&value to convert to a JavaScript value3456789zhijklmnopqrstuvw !"#$%&'()*+,-./0123456789*+)('&%$#"! ,-.1/023456789%%$#"! &'()*+,-./0123456789zhijklmnopqrstuvwNone24 :CGet a property value given the object and the name of the property.;DGet a property value given the object and the index of the property.<%Gets the value of a property given a .=This version of <_ is handy when you also need to perform. another operation on the object the property is on.>CSet a property value given the object and the name of the property.?DSet a property value given the object and the index of the property.@%Sets the value of a property given a .{:We can pass a property as the only paramter to a function.|!We can use a property as a value.}#We can use a property as an object.~2JSPropRef can be made by evaluating a function in  A as long as it returns something we can make into a JSPropRef.*If we already have a JSPropRef we are fine :object to find the property on.name of the property.exception if one is raised.returns the property value.;object to find the property on.index of the property.exception if one is raised.returns the property value.<property reference.returns the property value.=property reference.&returns the object and property value.>object 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.?object to find property on.index of the property.!new value to set the property to.exception if one is raised.@property reference.!new value to set the property to.{|}~  :;<=>?@  :;<=>?@ :;<=>?@{|}~None24HM!A7Type used for Haskell functions called from JavaScript.B0Java script function applications have this type@Make a JavaScript function object that wraps a Haskell function.CLookup a property based on its name. This function just constructs a JSPropRef the lookup is delayed until we use the JSPropRef. This makes it a bit lazy compared to JavaScript's . operator.)testJSaddle $ eval "'Hello World'.length"*testJSaddle $ val "Hello World" ! "length"11DLookup a property based on its index. This function just constructs a JSPropRef the lookup is delayed until we use the JSPropRef. This makes it a bit lazy compared to JavaScript's [] operator.%testJSaddle $ eval "'Hello World'[6]"$testJSaddle $ val "Hello World" !! 6WE.Makes a getter for a particular property name. js name = to (!name))testJSaddle $ eval "'Hello World'.length".testJSaddle $ val "Hello World" ^. js "length"11FHandy way to call a function  jsf name = js name . to (# args):testJSaddle $ val "Hello World" ^. jsf "indexOf" ["World"]6G6Handy way to call a function that expects no arguments js0 name = jsf name ()4testJSaddle $ val "Hello World" ^. js0 "toLowerCase" hello worldH6Handy way to call a function that expects one argument js1 name a0 = jsf name [a0]8testJSaddle $ val "Hello World" ^. js1 "indexOf" "World"6I7Handy way to call a function that expects two argumentsJ9Handy way to call a function that expects three argumentsK8Handy way to call a function that expects four argumentsL8Handy way to call a function that expects five argumentsM?Handy way to get and hold onto a reference top level javascript6testJSaddle $ eval "w = console; w.log('Hello World')"DtestJSaddle $ do w <- jsg "console"; w ^. js "log" # ["Hello World"]11NCall a JavaScript function3testJSaddle $ eval "'Hello World'.indexOf('World')"7testJSaddle $ val "Hello World" ! "indexOf" # ["World"]6OCall a JavaScript function-testJSaddle $ eval "var j = {}; j.x = 1; j.x"6testJSaddle $ do {j <- eval "({})"; j!"x" <# 1; j!"x"}1P*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 "Date" (2013, 1, 1)(Fri Feb 01 2013 00:00:00 GMT+1300 (NZDT)QCall function with a given this$. In most cases you should use '#'.BtestJSaddle $ eval "(function(){return this;}).apply('Hello', [])"ZtestJSaddle $ do { test <- eval "(function(){return this;})"; call test (val "Hello") () }HelloR1Make an empty object using the default constuctor3testJSaddle $ eval "var a = {}; a.x = 'Hello'; a.x"BtestJSaddle $ do { a <- obj; a ^. js "x" <# "Hello"; a ^. js "x" }HelloS 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)})"testJSaddle $ call (eval "(function(f) {f('Hello');})") global [fun $ \ _ _ args -> valToText (head args) >>= (liftIO . putStrLn . T.unpack) ]Hello undefinedU.Make an JavaScript array from a list of values*testJSaddle $ eval "['Hello', 'World'][1]"+testJSaddle $ array ["Hello", "World"] !! 1World8testJSaddle $ eval "['Hello', null, undefined, true, 1]"<testJSaddle $ array ("Hello", JSNull, (), True, 1.0::Double)Hello,,,true,1VJavaScript'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 listWBGet a list containing the property names present on a given objectQGet a list containing references to all the properties present on a given objectX:Call a JavaScript object as function. Consider using '#'.Y:Call a JavaScript object as a constructor. Consider using P.|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 T to create one with a name.4JSObjectRef can be made by evaluating a function in  C as long as it returns something we can make into a JSObjectRef.,If we already have a JSObjectRef we are fine$AFunction 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.BCObject to look onName of the property to findProperty referenceDObject to look onIndex of the property to lookupProperty referenceEName of the property to findFGHIJKLMNOProperty to setValue to set it toReference to the property setPQRSTName of the functionHaskell function to callXReturns a JavaScript function object that will call the Haskell one when it is calledUVWXYABCDEFGHIJKLMNOPQRSTUVWXYCDEBFGHIJKLMONPQRTSAUVWXY$ABCDEFGHIJKLMNOPQRSTUVWXYNO NoneZ7Evaluates a script (like eval in java script). Unlike [e 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") >>= valToText+SyntaxError: Expected token '}',FileName,55[-Evaluates a script (like eval in java script)testJSaddle $ eval "1+1"2ZJavaScript to evaluate/The Line number of the first line of the script[JavaScript to evaluateZ[Z[Z[ NoneX  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[           !"#$%&'()*+,-./01234567889:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdef g hijk l m n o p qrstuvwxyz{|}~jsaddle-0.2.0.3!Language.Javascript.JSaddle.Types&Language.Javascript.JSaddle.Properties!Language.Javascript.JSaddle.Monad%Language.Javascript.JSaddle.Exception#Language.Javascript.JSaddle.Classes"Language.Javascript.JSaddle.String!Language.Javascript.JSaddle.Value"Language.Javascript.JSaddle.Object$Language.Javascript.JSaddle.Evaluate#Language.Javascript.JSaddle.PropRef%Language.Javascript.JSaddle.ArgumentsLanguage.Javascript.JSaddle"webkitgtk3-javascriptcore-0.13.0.31Graphics.UI.Gtk.WebKit.JavaScriptCore.JSObjectRefJSPropertyAttributes,Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase JSContextRef JSStringRefJSPropertyNameArrayRef JSValueRef JSObjectRef JSValueRefRefIndex JSPropRefJSPropIndexRefJSMcatchcatchval runJSaddle runJSaddle_ JSExceptionrethrow MakePropRef makePropRef MakeObjectRef makeObjectRef MakeArgRefs makeArgRefs MakeStringRef makeStringRef MakeValueRef makeValueRef strToText textToStrJSValue ValObject ValString ValNumberValBool ValUndefinedValNullJSStringJSNumberJSBool JSUndefinedJSNull valToBool valToNumbervalToStr valToText valToJSON valToObjectval valMakeNullvalMakeUndefined valMakeBool valMakeNumber valMakeStringdeRefVal valMakeRefobjGetPropertyByNameobjGetPropertyAtIndexobjGetPropertyobjGetProperty'objSetPropertyByNameobjSetPropertyAtIndexobjSetPropertyJSCallAsFunctionJSF!!!jsjsfjs0js1js2js3js4js5jsg#<#newcallobjfunfunctionarrayglobal propertyNamesobjCallAsFunctionobjCallAsConstructorevaluateScriptevalbaseControl.Exception.Base$fExceptionJSException$fMakeArgRefs(,,,,)$fMakeArgRefs(,,,)$fMakeArgRefs(,,)$fMakeArgRefs(,)$fMakeArgRefs[]$fMakeArgRefsReaderT text-1.2.0.4Data.Text.InternalText$fMakeStringRefPtr$fMakeStringRef[]$fMakeStringRefText$fMakeArgRefsJSValue$fMakeValueRefJSValue$fMakeValueRef[]$fMakeArgRefsText$fMakeValueRefText$fMakeArgRefsDouble$fMakeValueRefDouble$fMakeArgRefsBool$fMakeValueRefBool$fMakeArgRefs()$fMakeValueRef()$fMakeArgRefsJSNull$fMakeValueRefJSNull$fMakeValueRefReaderT$fMakeArgRefsPtr$fMakeValueRefPtrghc-prim GHC.TypesDoubleBool$fMakeObjectRefJSNull$fMakeArgRefsJSPropRef$fMakeValueRefJSPropRef$fMakeObjectRefJSPropRef$fMakePropRefReaderT$fMakePropRefJSPropRef mkJSObjectCallAsFunctionCallbackcopyPropertyNamespropertyNamesCountpropertyNamesAtpropertyNamesList properties$fMakeValueRef(->)$fMakeObjectRefReaderT$fMakeObjectRefPtr makeArray$fMakeArgRefs(->)