Permalink
Browse files

* Put the JS v constraints back in

  • Loading branch information...
spockz committed Jan 15, 2012
1 parent 1f49236 commit b1c93198cc148f7f03e923f19a6387630067ef3e
@@ -11,7 +11,6 @@ data JQXHRPtr
type JQXHR = JSPtr JQXHRPtr
--- type AjaxCallback r = JS r => r -> String -> JQXHR -> IO()
type AjaxCallback r = r -> String -> JQXHR -> IO()
type JSAjaxCallback r = JSFunPtr (AjaxCallback r)
@@ -52,7 +51,7 @@ toJSOptions options = let url' = toJS (ao_url options)
}
-ajaxBackend :: (JS r) => (JSPtr a -> IO ()) -> AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
+ajaxBackend :: (JS r, JS v) => (JSPtr a -> IO ()) -> AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
ajaxBackend cont options valdata onSuccess onFailure =
do let jsOptions = toJSOptions options
onSuccess' <- mkJSAjaxCallback onSuccess
@@ -64,7 +63,7 @@ ajaxBackend cont options valdata onSuccess onFailure =
_ <- setAttr "data" valdata o
_ajaxQ (toJS "jcu_app") o
-ajax :: (JS r) => AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
+ajax :: (JS r, JS v) => AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
ajax = ajaxBackend _ajax
@@ -8,7 +8,7 @@ import Language.UHC.JScript.JQuery.Ajax
import Language.UHC.JScript.Assorted (alert, _alert)
-ajaxQ :: (JS r) => String -> AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
+ajaxQ :: (JS r, JS v) => String -> AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
ajaxQ queuename = ajaxBackend (_ajaxQ $ toJS queuename)
foreign import jscript "$.ajaxq(%*)"

0 comments on commit b1c9319

Please sign in to comment.