Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename JScript to js

  • Loading branch information...
commit db0ce06d3acf29e9f16067a1875f4aa0d18af102 1 parent a3d3e2f
@spockz authored
Showing with 260 additions and 260 deletions.
  1. 0  {uhc-jscript → uhc-js}/LICENSE
  2. 0  {uhc-jscript → uhc-js}/Makefile
  3. 0  {uhc-jscript → uhc-js}/Setup.hs
  4. 0  {uhc-jscript → uhc-js}/clean
  5. 0  {uhc-jscript → uhc-js}/make
  6. +1 −1  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Assorted.hs
  7. 0  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone.hs
  8. +23 −23 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/Collection.hs
  9. +7 −7 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/Events.hs
  10. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/History.hs
  11. +29 −29 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/Model.hs
  12. +5 −5 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/Router.hs
  13. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/Sync.hs
  14. +1 −1  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/Utility.hs
  15. +9 −9 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Backbone/View.hs
  16. 0  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/ECMA.hs
  17. +38 −38 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/ECMA/Array.hs
  18. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/ECMA/Bool.hs
  19. +1 −1  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/ECMA/Expressions.hs
  20. +26 −26 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/ECMA/String.hs
  21. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JQuery/Ajax.hs
  22. +1 −1  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JQuery/AjaxQueue.hs
  23. +3 −3 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JQuery/Deferred.hs
  24. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JQuery/Draggable.hs
  25. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JQuery/Droppable.hs
  26. +45 −45 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JQuery/JQuery.hs
  27. +4 −4 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/JSON2/JSON2.hs
  28. +2 −2 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Prelude.hs
  29. +1 −1  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Primitives.hs
  30. +1 −1  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/SafeTypes.hs
  31. 0  {uhc-jscript → uhc-js}/src/Language/UHC/JScript/Types.hs
  32. +37 −37 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/W3C/HTML5.hs
  33. +5 −5 {uhc-jscript → uhc-js}/src/Language/UHC/JScript/WebWorker.hs
  34. 0  {uhc-jscript → uhc-js}/src/Main.hs
  35. +9 −9 uhc-jscript/uhc-jscript.cabal → uhc-js/uhc-js.cabal
