śĪčIąž^      !"#$%&'()*+,-./0123456789:;<=>?@ABC D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] 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 jQuasi quoter that creates a JavaScript string from JMacro expression and stores it in a string litteral iQuasi quoter that creates a JavaScript string from JMacro statement and stores it in a string litteral ^ _   ^ _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.hsWrapped 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 onesaaNoneAAnything 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    None24bcdefgbcdefgNone24)Convert a JavaScript string to a Haskell h Convert a Haskell h to a JavaScript stringi,If we already have a JSStringRef we are fine jki   jkiNone24M&!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.00aGiven 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" >>= strToText11<Given a JavaScript value get its string value (as a Haskell h). 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"2KGiven 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{}3HGiven 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"141Convert to a JavaScript value (just an alias for )5Make a null JavaScript value6Make an  undefined JavaScript value7Make a JavaScript boolean value8Make a JavaScript number9Make a JavaScript string:Derefernce 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...;!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"lBMakes an argument list with just a single JavaScript value from a ! ADT.m Makes a JavaScript value from a ! ADT.nMakes a JavaScript stringo;Makes an argument list with just a single JavaScript stringpMakes a JavaScript stringq;Makes an argument list with just a single JavaScript numberrMakes a JavaScript numbersBMakes an argument list with just a single JavaScript boolean valuetMake a JavaScript boolean valueuGThis allows us to pass no arguments easily (altenative would be to use []::[JSValueRef]).v Makes an  undefined JavaScript valuew*Makes an argument list with just a single null JavaScript valuexMakes a null JavaScript valuey3JSValueRef can be made by evaluating a function in  B as long as it returns something we can make into a JSValueRef.z4A single JSValueRef can be used as the argument list{+If we already have a JSValueRef we are fine,!"#$%&'(7JavaScript strings can be represented with the Haskell h type.)&A number in JavaScript maps nicely to |.*"JavaScript boolean values map the } haskell type.+‘A type that can only be undefined in JavaScript. Using () because functions in JavaScript that have no return, impicitly return undefined.,-./01234&value to convert to a JavaScript value56789:;~lmnopqrstuvwxyz{!"#$%&'()*+,-./0123456789:;,-+*)(!'&%$#"./0312456789:;%!'&%$#"()*+,-./0123456789:;~lmnopqrstuvwxyz{None24 <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.ADSet a property value given the object and the index of the property.B%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.Aobject to find property on.index of the property.!new value to set the property to.exception if one is raised.Bproperty reference.!new value to set the property to.€‚ƒ  <=>?@AB  <=>?@AB <=>?@AB€‚ƒ None24HM!C7Type used for Haskell functions called from JavaScript.D0Java script function applications have this type„@Make a JavaScript function object that wraps a Haskell function.E»Lookup 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"11F¼Lookup 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" !! 6WG.Makes a getter for a particular property name. js name = to (!name))testJSaddle $ eval "'Hello World'.length".testJSaddle $ val "Hello World" ^. js "length"11HHandy way to call a function  jsf name = js name . to (# args):testJSaddle $ val "Hello World" ^. jsf "indexOf" ["World"]6I6Handy way to call a function that expects no arguments js0 name = jsf name ()4testJSaddle $ val "Hello World" ^. js0 "toLowerCase" hello worldJ6Handy way to call a function that expects one argument js1 name a0 = jsf name [a0]8testJSaddle $ val "Hello World" ^. js1 "indexOf" "World"6K7Handy way to call a function that expects two argumentsL9Handy way to call a function that expects three argumentsM8Handy way to call a function that expects four argumentsN8Handy way to call a function that expects five argumentsO?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"]11PCall a JavaScript function3testJSaddle $ eval "'Hello World'.indexOf('World')"7testJSaddle $ val "Hello World" ! "indexOf" # ["World"]6QCall a JavaScript function-testJSaddle $ eval "var j = {}; j.x = 1; j.x"6testJSaddle $ do {j <- eval "({})"; j!"x" <# 1; j!"x"}1R*Use this to create a new JavaScript object%testJSaddle $ new "Date" (2013, 1, 1)(Fri Feb 01 2013 00:00:00 GMT+1300 (NZDT)SCall 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") () }HelloT1Make 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" }HelloU 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 undefinedW.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,1XJavaScript's global object…DGet an array containing the property names present on a given object†0Get the number of names in a property name array‡'Get a name out of a property name arrayˆ Convert property array to a listYBGet a list containing the property names present on a given object‰QGet a list containing references to all the properties present on a given objectZ6Call a JavaScript object as function. Consider using '#'.[:Call a JavaScript object as a constructor. Consider using R.Š|A callback to Haskell can be used as a JavaScript value. This will create an anonymous JavaScript function object. Use V 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$CFunction 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.D„EObject to look onName of the property to findProperty referenceFObject to look onIndex of the property to lookupProperty referenceGName of the property to findHIJKLMNOPQProperty to setValue to set it toReference to the property setRSTUVName of the functionHaskell function to callXReturns a JavaScript function object that will call the Haskell one when it is calledWX…†‡ˆY‰Z[ŽŠ‹ŒCDEFGHIJKLMNOPQRSTUVWXYZ[EFGDHIJKLMNOQPRSTVUCWXYZ[$CD„EFGHIJKLMNOPQRSTUVWX…†‡ˆY‰Z[ŽŠ‹ŒPQ None\7Evaluates 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"2\JavaScript to evaluate/The Line number of the first line of the script]JavaScript to evaluate\]\]\] NoneZ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]    !""#$%&'()*+,-./0123456789:;;<=>?@ABCDEFGHIJKLMNOP Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j klmnop q r s t u vwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽŽ‘’“”•– — ˜ ™ š › œ  ž Ÿ   ”¢jsaddle-0.1.1.3!Language.Javascript.JSaddle.Types&Language.Javascript.JSaddle.Properties"Language.Javascript.JSaddle.JMacro!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.12.5.11Graphics.UI.Gtk.WebKit.JavaScriptCore.JSObjectRefJSPropertyAttributes,Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase JSContextRef JSStringRefJSPropertyNameArrayRef JSValueRef JSObjectRef JSValueRefRefIndex JSPropRefJSPropIndexRefevalJMEevalJMJSMcatchcatchval 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 propertyNamesobjCallAsFunctionobjCallAsConstructorevaluateScripteval quoteEvalJME quoteEvalJMbaseControl.Exception.Base$fExceptionJSException$fMakeArgRefs(,,,,)$fMakeArgRefs(,,,)$fMakeArgRefs(,,)$fMakeArgRefs(,)$fMakeArgRefs[]$fMakeArgRefsReaderT text-1.1.1.3Data.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(->)