!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                           NoneSafe  !"  !"None59;IThe 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 7Type used for Haskell functions called from JavaScript.S Function objectthisFunction arguments Only () (aka  JSUndefined) 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.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP#QRSTUVWXYJ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQJKLIJDE >?H<=Q OPMNBC@AFG./0123456789:;"#$%&'()*+,- !   !" #$%&'()*+,-. /0123456789:;<=>?@ABCDEFGHIJKLMNOP#QRSTUVWXYNone9;}?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 reference'If we already have a Object we are fine}~}~}~}~None0JavaScript exception >>>None9;)Convert a JavaScript string to a Haskell $Convert a Haskell $ to a JavaScript string>>NoneNone[-Forces execution of pending asyncronous code >Forces execution of pending asyncronous code after performing f %0"#$%&'()*+,-./0123456789:;0./0123456789:;"#$%&'()*+,-% NonebWrapped 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  Q Q None9;hAnything that can be used to make a list of JavaScript value references for use as function arguments  None9;T[0UAn algebraic data type that can represent a JavaScript value. Any JavaScriptCore K! can be converted into this type.null undefined true or falsea numbera string an objectpType that represents a value that can only be null. Haskell of course has no null so we are adding this type.IShow a JSValue but just say "object" if the value is a JavaScript object.\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"trueIGiven 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.0aGiven a JavaScript value get its string value (as a JavaScript string). May throw JSException.+testJSaddle $ strToText <$> valToStr JSNullnull'testJSaddle $ strToText <$> valToStr () undefined)testJSaddle $ strToText <$> valToStr Truetrue*testJSaddle $ strToText <$> valToStr Falsefalse4testJSaddle $ strToText <$> valToStr (1.0 :: Double)14testJSaddle $ strToText <$> valToStr (0.0 :: Double)0'testJSaddle $ strToText <$> valToStr ""(testJSaddle $ strToText <$> valToStr "1"1<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"KGiven a JavaScript value get a JSON string value. May throw JSException. ,testJSaddle $ strToText <$> valToJSON JSNullnull(testJSaddle $ strToText <$> valToJSON ()*testJSaddle $ strToText <$> valToJSON Truetrue+testJSaddle $ strToText <$> valToJSON Falsefalse5testJSaddle $ strToText <$> valToJSON (1.0 :: Double)15testJSaddle $ strToText <$> valToJSON (0.0 :: Double)0(testJSaddle $ strToText <$> valToJSON """")testJSaddle $ strToText <$> valToJSON "1""1"/testJSaddle $ strToText <$> (obj >>= valToJSON){}HGiven a JavaScript value get its object value. May throw JSException.YtestJSaddle $ (valToObject JSNull >>= valToText) `catch` \ (JSException e) -> valToText enullUtestJSaddle $ (valToObject () >>= valToText) `catch` \ (JSException e) -> valToText e undefinedtestJSaddle $ valToObject TruetruetestJSaddle $ valToObject Falsefalse)testJSaddle $ valToObject (1.0 :: Double)1)testJSaddle $ valToObject (0.0 :: Double)0testJSaddle $ valToObject ""testJSaddle $ valToObject "1"11Convert to a JavaScript value (just an alias for )A null JavaScript value(Test a JavaScript value to see if it is nullAn  undefined JavaScript value(Test a JavaScript value to see if it is  undefinedKConvert a JSVal to a Maybe JSVal (converting null and undefined to Nothing)A JavaScript boolean valueMake a JavaScript number(Make a JavaScript string from $Make a JavaScript string from >Derefernce 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)true0testJSaddle $ showJSValue <$> (obj >>= deRefVal)object!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")HelloDetermine if two values are equal (JavaScripts ===) >>> testJSaddle $ strictEqual True False false >>> testJSaddle $ strictEqual True True true >>> testJSaddle $ strictEqual Hello* () false >>> testJSaddle $ strictEqual Hello Hello true^Determine if two values are equal (JavaScripts ===) >>> testJSaddle $ instanceOf obj (Object  $ jsg Object) trueBMakes 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.&value to convert to a JavaScript value(#>K#K>6( None9;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.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.object to find the property on.name of the property.returns the property value.object to find the property on.index of the property.returns the property value.object to set the property on.name of the property.!new value to set the property to.object to find property on.index of the property.!new value to set the property to. None9;OT%@Make a JavaScript function object that wraps a Haskell function.0Java script function applications have this type$Lookup a property based on its name.)testJSaddle $ eval "'Hello World'.length"11*testJSaddle $ val "Hello World" ! "length"11%Lookup a property based on its index.%testJSaddle $ eval "'Hello World'[6]"W$testJSaddle $ val "Hello World" !! 6W.Makes a getter for a particular property name. js name = to (!name))testJSaddle $ eval "'Hello World'.length"11.testJSaddle $ val "Hello World" ^. js "length"11.Makes a setter for a particular property name. jss name = to (<#name).testJSaddle $ eval "'Hello World'.length = 12"122testJSaddle $ val "Hello World" ^. jss "length" 12 undefinedHandy way to call a function %jsf name = to (\o -> o # name $ args):testJSaddle $ val "Hello World" ^. jsf "indexOf" ["World"]66Handy way to call a function that expects no arguments js0 name = jsf name ()4testJSaddle $ val "Hello World" ^. js0 "toLowerCase" hello world6Handy way to call a function that expects one argument js1 name a0 = jsf name [a0]8testJSaddle $ val "Hello World" ^. js1 "indexOf" "World"67Handy way to call a function that expects two arguments9Handy way to call a function that expects three arguments8Handy way to call a function that expects four arguments8Handy 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')" undefinedAtestJSaddle $ do w <- jsg "console"; w ^. js1 "log" "Hello World" undefinedHandy 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"]56Handy way to call a function that expects no arguments jsg0 name = jsgf name ()-testJSaddle $ jsg0 "globalFunc" >>= valToTextTypeError:...undefine...6Handy way to call a function that expects one argument jsg1 name a0 = jsgf name [a0]'testJSaddle $ jsg1 "globalFunc" "World"57Handy way to call a function that expects two arguments9Handy way to call a function that expects three arguments8Handy way to call a function that expects four arguments8Handy way to call a function that expects five argumentsCall a JavaScript function3testJSaddle $ eval "'Hello World'.indexOf('World')"67testJSaddle $ val "Hello World" # "indexOf" $ ["World"]6Call a JavaScript functionhtestJSaddle $ eval "something = {}; something[6]=function (x) {return x.length;}; something[6]('World')"5.testJSaddle $ jsg "something" ## 6 $ ["World"]5Set a JavaScript property-testJSaddle $ eval "var j = {}; j.x = 1; j.x"10testJSaddle $ do {j <- obj; (j <# "x") 1; j!"x"}1Set a JavaScript property/testJSaddle $ eval "var j = {}; j[6] = 1; j[6]"1.testJSaddle $ do {j <- obj; (j <## 6) 1; j!!6}1*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+... (...)Call 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") () }Hello1Make 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" }Hello 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)})" undefinedtestJSaddle . deRefVal $ call (eval "(function(f) {f('Hello');})") global [fun $ \ _ _ args -> valToText (head args) >>= (liftIO . putStrLn . T.unpack) ]Hello undefined.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,1JavaScript's global objectkGet a list containing the property names present on a given object >>> testJSaddle $ show . map strToText  $? propertyNames obj [] >>> testJSaddle $ show . map strToText  $/ propertyNames (eval "({x:1, y:2})") ["x","y"] QGet a list containing references to all the properties present on a given object 6Call a JavaScript object as function. Consider using . :Call a JavaScript object as a constructor. Consider using .|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  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.7+Object to look onName of the property to findProperty referenceObject to look onIndex of the property to lookupProperty referenceName of the property to findName of the property to findObject to set the property onName of the property to setValue to set it toObject to set the property onIndex of the property to setValue to set it toHaskell function to callXReturns a JavaScript function object that will call the Haskell one when it is called     - D}~    -D}~     4+     2211None9;-Evaluates a script (like eval in java script)testJSaddle $ eval "1+1"2JavaScript to evaluateNone  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ}~    None[,-./,-./0 !"#$%&'()*+,-./00123456789:;<=>?@ABCDEFGHIJKKLLMMNNOOPPQRRSSTTUUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                          !"#$%&'()*)* +,-.,-/ 012345&jsaddle-0.5.0.2-JeQYlaG367h1Z5cYDoLPS1,Language.Javascript.JSaddle.WebSockets.Files Paths_jsaddle!Language.Javascript.JSaddle.Types#Language.Javascript.JSaddle.Classes%Language.Javascript.JSaddle.Exception"Language.Javascript.JSaddle.String"Language.Javascript.JSaddle.Native&Language.Javascript.JSaddle.WebSockets!Language.Javascript.JSaddle.Monad%Language.Javascript.JSaddle.Arguments!Language.Javascript.JSaddle.Value&Language.Javascript.JSaddle.Properties"Language.Javascript.JSaddle.Object$Language.Javascript.JSaddle.Evaluate Language.Javascript.JSaddle.TestLanguage.Javascript.JSaddle mkEmbeddedversion getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNameJSMJSCallAsFunction JSContextRef doSendCommanddoSendAsyncCommand addCallback freeCallbacknextRefResultDeRefValResultValueToBoolResultValueToNumberResultValueToStringResultValueToJSONResult IsNullResultIsUndefinedResultStrictEqualResultInstanceOfResultCallbackPropertyNamesResult ThrowJSValue ProtocolError SyncResultBatchCommandDeRefVal ValueToBool ValueToNumber ValueToString ValueToJSONIsNull IsUndefined StrictEqual InstanceOf PropertyNamesSync AsyncCommandFreeRefSetPropertyByNameSetPropertyAtIndex StringToValue NumberToValueGetPropertyByNameGetPropertyAtIndexCallAsFunctionCallAsConstructorNewEmptyObject NewCallbackNewArrayEvaluateScriptNullableJSStringJSStringForSendJSStringReceivedObjectJSObjectForSendIndexMutableJSArrayJSValJSValueForSendJSValueReceived runJSaddle$fFromJSONResult$fToJSONResult$fFromJSONBatch $fToJSONBatch$fFromJSONCommand$fToJSONCommand$fFromJSONAsyncCommand$fToJSONAsyncCommand$fShowJSValueReceived$fToJSONJSValueReceived$fFromJSONJSValueReceived$fShowJSValueForSend$fToJSONJSValueForSend$fFromJSONJSValueForSend $fShowJSVal $fToJSONJSVal$fFromJSONJSVal$fShowMutableJSArray$fToJSONMutableJSArray$fFromJSONMutableJSArray$fShowJSObjectForSend$fToJSONJSObjectForSend$fFromJSONJSObjectForSend $fShowObject$fToJSONObject$fFromJSONObject$fShowJSStringReceived$fToJSONJSStringReceived$fFromJSONJSStringReceived$fShowJSStringForSend$fToJSONJSStringForSend$fFromJSONJSStringForSend$fShowJSString$fToJSONJSString$fFromJSONJSString$fShowAsyncCommand$fGenericAsyncCommand $fShowCommand$fGenericCommand $fShowBatch$fGenericBatch $fShowResult$fGenericResult MakeObject makeObject ToJSString toJSStringToJSValtoJSVal$fMakeObjectObject$fToJSValObject JSException$fExceptionJSException$fShowJSException strToText textToStr wrapJSVal wrapJSString withJSVal withJSVals withObject withJSString withToJSVal sendCommandsendLazyCommandsendAsyncCommand syncPoint syncAfter jsaddleOrruncatchbracketMakeArgsmakeArgs$fMakeArgs(,,,,,)$fMakeArgs(,,,,)$fMakeArgs(,,,)$fMakeArgs(,,) $fMakeArgs(,) $fMakeArgs[]$fMakeArgsReaderTJSValueValNull ValUndefinedValBool ValNumber ValString ValObject JSUndefinedJSNull showJSValue valToBool valToNumbervalToStr valToText valToJSON valToObjectvalvalNull valIsNull valUndefinedvalIsUndefinedmaybeNullOrUndefinedmaybeNullOrUndefined'valBool valMakeNumber valMakeStringdeRefVal valMakeRef strictEqual instanceOf$fMakeArgsJSValue$fToJSValJSValue$fToJSString[]$fToJSStringText$fToJSStringJSString$fToJSValJSString $fToJSVal[]$fMakeArgsText $fToJSValText$fMakeArgsDouble$fToJSValInt64$fToJSValInt32 $fToJSValInt$fToJSValWord64$fToJSValWord32 $fToJSValWord$fToJSValFloat$fToJSValDouble$fMakeArgsBool $fToJSValBool $fMakeArgs() $fToJSVal()$fToJSValMaybe$fMakeArgsJSNull$fToJSValJSNull$fToJSValReaderT$fMakeArgsJSVal$fToJSValJSVal$fMakeObjectJSValobjGetPropertyByNameobjGetPropertyAtIndexobjSetPropertyByNameobjSetPropertyAtIndexFunctionfunctionCallbackfunctionObjectJSF!!!jsjssjsfjs0js1js2js3js4js5jsgjsgfjsg0jsg1jsg2jsg3jsg4jsg5###<#<##newcallobjfunfunction freeFunctionarrayglobal propertyNames propertiesobjCallAsFunctionobjCallAsConstructor nullObject $fToJSVal[]0 $fToJSVal[]1 $fToJSVal[]2 $fToJSVal[]3 $fToJSVal[]4 $fToJSVal[]5 $fToJSVal[]6 $fToJSVal[]7$fMakeArgs(->) $fToJSVal(->)$fToJSValFunction$fMakeObjectReaderTeval testJSaddlelistWindowPropertiescatchIObindirlibdirdatadir libexecdir sysconfdirJSRef#text-1.2.2.1-9Yh8rJoh8fO2JMLWffT3QsData.Text.InternalText jsaddleAppbaseControl.Exception.Base valMakeTextghc-prim GHC.TypesBoolDoubleHaskellCallbackcontextserver startServerdebugLog