View
0  uhc-jscript/LICENSE → uhc-js/LICENSE
File renamed without changes
View
0  uhc-jscript/Makefile → uhc-js/Makefile
File renamed without changes
View
0  uhc-jscript/Setup.hs → uhc-js/Setup.hs
File renamed without changes
View
0  uhc-jscript/clean → uhc-js/clean
File renamed without changes
View
0  uhc-jscript/make → uhc-js/make
File renamed without changes
View
2  ...ript/src/Language/UHC/JScript/Assorted.hs → uhc-js/src/Language/UHC/JScript/Assorted.hs
@@ -7,5 +7,5 @@ import Language.UHC.JScript.Primitives
alert :: String -> IO ()
alert = _alert . toJS
-foreign import jscript "alert(%*)"
+foreign import js "alert(%*)"
_alert :: JSString -> IO ()
View
0  ...ript/src/Language/UHC/JScript/Backbone.hs → uhc-js/src/Language/UHC/JScript/Backbone.hs
File renamed without changes
View
46 ...nguage/UHC/JScript/Backbone/Collection.hs → ...nguage/UHC/JScript/Backbone/Collection.hs
@@ -10,10 +10,10 @@ import Language.UHC.JScript.Types
data BBCollectionPtr a
type BBCollection a = JSPtr (BBCollectionPtr a)
-foreign import jscript "Backbone.Collection.extend(%*)"
+foreign import js "Backbone.Collection.extend(%*)"
extend :: AnonObj -> IO (JSFunPtr a)
-foreign import jscript "Backbone.Collection.extend(%*)"
+foreign import js "Backbone.Collection.extend(%*)"
extend' :: AnonObj -> AnonObj -> IO (JSFunPtr a)
model :: JSFunPtr b -> BBCollection a -> IO (BBCollection a)
@@ -22,47 +22,47 @@ model = setAttr "model"
models :: BBCollection a -> IO (JSArray (BBModel b))
models = getAttr "models"
-foreign import jscript "%1.toJSON()"
+foreign import js "%1.toJSON()"
toJSON :: BBCollection a -> IO (JSArray b)
-- TODO: Underscore methods
-foreign import jscript "%1.add(%*)"
+foreign import js "%1.add(%*)"
add :: BBCollection a -> BBModel b -> IO ()
-foreign import jscript "%1.add(%*)"
+foreign import js "%1.add(%*)"
add' :: BBCollection a -> BBModel b -> AnonObj -> IO ()
-foreign import jscript "%1.add(%*)"
+foreign import js "%1.add(%*)"
addA :: BBCollection a -> JSArray (BBModel b) -> IO ()
-foreign import jscript "%1.add(%*)"
+foreign import js "%1.add(%*)"
addA' :: BBCollection a -> JSArray (BBModel b) -> AnonObj -> IO ()
-foreign import jscript "%1.remove(%*)"
+foreign import js "%1.remove(%*)"
remove :: BBCollection a -> BBModel b -> IO ()
-foreign import jscript "%1.remove(%*)"
+foreign import js "%1.remove(%*)"
remove' :: BBCollection a -> BBModel b -> AnonObj -> IO ()
-foreign import jscript "%1.remove(%*)"
+foreign import js "%1.remove(%*)"
removeA :: BBCollection a -> JSArray (BBModel b) -> IO ()
-foreign import jscript "%1.remove(%*)"
+foreign import js "%1.remove(%*)"
removeA' :: BBCollection a -> JSArray (BBModel b) -> AnonObj -> IO ()
-foreign import jscript "%1.get(%*)"
+foreign import js "%1.get(%*)"
get :: BBCollection a -> Int -> IO (BBModel b)
getByCid :: String -> BBCollection a -> IO (BBModel b)
getByCid s c = _getByCid (toJS s) c
-foreign import jscript "%1.getByCid(%*)"
+foreign import js "%1.getByCid(%*)"
_getByCid :: JSString -> BBCollection a -> IO (BBModel b)
-foreign import jscript "%1.at(%*)"
+foreign import js "%1.at(%*)"
at :: Int -> IO (BBModel a)
clength :: BBCollection a -> IO Int
@@ -72,16 +72,16 @@ setComperator :: JSFunPtr a -> BBCollection b -> IO (BBCollection b)
setComperator = setAttr "comparator"
-foreign import jscript "%1.sort()"
+foreign import js "%1.sort()"
sort :: BBCollection a -> IO ()
-foreign import jscript "%1.sort(%*)"
+foreign import js "%1.sort(%*)"
sort' :: BBCollection a -> AnonObj -> IO ()
pluck :: BBCollection a -> String -> IO (JSArray b)
pluck c s = _pluck c (toJS s)
-foreign import jscript "%1.pluck(%*)"
+foreign import js "%1.pluck(%*)"
_pluck :: BBCollection a -> JSString -> IO (JSArray b)
setUrl :: String -> BBCollection a -> IO (BBCollection a)
@@ -94,20 +94,20 @@ setUrl' = setAttr "url"
-- TODO: parse
-foreign import jscript "%1.fetch()"
+foreign import js "%1.fetch()"
fetch :: BBCollection a -> IO ()
-foreign import jscript "%1.fetch(%*)"
+foreign import js "%1.fetch(%*)"
fetch' :: BBCollection a -> AnonObj -> IO ()
-foreign import jscript "%1.reset(%*)"
+foreign import js "%1.reset(%*)"
reset :: BBCollection a -> JSArray (BBModel b) -> IO ()
-foreign import jscript "%1.reset(%*)"
+foreign import js "%1.reset(%*)"
reset' :: BBCollection a -> JSArray (BBModel b) -> AnonObj -> IO ()
-foreign import jscript "%1.create(%*)"
+foreign import js "%1.create(%*)"
create :: BBCollection a -> JSArray (BBModel b) -> IO ()
-foreign import jscript "%1.create(%*)"
+foreign import js "%1.create(%*)"
create' :: BBCollection a -> JSArray (BBModel b) -> AnonObj -> IO ()
View
14 ...c/Language/UHC/JScript/Backbone/Events.hs → ...c/Language/UHC/JScript/Backbone/Events.hs
@@ -8,42 +8,42 @@ import Language.UHC.JScript.Types
bind :: JSPtr a -> String -> JSFunPtr b -> IO ()
bind p s = _bind p (toJS s)
-foreign import jscript "%1.bind(%*)"
+foreign import js "%1.bind(%*)"
_bind :: JSPtr a -> JSString -> JSFunPtr b -> IO ()
bind' :: JSPtr a -> String -> JSFunPtr b -> JSPtr b -> IO ()
bind' p s c = _bind' p (toJS s) c
-foreign import jscript "%1.bind(%*)"
+foreign import js "%1.bind(%*)"
_bind' :: JSPtr a -> JSString -> JSFunPtr b -> JSPtr b -> IO ()
-foreign import jscript "%1.unbind()"
+foreign import js "%1.unbind()"
unbind :: JSPtr a -> IO ()
unbind' :: JSPtr a -> String -> IO ()
unbind' p s = _unbind' p (toJS s)
-foreign import jscript "%1.unbind(%*)"
+foreign import js "%1.unbind(%*)"
_unbind' :: JSPtr a -> JSString -> IO ()
unbind'' :: JSPtr a -> String -> JSFunPtr b -> IO ()
unbind'' p s f = _unbind'' p (toJS s) f
-foreign import jscript "%1.unbind(%*)"
+foreign import js "%1.unbind(%*)"
_unbind'' :: JSPtr a -> JSString -> JSFunPtr b -> IO ()
trigger :: JSPtr a -> String -> IO ()
trigger p s = _trigger p (toJS s)
-foreign import jscript "%1.trigger(%*)"
+foreign import js "%1.trigger(%*)"
_trigger :: JSPtr a -> JSString -> IO ()
trigger' :: JSPtr a -> String -> AnonObj -> IO ()
trigger' p s o = _trigger' p (toJS s) o
-foreign import jscript "%1.trigger(%*)"
+foreign import js "%1.trigger(%*)"
_trigger' :: JSPtr a -> JSString -> AnonObj -> IO ()
-- etc.
View
4 .../Language/UHC/JScript/Backbone/History.hs → .../Language/UHC/JScript/Backbone/History.hs
@@ -3,8 +3,8 @@ module Language.UHC.JScript.Backbone.History where
import Language.UHC.JScript.Primitives
import Language.UHC.JScript.Types
-foreign import jscript "Backbone.history.start()"
+foreign import js "Backbone.history.start()"
start :: IO ()
-foreign import jscript "Backbone.history.start(%*)"
+foreign import js "Backbone.history.start(%*)"
start' :: AnonObj -> IO ()
View
58 ...rc/Language/UHC/JScript/Backbone/Model.hs → ...rc/Language/UHC/JScript/Backbone/Model.hs
@@ -8,53 +8,53 @@ import Language.UHC.JScript.Types
data BBModelPtr a
type BBModel a = JSPtr (BBModelPtr a)
-foreign import jscript "Backbone.Model.extend(%*)"
+foreign import js "Backbone.Model.extend(%*)"
extend :: AnonObj -> IO (JSFunPtr b)
-foreign import jscript "Backbone.Model.extend(%*)"
+foreign import js "Backbone.Model.extend(%*)"
extend' :: AnonObj -> AnonObj -> IO (JSFunPtr b)
get :: BBModel a -> String -> IO b
get p s = _get p (toJS s)
-foreign import jscript "%1.get(%2)"
+foreign import js "%1.get(%2)"
_get :: BBModel a -> JSString -> IO b
-foreign import jscript "%1.set(%2)"
+foreign import js "%1.set(%2)"
set :: BBModel a -> AnonObj -> IO ()
-foreign import jscript "%1.set(%*)"
+foreign import js "%1.set(%*)"
set' :: BBModel a -> AnonObj -> AnonObj -> IO ()
escape :: BBModel a -> String -> IO String
escape p s = fromJSM $ _escape p (toJS s)
-foreign import jscript "%1.escape(%2)"
+foreign import js "%1.escape(%2)"
_escape :: BBModel a -> JSString -> IO JSString
has :: BBModel a -> String -> IO Bool
has p s = _has p (toJS s)
-foreign import jscript "%1.has(%2)"
+foreign import js "%1.has(%2)"
_has :: BBModel a -> JSString -> IO Bool
unset :: BBModel a -> String -> IO ()
unset p s = _unset p (toJS s)
-foreign import jscript "%1.unset(%2)"
+foreign import js "%1.unset(%2)"
_unset :: BBModel a -> JSString -> IO ()
unset' :: BBModel a -> String -> AnonObj -> IO ()
unset' p s o = _unset' p (toJS s) o
-foreign import jscript "%1.unset(%*)"
+foreign import js "%1.unset(%*)"
_unset' :: BBModel a -> JSString -> AnonObj -> IO ()
-foreign import jscript "%1.clear()"
+foreign import js "%1.clear()"
clear :: BBModel a -> IO ()
-foreign import jscript "%1.clear(%*)"
+foreign import js "%1.clear(%*)"
clear' :: BBModel a -> AnonObj -> IO ()
silentOpt :: IO AnonObj
@@ -78,28 +78,28 @@ getModelAttributes = getAttr "attributes"
-- TODO: defaults
-foreign import jscript "%1.toJSON()"
+foreign import js "%1.toJSON()"
toJSON :: BBModel a -> IO AnonObj
-foreign import jscript "%1.fetch()"
+foreign import js "%1.fetch()"
fetch :: BBModel a -> IO ()
-foreign import jscript "%1.fetch(%*)"
+foreign import js "%1.fetch(%*)"
fetch' :: BBModel a -> AnonObj -> IO ()
-foreign import jscript "%1.save()"
+foreign import js "%1.save()"
save :: BBModel a -> IO ()
-foreign import jscript "%1.save(%*)"
+foreign import js "%1.save(%*)"
save' :: BBModel a -> AnonObj -> IO ()
-foreign import jscript "%1.save(%*)"
+foreign import js "%1.save(%*)"
save'' :: BBModel a -> AnonObj -> AnonObj -> IO ()
-foreign import jscript "%1.destroy()"
+foreign import js "%1.destroy()"
destroy :: BBModel a -> IO ()
-foreign import jscript "%1.destroy(%*)"
+foreign import js "%1.destroy(%*)"
destroy' :: BBModel a -> AnonObj -> IO ()
-- TODO: validate
@@ -115,7 +115,7 @@ setValidateFn = setAttr "validate"
getUrl :: BBModel a -> IO String
getUrl = fromJSM . _getUrl
-foreign import jscript "getUrl(%1)"
+foreign import js "getUrl(%1)"
_getUrl :: BBModel a -> IO JSString
@@ -142,36 +142,36 @@ setParseFn :: (AnonObj -> AnonObj) -> BBModel a -> IO (BBModel a)
setParseFn = setAttr "parse"
-foreign import jscript "%1.clone()"
+foreign import js "%1.clone()"
clone :: BBModel a -> IO (BBModel a)
-foreign import jscript "%1.isNew()"
+foreign import js "%1.isNew()"
isNew :: BBModel a -> IO Bool
-foreign import jscript "%1.change()"
+foreign import js "%1.change()"
change :: BBModel a -> IO ()
-foreign import jscript "%1.hasChanged()"
+foreign import js "%1.hasChanged()"
hasChanged :: BBModel a -> IO Bool
hasChanged' :: BBModel a -> String -> IO Bool
hasChanged' p a = _hasChanged' p (toJS a)
-foreign import jscript "%1.hasChanged(%2)"
+foreign import js "%1.hasChanged(%2)"
_hasChanged' :: BBModel a -> JSString -> IO Bool
-foreign import jscript "%1.changedAttributes()"
+foreign import js "%1.changedAttributes()"
changedAttributes :: BBModel a -> IO AnonObj
-foreign import jscript "%1.changedAttributes(%2)"
+foreign import js "%1.changedAttributes(%2)"
changedAttributes' :: BBModel a -> AnonObj -> IO AnonObj
previous :: BBModel a -> String -> IO b
previous p a = _previous p (toJS a)
-foreign import jscript "%1.previous(%2)"
+foreign import js "%1.previous(%2)"
_previous :: BBModel a -> JSString -> IO b
-foreign import jscript "%1.previousAttributes()"
+foreign import js "%1.previousAttributes()"
previousAttributes :: BBModel a -> IO AnonObj
View
10 ...c/Language/UHC/JScript/Backbone/Router.hs → ...c/Language/UHC/JScript/Backbone/Router.hs
@@ -7,10 +7,10 @@ import Language.UHC.JScript.Types
data BBRouterPtr
type BBRouter = JSPtr BBRouterPtr
-foreign import jscript "Backbone.Router.extend(%*)"
+foreign import js "Backbone.Router.extend(%*)"
extend :: AnonObj -> IO (JSFunPtr b)
-foreign import jscript "Backbone.Router.extend(%*)"
+foreign import js "Backbone.Router.extend(%*)"
extend' :: AnonObj -> AnonObj -> IO (JSFunPtr b)
getRoutes :: BBRouter -> IO AnonObj
@@ -22,18 +22,18 @@ setRoutes = setAttr "routes"
route :: BBRouter -> String -> String -> JSFunPtr a -> IO ()
route r s1 s2 f = _route r (toJS s1) (toJS s2) f
-foreign import jscript "%1.route(%*)"
+foreign import js "%1.route(%*)"
_route :: BBRouter -> JSString -> JSString -> JSFunPtr a -> IO ()
navigate :: String -> IO ()
navigate = _navigate . toJS
-foreign import jscript "%1.navigate(%*)"
+foreign import js "%1.navigate(%*)"
_navigate :: JSString -> IO ()
navigate' :: String -> Bool -> IO ()
navigate' s b = _navigate' (toJS s) b
-foreign import jscript "%1.navigate(%*)"
+foreign import js "%1.navigate(%*)"
_navigate' :: JSString -> Bool -> IO ()
View
4 ...src/Language/UHC/JScript/Backbone/Sync.hs → ...src/Language/UHC/JScript/Backbone/Sync.hs
@@ -8,13 +8,13 @@ import Language.UHC.JScript.Types
sync :: String -> BBModel a -> IO ()
sync s = _sync (toJS s)
-foreign import jscript "Backbone.sync(%*)"
+foreign import js "Backbone.sync(%*)"
_sync :: JSString -> BBModel a -> IO ()
sync' :: String -> BBModel a -> AnonObj -> IO ()
sync' s = _sync' (toJS s)
-foreign import jscript "Backbone.sync(%*)"
+foreign import js "Backbone.sync(%*)"
_sync' :: JSString -> BBModel a -> AnonObj -> IO ()
-- TODO: emulateHTTP
View
2  .../Language/UHC/JScript/Backbone/Utility.hs → .../Language/UHC/JScript/Backbone/Utility.hs
@@ -6,5 +6,5 @@ import Language.UHC.JScript.Types
data BackbonePtr
type Backbone = JSPtr BackbonePtr
-foreign import jscript "Backbone.noConflict()"
+foreign import js "Backbone.noConflict()"
noConflict :: Backbone
View
18 ...src/Language/UHC/JScript/Backbone/View.hs → ...src/Language/UHC/JScript/Backbone/View.hs
@@ -9,10 +9,10 @@ import Language.UHC.JScript.W3C.HTML5
data BBViewPtr
type BBView = JSPtr BBViewPtr
-foreign import jscript "Backbone.View.extend(%*)"
+foreign import js "Backbone.View.extend(%*)"
extend :: AnonObj -> IO (JSFunPtr b)
-foreign import jscript "Backbone.View.extend(%*)"
+foreign import js "Backbone.View.extend(%*)"
extend' :: AnonObj -> AnonObj -> IO (JSFunPtr b)
getEl :: BBView -> IO Element
@@ -27,35 +27,35 @@ jQuery = _jQuery . toJS
jQuery' :: String -> JSPtr a -> IO JQuery
jQuery' s j = _jQuery' (toJS s) j
-foreign import jscript "%1.$(%*)"
+foreign import js "%1.$(%*)"
_jQuery :: JSString -> IO JQuery
-foreign import jscript "%1.$(%*)"
+foreign import js "%1.$(%*)"
_jQuery' :: JSString -> JSPtr a -> IO JQuery
setRender :: JSFunPtr a -> BBView -> IO BBView
setRender = setAttr "render"
-foreign import jscript "%1.remove()"
+foreign import js "%1.remove()"
remove :: BBView -> IO ()
make :: String -> IO Element
make = _make . toJS
-foreign import jscript "%1.make(%*)"
+foreign import js "%1.make(%*)"
_make :: JSString -> IO Element
make' :: String -> AnonObj -> IO Element
make' s o = _make' (toJS s) o
-foreign import jscript "%1.make(%*)"
+foreign import js "%1.make(%*)"
_make' :: JSString -> AnonObj -> IO Element
make'' :: String -> AnonObj -> String -> IO Element
make'' s1 o s2 = _make'' (toJS s1) o (toJS s2)
-foreign import jscript "%1.make(%*)"
+foreign import js "%1.make(%*)"
_make'' :: JSString -> AnonObj -> JSString -> IO Element
-foreign import jscript "delegateEvents(%*)"
+foreign import js "delegateEvents(%*)"
delegateEvents :: AnonObj -> IO ()
View
0  uhc-jscript/src/Language/UHC/JScript/ECMA.hs → uhc-js/src/Language/UHC/JScript/ECMA.hs
File renamed without changes
View
76 ...pt/src/Language/UHC/JScript/ECMA/Array.hs → ...js/src/Language/UHC/JScript/ECMA/Array.hs
@@ -11,24 +11,24 @@ type JSArray x = BoxArray x
instance JS (JSArray a)
-foreign import jscript "%1.length"
+foreign import js "%1.length"
lengthJSArray :: JSArray x -> Int
-{- foreign import jscript "%1.toString"-}
+{- foreign import js "%1.toString"-}
{- toString :: JSArray x -> JSString-}
-{- foreign import jscript "%1.toLocaleString" toLocaleString :: JSArray x -> JSString-}
+{- foreign import js "%1.toLocaleString" toLocaleString :: JSArray x -> JSString-}
-- TODO: How do we deal with the fact that this fun can accept an arbitrary
-- number of arguments? How do we deal with non-arrays being passed? Do we need
-- to specified a ToJS constraint on those? Or can we let JS figure out what to
-- do?
-foreign import jscript "%1.concat(%*)"
+foreign import js "%1.concat(%*)"
concat :: JSArray x -> JSArray x -> JSArray x
-foreign import jscript "%1.concat(%*)"
+foreign import js "%1.concat(%*)"
concat2 :: JSArray x -> JSArray x -> JSArray x -> JSArray x
-foreign import jscript "%1.concat(%*)"
+foreign import js "%1.concat(%*)"
concat3 :: JSArray x -> JSArray x -> JSArray x -> JSArray x -> JSArray x
-- etc.
@@ -42,56 +42,56 @@ foreign import jscript "%1.concat(%*)"
-- alternative imports. It'd be easiest for functions with a small number of
-- optional arguments. Funs with more optional arguments still require some
-- thought though.
-foreign import jscript "%1.join" join :: JSArray x -> JSString
-foreign import jscript "%1.join(%*)" join' :: JSArray x -> JSString -> JSString
+foreign import js "%1.join" join :: JSArray x -> JSString
+foreign import js "%1.join(%*)" join' :: JSArray x -> JSString -> JSString
-- TODO: Do we want this to be in IO? We're mutating the array here...
-- head/tail teruggeven in tupletje, in IO
-foreign import jscript "%1.pop"
+foreign import js "%1.pop"
pop :: JSArray x -> IO x
-- TODO: Again we are stuck with the n-argument problem
-- | Push a new element onto an array. ECMA specifies that the new length is
-- returned.
-foreign import jscript "%1.push(%*)"
+foreign import js "%1.push(%*)"
push :: JSArray x -> x -> Int
-foreign import jscript "%1.push(%*)"
+foreign import js "%1.push(%*)"
push2 :: JSArray x -> x -> x -> Int
-foreign import jscript "%1.reverse"
+foreign import js "%1.reverse"
reverse :: JSArray x -> JSArray x
-foreign import jscript "%1.shift"
+foreign import js "%1.shift"
shift :: JSArray x -> x
-foreign import jscript "%1.slice(%*)"
+foreign import js "%1.slice(%*)"
slice :: JSArray x -> Int -> Int -> JSArray x
-foreign import jscript "%1.sort"
+foreign import js "%1.sort"
sort :: JSArray x -> JSArray x
-- TODO: The sort function is optioanl
-- TODO: Can we pass a function in this way? Or do we need to peek at the C FFI for wrapper ideas?
-- TODO: Again, do we want to be in IO? The callback could be anything, technically.
-foreign import jscript "%1.sort(%*)"
+foreign import js "%1.sort(%*)"
sort' :: JSArray x -> (x -> x -> Int) -> JSArray x
-- TODO: Yet again, the n-argument problem.
-- TODO: "array starting at array index start" can we assume array indices are always numeric? I think so....
-- TODO: Maybe we should model the n-arguments as a list? Or as some special NArg type, which contains a list?
-- newtype NArgs a = NArgs [a]
-foreign import jscript "%1.splice(%*)"
+foreign import js "%1.splice(%*)"
splice :: JSArray x -> Int -> Int -> JSArray x
-foreign import jscript "%1.splice(%*)"
+foreign import js "%1.splice(%*)"
splice2 :: JSArray x -> Int -> Int -> x -> JSArray x
-- TODO: n-arg
-foreign import jscript "%1.unshift(%*)"
+foreign import js "%1.unshift(%*)"
unshift :: JSArray x -> x -> Int
-foreign import jscript "%1.unshift(%*)"
+foreign import js "%1.unshift(%*)"
unshift2 :: JSArray x -> x -> x -> Int
@@ -106,10 +106,10 @@ foreign import jscript "%1.unshift(%*)"
-- - Since the lookup can fail, we want a Maybe type as a return value, hence we wrap the import
-- - Since we're wrapping, we're naming the import after the JS function name, prefixed with an underscore
-- - The HS function then just gets the JS function name (possibly with ') and calls the import
-foreign import jscript "%1.indexOf(%*)"
+foreign import js "%1.indexOf(%*)"
_indexOf :: JSArray x -> x -> Int
-foreign import jscript "%1.indexOf(%*)"
+foreign import js "%1.indexOf(%*)"
_indexOf' :: JSArray x -> x -> Int -> Int
indexOf :: JSArray x -> x -> Maybe Int
@@ -120,10 +120,10 @@ indexOf' a x i = mkIdxRes $ _indexOf' a x i
-- TODO: Same problems as previous one
-foreign import jscript "%1.lastIndexOf(%*)"
+foreign import js "%1.lastIndexOf(%*)"
_lastIndexOf :: JSArray x -> x -> Int
-foreign import jscript "%1.lastIndexOf(%*)"
+foreign import js "%1.lastIndexOf(%*)"
_lastIndexOf' :: JSArray x -> x -> Int -> Int
lastIndexOf :: JSArray x -> x -> Maybe Int
@@ -132,51 +132,51 @@ lastIndexOf a x = mkIdxRes $ _lastIndexOf a x
lastIndexOf' :: JSArray x -> x -> Int -> Maybe Int
lastIndexOf' a x i = mkIdxRes $ _lastIndexOf' a x i
-foreign import jscript "%1.every(%*)"
+foreign import js "%1.every(%*)"
every :: JSArray x -> (x -> Int -> JSArray x -> Bool) -> Bool
-- TODO: the 'a' is supposed to be the this value for the callback. Maybe we should
-- create a JSObject type which can be passed here?
-foreign import jscript "%1.every(%*)"
+foreign import js "%1.every(%*)"
every' :: JSArray x -> (x -> Int -> JSArray x -> Bool) -> a -> Bool
-- TODO: Similar problems to above
-foreign import jscript "%1.some(%*)"
+foreign import js "%1.some(%*)"
some :: JSArray x -> (x -> Int -> JSArray x -> Bool) -> Bool
-foreign import jscript "%1.some(%*)"
+foreign import js "%1.some(%*)"
some' :: JSArray x -> (x -> Int -> JSArray x -> Bool) -> a -> Bool
-- TODO: Similar problems to above
-foreign import jscript "%1.forEach(%*)"
+foreign import js "%1.forEach(%*)"
forEach :: JSArray x -> (x -> Int -> JSArray x -> ()) -> ()
-foreign import jscript "%1.forEach(%*)"
+foreign import js "%1.forEach(%*)"
forEach' :: JSArray x -> (x -> Int -> JSArray x -> ()) -> a -> ()
-- TODO: Similar problems to above
-foreign import jscript "%1.map(%*)"
+foreign import js "%1.map(%*)"
map :: JSArray x -> (x -> Int -> JSArray x -> y) -> JSArray y
-foreign import jscript "%1.map(%*)"
+foreign import js "%1.map(%*)"
map' :: JSArray x -> (x -> Int -> JSArray x -> y) -> a -> JSArray y
-foreign import jscript "%1.filter(%*)"
+foreign import js "%1.filter(%*)"
filter :: JSArray x -> (x -> Int -> JSArray x -> Bool) -> JSArray x
-foreign import jscript "%1.filter(%*)"
+foreign import js "%1.filter(%*)"
filter' :: JSArray x -> (x -> Int -> JSArray x -> Bool) -> a -> JSArray x
-foreign import jscript "%1.reduce(%*)"
+foreign import js "%1.reduce(%*)"
reduce :: JSArray x -> (x -> x -> Int -> JSArray x -> y) -> y
-foreign import jscript "%1.reduce(%*)"
+foreign import js "%1.reduce(%*)"
reduce' :: JSArray x -> (x -> x -> Int -> JSArray x -> y) -> y -> y
-foreign import jscript "%1.reduceRight(%*)"
+foreign import js "%1.reduceRight(%*)"
reduceRight :: JSArray x -> (x -> x -> Int -> JSArray x -> y) -> y
-foreign import jscript "%1.reduceRight(%*)"
+foreign import js "%1.reduceRight(%*)"
reduceRight' :: JSArray x -> (x -> x -> Int -> JSArray x -> y) -> y -> y
foreign import prim
View
4 ...ipt/src/Language/UHC/JScript/ECMA/Bool.hs → uhc-js/src/Language/UHC/JScript/ECMA/Bool.hs
@@ -12,8 +12,8 @@ toJSBool :: Bool -> JSBool
toJSBool True = _true
toJSBool False = _false
-foreign import jscript "true"
+foreign import js "true"
_true :: JSBool
-foreign import jscript "false"
+foreign import js "false"
_false :: JSBool
View
2  .../Language/UHC/JScript/ECMA/Expressions.hs → .../Language/UHC/JScript/ECMA/Expressions.hs
@@ -7,5 +7,5 @@ import Language.UHC.JScript.Primitives
typeof :: a -> String
typeof = fromJS . _typeof
-foreign import jscript "typeof(%*)"
+foreign import js "typeof(%*)"
_typeof :: a -> JSString
View
52 ...t/src/Language/UHC/JScript/ECMA/String.hs → ...s/src/Language/UHC/JScript/ECMA/String.hs
@@ -20,36 +20,36 @@ instance FromJS JSString String where
jsStringToString :: JSString -> String
jsStringToString = packedStringToString
-foreign import jscript "String.fromCharCode(%*)"
+foreign import js "String.fromCharCode(%*)"
fromCharCode :: Int -> JSString
-foreign import jscript "String.fromCharCode(%*)"
+foreign import js "String.fromCharCode(%*)"
fromCharCode2 :: Int -> Int -> JSString
-- etc.
-foreign import jscript "%1.toString()"
+foreign import js "%1.toString()"
toString :: JSString -> JSString
-foreign import jscript "%1.valueOf()"
+foreign import js "%1.valueOf()"
valueOf :: JSString -> JSString
-foreign import jscript "%1.charAt(%2)"
+foreign import js "%1.charAt(%2)"
charAt :: JSString -> Int -> JSString
-foreign import jscript "%1.charCodeAt(%2)"
+foreign import js "%1.charCodeAt(%2)"
charCodeAt :: JSString -> Int -> Int
-foreign import jscript "%1.concat(%*)"
+foreign import js "%1.concat(%*)"
concat :: JSString -> JSString -> JSString
-foreign import jscript "%1.concat(%*)"
+foreign import js "%1.concat(%*)"
concat2 :: JSString -> JSString -> JSString -> JSString
-- etc.
-foreign import jscript "%1.indexOf(%*)"
+foreign import js "%1.indexOf(%*)"
_indexOf :: JSString -> JSString -> Int
-foreign import jscript "%1.indexOf(%*)"
+foreign import js "%1.indexOf(%*)"
_indexOf' :: JSString -> JSString -> Int -> Int
indexOf :: JSString -> JSString -> Maybe Int
@@ -58,10 +58,10 @@ indexOf a x = mkIdxRes $ _indexOf a x
indexOf' :: JSString -> JSString -> Int -> Maybe Int
indexOf' a x i = mkIdxRes $ _indexOf' a x i
-foreign import jscript "%1.lastIndexOf(%*)"
+foreign import js "%1.lastIndexOf(%*)"
_lastIndexOf :: JSString -> JSString -> Int
-foreign import jscript "%1.lastIndexOf(%*)"
+foreign import js "%1.lastIndexOf(%*)"
_lastIndexOf' :: JSString -> JSString -> Int -> Int
lastIndexOf :: JSString -> JSString -> Maybe Int
@@ -70,52 +70,52 @@ lastIndexOf a x = mkIdxRes $ _lastIndexOf a x
lastIndexOf' :: JSString -> JSString -> Int -> Maybe Int
lastIndexOf' a x i = mkIdxRes $ _lastIndexOf' a x i
-foreign import jscript "%1.localeCompare(%*)"
+foreign import js "%1.localeCompare(%*)"
localeCompare :: JSString -> JSString -> Int
-- TODO: The argument to match() should be a regex. Define a regex type?
-- Though, in JS, just supplying a string works fine too.
-foreign import jscript "%1.match(%*)"
+foreign import js "%1.match(%*)"
match :: JSString -> JSString -> [JSString]
-foreign import jscript "%1.replace(%*)"
+foreign import js "%1.replace(%*)"
replace :: JSString -> JSString -> JSString -> JSString
-foreign import jscript "%1.search(%*)"
+foreign import js "%1.search(%*)"
_search :: JSString -> JSString -> Int
search :: JSString -> JSString -> Maybe Int
search a x = mkIdxRes $ _search a x
-foreign import jscript "%1.slice(%*)"
+foreign import js "%1.slice(%*)"
slice :: JSString -> Int -> Int -> JSString
-- TODO: The separator argument can also be a RegExp
-foreign import jscript "%1.split(%*)"
+foreign import js "%1.split(%*)"
split :: JSString -> JSString -> [JSString]
-foreign import jscript "%1.split(%*)"
+foreign import js "%1.split(%*)"
split' :: JSString -> JSString -> Int -> [JSString]
-foreign import jscript "%1.substring(%*)"
+foreign import js "%1.substring(%*)"
substring :: JSString -> Int -> Int -> JSString
-foreign import jscript "%1.toLowerCase()"
+foreign import js "%1.toLowerCase()"
toLowerCase :: JSString -> JSString
-foreign import jscript "%1.toLocaleLowerCase()"
+foreign import js "%1.toLocaleLowerCase()"
toLocaleLowerCase :: JSString -> JSString
-foreign import jscript "%1.toUpperCase()"
+foreign import js "%1.toUpperCase()"
toUpperCase :: JSString -> JSString
-foreign import jscript "%1.toLocaleUpperCase()"
+foreign import js "%1.toLocaleUpperCase()"
toLocaleUpperCase :: JSString -> JSString
-foreign import jscript "%1.trim()"
+foreign import js "%1.trim()"
trim :: JSString -> JSString
-foreign import jscript "%1.length"
+foreign import js "%1.length"
length :: JSString -> Int
foreign import prim "primStringToPackedString"
View
4 ...t/src/Language/UHC/JScript/JQuery/Ajax.hs → ...s/src/Language/UHC/JScript/JQuery/Ajax.hs
@@ -74,11 +74,11 @@ ajax :: (JS r, JS v) => AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -
ajax = ajaxBackend _ajax
-foreign import jscript "wrapper"
+foreign import js "wrapper"
mkJSAjaxCallback :: AjaxCallback r -> IO (JSAjaxCallback r)
-foreign import jscript "$.ajax(%1)"
+foreign import js "$.ajax(%1)"
_ajax :: JSPtr a -> IO ()
noop :: AjaxCallback a
View
2  .../Language/UHC/JScript/JQuery/AjaxQueue.hs → .../Language/UHC/JScript/JQuery/AjaxQueue.hs
@@ -14,5 +14,5 @@ import Language.UHC.JScript.Assorted (alert, _alert)
ajaxQ :: (JS r, JS v) => String -> AjaxOptions a -> v -> AjaxCallback r -> AjaxCallback r -> IO ()
ajaxQ queuename = ajaxBackend (_ajaxQ $ toJS queuename)
-foreign import jscript "$.ajaxq(%*)"
+foreign import js "$.ajaxq(%*)"
_ajaxQ :: JSString -> JSPtr a -> IO ()
View
6 ...c/Language/UHC/JScript/JQuery/Deferred.hs → ...c/Language/UHC/JScript/JQuery/Deferred.hs
@@ -13,11 +13,11 @@ boundExecution calc fallback timeout onCalc onFallback = do
_boundExecution calc' fallback' timeout onCalc' onFallback'
-foreign import jscript "boundExecution(%*)"
+foreign import js "boundExecution(%*)"
_boundExecution :: JSFunPtr (IO a) -> JSFunPtr (IO a) -> Int -> JSFunPtr (a -> IO b) -> JSFunPtr (a -> IO b) -> IO ()
-foreign import jscript "wrapper"
+foreign import js "wrapper"
wrapIOa :: IO a -> IO (JSFunPtr (IO a))
-foreign import jscript "wrapper"
+foreign import js "wrapper"
wrapaIOb :: (a -> IO b) -> IO (JSFunPtr (a -> IO b))
View
4 .../Language/UHC/JScript/JQuery/Draggable.hs → .../Language/UHC/JScript/JQuery/Draggable.hs
@@ -22,8 +22,8 @@ draggable jq drag =
do jsdrag <- mkJSDraggable drag
_draggable jq jsdrag
-foreign import jscript "{}"
+foreign import js "{}"
mkJSDraggable :: Draggable -> IO JSDraggable
-foreign import jscript "%1.draggable(%2)"
+foreign import js "%1.draggable(%2)"
_draggable :: JQuery -> JSDraggable -> IO ()
View
4 .../Language/UHC/JScript/JQuery/Droppable.hs → .../Language/UHC/JScript/JQuery/Droppable.hs
@@ -18,8 +18,8 @@ droppable jq drop =
do jsdrop <- mkJSDroppable drop
_droppable jq jsdrop
-foreign import jscript "{}"
+foreign import js "{}"
mkJSDroppable :: Droppable -> IO JSDroppable
-foreign import jscript "%1.droppable(%2)"
+foreign import js "%1.droppable(%2)"
_droppable :: JQuery -> JSDroppable -> IO ()
View
90 ...src/Language/UHC/JScript/JQuery/JQuery.hs → ...src/Language/UHC/JScript/JQuery/JQuery.hs
@@ -19,54 +19,54 @@ jQuery = _jQuery . toJS
jQuery' :: String -> JSPtr a -> IO JQuery
jQuery' s j = _jQuery' (toJS s) j
-foreign import jscript "jQuery(%*)"
+foreign import js "jQuery(%*)"
_jQuery :: JSString -> IO JQuery
-foreign import jscript "jQuery(%*)"
+foreign import js "jQuery(%*)"
_jQuery' :: JSString -> JSPtr a -> IO JQuery
-foreign import jscript "jQuery(%*)"
+foreign import js "jQuery(%*)"
jQueryObj :: JSPtr a -> IO JQuery
-foreign import jscript "jQuery()"
+foreign import js "jQuery()"
jQuery_ :: IO JQuery
-foreign import jscript "$.holdReady(%*)"
+foreign import js "$.holdReady(%*)"
holdReady :: Bool -> IO ()
-foreign import jscript "$.noConflict()"
+foreign import js "$.noConflict()"
noConflict :: IO ()
-foreign import jscript "$.noConflict(%*)"
+foreign import js "$.noConflict(%*)"
noConflict' :: Bool -> IO ()
-foreign import jscript "jQuery.sub()"
+foreign import js "jQuery.sub()"
sub :: IO JQuery
-foreign import jscript "jQuery.when(%*)"
+foreign import js "jQuery.when(%*)"
when :: JSPtr a -> IO ()
-foreign import jscript "jQuery.when(%*)"
+foreign import js "jQuery.when(%*)"
when' :: JSPtr a -> JSPtr a -> IO ()
-foreign import jscript "jQuery.when(%*)"
+foreign import js "jQuery.when(%*)"
when'' :: JSPtr a -> JSPtr a -> JSPtr a -> IO ()
-------------------------------------------------------------------------------
-- Iteration
-foreign import jscript "jQuery.makeArray(%1)"
+foreign import js "jQuery.makeArray(%1)"
jQueryToArray :: JQuery -> IO (JSArray a)
-foreign import jscript "%1.each(%2)"
+foreign import js "%1.each(%2)"
each :: JQuery -> JSFunPtr (Int -> JSPtr a -> IO ()) -> IO ()
-foreign import jscript "jQuery.each(%*)"
+foreign import js "jQuery.each(%*)"
each' :: b -> JSFunPtr (Int -> JSPtr a -> IO ()) -> IO ()
-foreign import jscript "wrapper"
+foreign import js "wrapper"
mkEachIterator :: (Int -> JSPtr a -> IO ()) -> IO (JSFunPtr (Int -> JSPtr a -> IO ()))
-------------------------------------------------------------------------------
@@ -75,23 +75,23 @@ foreign import jscript "wrapper"
findSelector :: JQuery -> String -> IO JQuery
findSelector jq = findSelector' jq . toJS
-foreign import jscript "%1.find(%2)"
+foreign import js "%1.find(%2)"
findSelector' :: JQuery -> JSString -> IO JQuery
-foreign import jscript "%1.find(%2)"
+foreign import js "%1.find(%2)"
findObject :: JQuery -> JQuery -> IO JQuery
valString :: JQuery -> IO String
valString jq = valJSString jq >>= return . fromJS
-foreign import jscript "%1.val()"
+foreign import js "%1.val()"
valJSString :: JQuery -> IO JSString
setValString :: JQuery -> String -> IO ()
setValString jq = _setValString jq . toJS
-foreign import jscript "%1.val(%2)"
+foreign import js "%1.val(%2)"
_setValString :: JQuery -> JSString -> IO ()
-------------------------------------------------------------------------------
@@ -100,7 +100,7 @@ foreign import jscript "%1.val(%2)"
getHTML :: JQuery -> IO String
getHTML = fromJSM . _getHTML
-foreign import jscript "%1.html()"
+foreign import js "%1.html()"
_getHTML :: JQuery -> IO JSString
@@ -108,10 +108,10 @@ setHTML :: JQuery -> String -> IO ()
setHTML j s = _setHTML j (toJS s)
-foreign import jscript "%1.html(%2)"
+foreign import js "%1.html(%2)"
_setHTML :: JQuery -> JSString -> IO ()
-foreign import jscript "%1.hide()"
+foreign import js "%1.hide()"
hide :: JQuery -> IO ()
addClass :: JQuery -> String -> IO ()
@@ -120,14 +120,14 @@ addClass j s = _addClass j (toJS s)
wrapInner :: JQuery -> String -> IO ()
wrapInner j = _wrapInner j . toJS
-foreign import jscript "%1.wrapInner(%2)"
+foreign import js "%1.wrapInner(%2)"
_wrapInner :: JQuery -> JSString -> IO ()
-- Or return JQuery for chaining??? Does chaining even make sense?
-foreign import jscript "%1.addClass(%2)"
+foreign import js "%1.addClass(%2)"
_addClass :: JQuery -> JSString -> IO ()
-foreign import jscript "%1.remove()"
+foreign import js "%1.remove()"
remove :: JQuery -> IO ()
toggleClass :: JQuery -> String -> IO ()
@@ -136,7 +136,7 @@ toggleClass jq = _toggleClass jq . toJS
toggleClassString :: String -> String -> IO ()
toggleClassString sel c = jQuery sel >>= flip toggleClass c
-foreign import jscript "%1.toggleClass(%2)"
+foreign import js "%1.toggleClass(%2)"
_toggleClass :: JQuery -> JSString -> IO ()
-- | One or more space-separated classes to be removed from the class attribute
@@ -147,7 +147,7 @@ removeClass jq = _removeClass jq . toJS
removeClassString :: String -> String -> IO ()
removeClassString sel c = jQuery sel >>= flip removeClass c
-foreign import jscript "%1.removeClass(%2)"
+foreign import js "%1.removeClass(%2)"
_removeClass :: JQuery -> JSString -> IO ()
@@ -164,11 +164,11 @@ slow = 600
-- How can functions be passed? Which type should a callback function have?
-- Generally speaking, a callback functions as would be used in show here returns
-- void. What if we make callback functions return ()?
-foreign import jscript "%1.show()" jqshow0 :: JQuery -> IO ()
-foreign import jscript "%1.show(%*)" jqshow1 :: JQuery -> Int -> IO ()
-foreign import jscript "%1.show(%*)" jqshow2 :: JQuery -> Int -> JSString -> IO ()
-foreign import jscript "%1.show(%*)" jqshow2' :: JQuery -> Int -> IO () -> IO ()
-foreign import jscript "%1.show(%*)" jqshow3 :: JQuery -> Int -> JSString -> IO () -> IO ()
+foreign import js "%1.show()" jqshow0 :: JQuery -> IO ()
+foreign import js "%1.show(%*)" jqshow1 :: JQuery -> Int -> IO ()
+foreign import js "%1.show(%*)" jqshow2 :: JQuery -> Int -> JSString -> IO ()
+foreign import js "%1.show(%*)" jqshow2' :: JQuery -> Int -> IO () -> IO ()
+foreign import js "%1.show(%*)" jqshow3 :: JQuery -> Int -> JSString -> IO () -> IO ()
jqshow :: JQuery -> Maybe Int -> Maybe String -> Maybe (IO ()) -> IO ()
jqshow j Nothing Nothing Nothing = jqshow0 j
@@ -178,7 +178,7 @@ jqshow j (Just n) Nothing (Just c) = jqshow2' j n c
jqshow j (Just n) (Just e) (Just c) = jqshow3 j n (toJS e) c
-foreign import jscript "%1.blur()"
+foreign import js "%1.blur()"
doBlur :: JQuery -> IO ()
-------------------------------------------------------------------------------
@@ -240,7 +240,7 @@ bind :: JQuery -> JEventType -> EventHandler -> IO ()
bind jq event eh = do handler <- mkJEventHandler eh
_bind jq ((toJS . show)event) handler
-foreign import jscript "%1.bind(%*)"
+foreign import js "%1.bind(%*)"
_bind :: JQuery -> JSString -> JEventHandler -> IO ()
registerEvents :: [(String, JEventType, EventHandler)] -> IO ()
@@ -251,7 +251,7 @@ registerEvents = mapM_ (\ (e, event, eh) -> do elem <- jQuery e
unbind :: JQuery -> JEventType -> IO ()
unbind jq = _unbind jq . toJS . show
-foreign import jscript "%1.unbind(%*)"
+foreign import js "%1.unbind(%*)"
_unbind :: JQuery -> JSString -> IO ()
@@ -262,7 +262,7 @@ blur = undefined
click :: JQuery -> EventHandler -> IO ()
click jq eh = mkJEventHandler eh >>= _click jq
-foreign import jscript "%1.click(%2)"
+foreign import js "%1.click(%2)"
_click :: JQuery -> JEventHandler -> IO ()
@@ -273,14 +273,14 @@ keypress = undefined
onDocumentReady :: JSFunPtr (IO ()) -> IO ()
onDocumentReady f = _ready f
-foreign import jscript "$('document').ready(%1)"
+foreign import js "$('document').ready(%1)"
_ready :: JSFunPtr (IO ()) -> IO ()
-foreign import jscript "wrapper"
+foreign import js "wrapper"
mkJEventHandler :: EventHandler -> IO JEventHandler
-foreign import jscript "wrapper"
+foreign import js "wrapper"
_mkJThisEventHandler :: ThisEventHandler -> IO JThisEventHandler
mkJThisEventHandler :: ThisEventHandler -> IO JThisEventHandler
@@ -289,11 +289,11 @@ mkJThisEventHandler f =
f jQThis jq
in _mkJThisEventHandler g
-foreign import jscript "wrappedThis(%1)"
+foreign import js "wrappedThis(%1)"
wrappedJQueryEvent :: JThisEventHandler -> IO JEventHandler
-foreign import jscript "wrapper"
+foreign import js "wrapper"
mkJUIEventHandler :: UIEventHandler -> IO JUIEventHandler
@@ -303,11 +303,11 @@ mkJUIThisEventHandler f =
f jQThis jq ui
in _mkJUIThisEventHandler g
-foreign import jscript "wrapper"
+foreign import js "wrapper"
_mkJUIThisEventHandler :: UIThisEventHandler -> IO JUIThisEventHandler
-foreign import jscript "wrappedThis(%1)"
+foreign import js "wrappedThis(%1)"
wrappedJQueryUIEvent :: JUIThisEventHandler -> IO JUIEventHandler
-------------------------------------------------------------------------------
@@ -320,13 +320,13 @@ appendString :: JQuery -> String -> IO ()
appendString jq str = do jq' <- jQuery str
_append jq jq'
-foreign import jscript "%1.append(%*)"
+foreign import js "%1.append(%*)"
_append :: JQuery -> JQuery -> IO ()
replaceWith :: JQuery -> JQuery -> IO ()
replaceWith = _replaceWith
-foreign import jscript "%1.replaceWith(%2)"
+foreign import js "%1.replaceWith(%2)"
_replaceWith :: JQuery -> JQuery -> IO ()
replaceWithString :: JQuery -> String -> IO ()
View
8 ...t/src/Language/UHC/JScript/JSON2/JSON2.hs → ...s/src/Language/UHC/JScript/JSON2/JSON2.hs
@@ -14,13 +14,13 @@ type JSON = JSPtr JSONPtr
stringify :: JSPtr a -> IO String
stringify = fromJSM . _stringify
-foreign import jscript "JSON.stringify(%*)"
+foreign import js "JSON.stringify(%*)"
_stringify :: JSPtr a -> IO JSString
stringify' :: JSArray a -> IO String
stringify' = fromJSM . _stringify'
-foreign import jscript "JSON.stringify(%*)"
+foreign import js "JSON.stringify(%*)"
_stringify' :: JSArray a -> IO JSString
-- TODO: All permutations for stringify
@@ -31,8 +31,8 @@ parse = _parse . toJS
parse' :: String -> IO () -> IO (JSPtr a)
parse' s c = _parse' (toJS s) c
-foreign import jscript "JSON.parse(%*)"
+foreign import js "JSON.parse(%*)"
_parse :: JSString -> IO (JSPtr a)
-foreign import jscript "JSON.parse(%*)"
+foreign import js "JSON.parse(%*)"
_parse' :: JSString -> IO () -> IO (JSPtr a)
View
4 ...cript/src/Language/UHC/JScript/Prelude.hs → uhc-js/src/Language/UHC/JScript/Prelude.hs
@@ -11,8 +11,8 @@ import Language.UHC.JScript.Types
import Language.UHC.JScript.Primitives
import Language.UHC.JScript.ECMA.String
-foreign import jscript "wrapper"
+foreign import js "wrapper"
wrapIO :: IO () -> IO (JSFunPtr (IO ()))
-foreign import jscript "wrapper"
+foreign import js "wrapper"
wrapJSPtraIO :: (JSPtr a -> IO ()) -> IO (JSFunPtr(JSPtr a -> IO ()))
View
2  ...pt/src/Language/UHC/JScript/Primitives.hs → ...js/src/Language/UHC/JScript/Primitives.hs
@@ -102,6 +102,6 @@ foreign import prim "primClone"
foreign import prim "primToPlainObj"
primToPlainObj :: JSPtr a -> JSPtr b
-foreign import jscript "{}"
+foreign import js "{}"
mkObj :: a -> IO (JSPtr b)
View
2  ...ipt/src/Language/UHC/JScript/SafeTypes.hs → uhc-js/src/Language/UHC/JScript/SafeTypes.hs
@@ -2,7 +2,7 @@ module Language.UHC.JScript.SafeTypes where
import Language.UHC.JScript.ECMA.String (JSString)
-foreign import jscript "typeof(%1)"
+foreign import js "typeof(%1)"
typeof :: a -> JSString
-- | Would like fun dep here
View
0  ...jscript/src/Language/UHC/JScript/Types.hs → uhc-js/src/Language/UHC/JScript/Types.hs
File renamed without changes
View
74 ...ipt/src/Language/UHC/JScript/W3C/HTML5.hs → uhc-js/src/Language/UHC/JScript/W3C/HTML5.hs
@@ -63,76 +63,76 @@ import Language.UHC.JScript.ECMA.String
data DocumentPtr
type Document = JSPtr DocumentPtr
-foreign import jscript "document"
+foreign import js "document"
document :: IO Document
-foreign import jscript "%1.anchors"
+foreign import js "%1.anchors"
documentAnchors :: Document -> JSArray Anchor
-foreign import jscript "%1.forms"
+foreign import js "%1.forms"
documentForms :: Document -> JSArray Form
-foreign import jscript "%1.images"
+foreign import js "%1.images"
documentImages :: Document -> JSArray Image
-foreign import jscript "%1.links"
+foreign import js "%1.links"
documentLinks :: Document -> JSArray Link
-foreign import jscript "%1.write(%*)"
+foreign import js "%1.write(%*)"
documentWrite :: Document -> JSString -> IO ()
-foreign import jscript "%1.writeln(%*)"
+foreign import js "%1.writeln(%*)"
documentWriteln :: Document -> JSString -> IO ()
-foreign import jscript "%1.getElementById(%*)"
+foreign import js "%1.getElementById(%*)"
documentGetElementById :: Document -> JSString -> IO Node
-foreign import jscript "%1.getElementsByName(%*)"
+foreign import js "%1.getElementsByName(%*)"
documentGetElementsByName :: Document -> JSString -> IO (NodeList Node)
documentGetElementsByTagName :: Document -> String -> IO (NodeList Node)
documentGetElementsByTagName d = _documentGetElementsByTagName d . stringToJSString
-foreign import jscript "%1.getElementsByTagName(%*)"
+foreign import js "%1.getElementsByTagName(%*)"
_documentGetElementsByTagName :: Document -> JSString -> IO (NodeList Node)
documentCreateElement :: String -> IO Node
documentCreateElement elem = _documentCreateElement (stringToJSString elem :: JSString)
-foreign import jscript "document.createElement(%*)"
+foreign import js "document.createElement(%*)"
_documentCreateElement :: JSString -> IO Node
data AnchorPtr
type Anchor = JSPtr AnchorPtr
-foreign import jscript "%1.charset"
+foreign import js "%1.charset"
anchorCharset :: Anchor -> JSString
-foreign import jscript "%1.href"
+foreign import js "%1.href"
anchorHref :: Anchor -> JSString
-foreign import jscript "%1.hreflang"
+foreign import js "%1.hreflang"
anchorHreflang :: Anchor -> JSString
-foreign import jscript "%1.name"
+foreign import js "%1.name"
anchorName :: Anchor -> JSString
-foreign import jscript "%1.rel"
+foreign import js "%1.rel"
anchorRel :: Anchor -> JSString
-foreign import jscript "%1.rev"
+foreign import js "%1.rev"
anchorRev :: Anchor -> JSString
-foreign import jscript "%1.target"
+foreign import js "%1.target"
anchorTarget :: Anchor -> JSString
-foreign import jscript "%1.type"
+foreign import js "%1.type"
anchorType :: Anchor -> JSString
data FormPtr
type Form = JSPtr FormPtr
-foreign import jscript "%1.elements"
+foreign import js "%1.elements"
formElements :: Form -> JSArray Element
data ImagePtr
@@ -144,68 +144,68 @@ type Link = JSPtr LinkPtr
data ElementPtr
type Element = JSPtr ElementPtr
-foreign import jscript "%1.innerHTML"
+foreign import js "%1.innerHTML"
elementInnerHTML :: Node -> JSString
-foreign import jscript "%1.tagName"
+foreign import js "%1.tagName"
elementTagName :: Node -> JSString
-foreign import jscript "%1.clientWidth"
+foreign import js "%1.clientWidth"
elementClientWidth :: Node -> Int
-foreign import jscript "%1.clientHeight"
+foreign import js "%1.clientHeight"
elementClientHeight :: Node -> Int
-foreign import jscript "%1.attributes"
+foreign import js "%1.attributes"
elementAttributes :: Node -> NamedNodeMap Node
elementSetAttribute :: Node -> String -> String -> IO ()
elementSetAttribute n k v = _elementSetAttribute n (stringToJSString k :: JSString) (stringToJSString v :: JSString)
-foreign import jscript "%1.setAttribute(%*)"
+foreign import js "%1.setAttribute(%*)"
_elementSetAttribute :: Node -> JSString -> JSString -> IO ()
-foreign import jscript "%1.appendChild(%2)"
+foreign import js "%1.appendChild(%2)"
elementAppendChild :: Node -> Node -> IO ()
data NodePtr
type Node = JSPtr NodePtr
-foreign import jscript "%1.nodeName"
+foreign import js "%1.nodeName"
nodeName :: Node -> JSString
-foreign import jscript "%1.nodeType"
+foreign import js "%1.nodeType"
nodeType :: Node -> Int
data NodeListPtr x
type NodeList x = JSPtr (NodeListPtr x)
-foreign import jscript "%1.length"
+foreign import js "%1.length"
nodeListLength :: NodeList Node -> Int
-foreign import jscript "%1[%2]"
+foreign import js "%1[%2]"
nodeListItem :: NodeList Node -> Int -> IO Node
data NamedNodeMapPtr x
type NamedNodeMap x = JSPtr (NamedNodeMapPtr x)
-foreign import jscript "%1.length"
+foreign import js "%1.length"
namedNodeMapLength :: NamedNodeMap Node -> Int
-foreign import jscript "%1[%2]"
+foreign import js "%1[%2]"
namedNodeMapItem :: NamedNodeMap Node -> Int -> IO Node
-foreign import jscript "%1.getNamedItem(%*)"
+foreign import js "%1.getNamedItem(%*)"
namedNodeMapNamedItem :: NamedNodeMap Node -> JSString -> IO Node
-foreign import jscript "%1.removeNamedItem(%*)"
+foreign import js "%1.removeNamedItem(%*)"
namedNodeMapRemoveNamedItem :: NamedNodeMap Node -> JSString -> IO Node
-foreign import jscript "%1.setNamedItem(%*)"
+foreign import js "%1.setNamedItem(%*)"
namedNodeMapSetNamedItem :: NamedNodeMap Node -> Node -> IO Node
data AttrPtr
type Attr = JSPtr AttrPtr
-foreign import jscript "%1.value"
+foreign import js "%1.value"
attrValue :: Attr -> JSString
View
10 ...ipt/src/Language/UHC/JScript/WebWorker.hs → uhc-js/src/Language/UHC/JScript/WebWorker.hs
@@ -8,7 +8,7 @@ type WebWorker = JSPtr WebWorkerPtr
newWorker :: String -> IO WebWorker
newWorker = _newWorker . toJS
-foreign import jscript "newWorker(%1)"
+foreign import js "newWorker(%1)"
_newWorker :: JSString -> IO WebWorker
setOnMessage :: WebWorker -> (JSPtr a -> IO ()) -> IO ()
@@ -17,17 +17,17 @@ setOnMessage self f = do
setAttr "onmessage" f' self
return ()
-foreign import jscript "JSON.stringify(%1)"
+foreign import js "JSON.stringify(%1)"
jsonStringify :: a -> JSString
-foreign import jscript "JSON.parse(%1)"
+foreign import js "JSON.parse(%1)"
jsonParse :: JSString -> IO a
postMessage :: WebWorker -> a -> IO ()
postMessage = _postMessage
-foreign import jscript "%1.postMessage(%2)"
+foreign import js "%1.postMessage(%2)"
_postMessage :: WebWorker -> a -> IO ()
-foreign import jscript "self"
+foreign import js "self"
getSelf :: IO WebWorker
View
0  uhc-jscript/src/Main.hs → uhc-js/src/Main.hs
File renamed without changes
View
18 uhc-jscript/uhc-jscript.cabal → uhc-js/uhc-js.cabal
@@ -1,22 +1,22 @@
--- uhc-jscript.cabal auto-generated by cabal init. For additional
+-- uhc-js.cabal auto-generated by cabal init. For additional
-- options, see
-- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.
-- The name of the package.
-Name: uhc-jscript
+Name: uhc-js
-- The package version. See the Haskell package versioning policy
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
-- standards guiding when and how versions should be incremented.
-Version: 0.1
+Version: 0.2
-- A short (one-line) description of the package.
-Synopsis: JScript library for the UHC JS backend
+Synopsis: JavaScript library for the UHC JS backend
-- A longer description of the package.
-- Description:
-- URL for the project homepage or repository.
-Homepage: https://github.com/norm2782/uhc-jscript
+Homepage: https://github.com/UU-ComputerScience/uhc-js
-- The license under which the package is released.
License: BSD3
@@ -25,11 +25,11 @@ License: BSD3
License-file: LICENSE
-- The package author(s).
-Author: Jurriën Stutterheim
+Author: Jurriën Stutterheim, Alessandro Vermeulen
-- An email address to which users can send suggestions, bug reports,
-- and patches.
-Maintainer: j.stutterheim@uu.nl
+Maintainer: j.stutterheim@uu.nl, a.vermeulen@uu.nl
-- A copyright notice.
-- Copyright:
@@ -46,13 +46,13 @@ Build-type: Simple
Cabal-version: >=1.2
-Executable test-jscript
+Executable test-js
Hs-Source-Dirs: src
Build-depends: base >= 3.0
Main-Is: Main.hs
Library
-- Modules exported by the library.
- Exposed-modules: Language.UHC.JScript.Primitives
+ Exposed-modules: Language.UHC.JS.Primitives, Language.UHC.JS.Prelude
Hs-Source-Dirs: src
-- Packages needed in order to build this package.
Build-depends: base >= 3.0
Please sign in to comment.
Something went wrong with that request. Please try again.