haste-compiler 0.4 → 0.4.1
raw patch · 9 files changed
+29/−28 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Haste.Concurrent: async :: ToConcurrent a => Async a -> a
+ Haste.Concurrent: class Monad m => MonadConc m
+ Haste.Concurrent: class ToConcurrent a where type family Async a
+ Haste.Concurrent: concurrent :: CIO () -> IO ()
+ Haste.Concurrent: data CIO a
+ Haste.Concurrent: data MVar a
+ Haste.Concurrent: fork :: MonadConc m => m () -> m ()
+ Haste.Concurrent: forkIO :: CIO () -> CIO ()
+ Haste.Concurrent: forkMany :: [CIO ()] -> CIO ()
+ Haste.Concurrent: liftConc :: MonadConc m => CIO a -> m a
+ Haste.Concurrent: liftIO :: MonadIO m => forall a. IO a -> m a
+ Haste.Concurrent: modifyMVarIO :: MVar a -> (a -> IO (a, b)) -> CIO b
+ Haste.Concurrent: newEmptyMVar :: MonadIO m => m (MVar a)
+ Haste.Concurrent: newMVar :: MonadIO m => a -> m (MVar a)
+ Haste.Concurrent: peekMVar :: MonadIO m => MVar a -> m (Maybe a)
+ Haste.Concurrent: putMVar :: MVar a -> a -> CIO ()
+ Haste.Concurrent: readMVar :: MVar a -> CIO a
+ Haste.Concurrent: takeMVar :: MVar a -> CIO a
+ Haste.Concurrent: withMVarIO :: MVar a -> (a -> IO b) -> CIO b
Files
- haste-compiler.cabal +1/−1
- lib/rts.js +7/−6
- lib/stdlib.js +8/−8
- libraries/haste-lib/src/Haste/Binary.hs +2/−2
- libraries/haste-lib/src/Haste/Concurrent.hs +2/−2
- libraries/haste-lib/src/Haste/Foreign.hs +1/−1
- libraries/haste-lib/src/Haste/Hash.hs +1/−1
- libraries/haste-lib/src/Haste/WebSockets.hs +6/−6
- src/Haste/Version.hs +1/−1
haste-compiler.cabal view
@@ -1,5 +1,5 @@ Name: haste-compiler-Version: 0.4+Version: 0.4.1 License: BSD3 License-File: LICENSE Synopsis: Haskell To ECMAScript compiler
lib/rts.js view
@@ -88,14 +88,15 @@ return f; } -// Export Haste, A and E. Haste because we need to preserve exports, A and E-// because they're handy for Haste.Foreign.+// Export Haste, A, B and E. Haste because we need to preserve exports, A, B+// and E because they're handy for Haste.Foreign. if(!window) { var window = {}; } window['Haste'] = Haste; window['A'] = A; window['E'] = E;+window['B'] = B; /* Throw an error.@@ -199,7 +200,7 @@ function unFoldrCStr(str, f, z) { var acc = z; for(var i = str.length-1; i >= 0; --i) {- acc = A(f, [[0, str.charCodeAt(i)], acc]);+ acc = B(A(f, [[0, str.charCodeAt(i)], acc])); } return acc; }@@ -246,7 +247,7 @@ // atomicModifyMutVar function mMV(mv, f) {- var x = A(f, [mv.x]);+ var x = B(A(f, [mv.x])); mv.x = x[1]; return x[2]; }@@ -289,9 +290,9 @@ function jsCatch(act, handler) { try {- return A(act,[0]);+ return B(A(act,[0])); } catch(e) {- return A(handler,[e, 0]);+ return B(A(handler,[e, 0])); } }
lib/stdlib.js view
@@ -63,7 +63,7 @@ if(evt == 'change' && elem.type.toLowerCase() == 'text') { setCB(elem, 'keyup', function(k) { if(k == '\n'.charCodeAt(0)) {- A(cb,[[0,k.keyCode],0]);+ B(A(cb,[[0,k.keyCode],0])); } }); }@@ -78,7 +78,7 @@ var mpos = jsGetMouseCoords(x); var mx = [0,mpos[0]]; var my = [0,mpos[1]];- A(cb,[[0,x.button],[0,mx,my],0]);+ B(A(cb,[[0,x.button],[0,mx,my],0])); }; break; case 'mousemove':@@ -87,16 +87,16 @@ var mpos = jsGetMouseCoords(x); var mx = [0,mpos[0]]; var my = [0,mpos[1]];- A(cb,[[0,mx,my],0]);+ B(A(cb,[[0,mx,my],0])); }; break; case 'keypress': case 'keyup': case 'keydown':- fun = function(x) {A(cb,[[0,x.keyCode],0]);};+ fun = function(x) {B(A(cb,[[0,x.keyCode],0]));}; break; default:- fun = function() {A(cb,[0]);};+ fun = function() {B(A(cb,[0]));}; break; } return setCB(elem, evt, fun);@@ -114,7 +114,7 @@ } function jsSetTimeout(msecs, cb) {- window.setTimeout(function() {A(cb,[0]);}, msecs);+ window.setTimeout(function() {B(A(cb,[0]));}, msecs); } function jsGet(elem, prop) {@@ -337,9 +337,9 @@ xhr.onreadystatechange = function() { if(xhr.readyState == 4) { if(xhr.status == 200) {- A(cb,[[1,[0,xhr.responseText]],0]);+ B(A(cb,[[1,[0,xhr.responseText]],0])); } else {- A(cb,[[0],0]); // Nothing+ B(A(cb,[[0],0])); // Nothing } } }
libraries/haste-lib/src/Haste/Binary.hs view
@@ -46,7 +46,7 @@ convertBlob :: Blob -> Opaque (Unpacked -> IO ()) -> IO () convertBlob = ffi- "(function(b,cb){var r=new FileReader();r.onload=function(){A(cb,[new DataView(r.result),0]);};r.readAsArrayBuffer(b);})"+ "(function(b,cb){var r=new FileReader();r.onload=function(){B(A(cb,[new DataView(r.result),0]));};r.readAsArrayBuffer(b);})" getBlobText' b = do res <- newEmptyMVar@@ -55,7 +55,7 @@ where convertBlob :: Blob -> Opaque (JSString -> IO ()) -> IO () convertBlob = ffi- "(function(b,cb){var r=new FileReader();r.onload=function(){A(cb,[[0,r.result],0]);};r.readAsText(b);})"+ "(function(b,cb){var r=new FileReader();r.onload=function(){B(A(cb,[[0,r.result],0]));};r.readAsText(b);})" -- | Somewhat efficient serialization/deserialization to/from binary Blobs. -- The layout of the binaries produced/read by get/put and encode/decode may
libraries/haste-lib/src/Haste/Concurrent.hs view
@@ -2,12 +2,12 @@ EmptyDataDecls #-} -- | Concurrency for Haste. Includes MVars, forking, Ajax and more. module Haste.Concurrent (- module Monad, module Ajax,+ module Haste.Concurrent.Monad, module Ajax, Recv, Send, Inbox, Outbox, MBox, receive, spawn, statefully, (!), (<!), wait ) where-import Haste.Concurrent.Monad as Monad+import Haste.Concurrent.Monad import Haste.Concurrent.Ajax as Ajax hiding ((!)) import Haste.Callback
libraries/haste-lib/src/Haste/Foreign.hs view
@@ -271,7 +271,7 @@ " return (function() {" ++ " var args=Array.prototype.slice.call(arguments,0);"++ " args.push(0);" ++- " return E(A(f, args));" +++ " return E(B(A(f, args)));" ++ " });" ++ "})")
libraries/haste-lib/src/Haste/Hash.hs view
@@ -44,7 +44,7 @@ \var oldhash = window.__old_hash;\ \var newhash = window.location.hash.split('#')[1] || '';\ \window.__old_hash = newhash;\- \A(cb, [[0,oldhash],[0,newhash],0]);\+ \B(A(cb, [[0,oldhash],[0,newhash],0]));\ \};\ \})"
libraries/haste-lib/src/Haste/WebSockets.hs view
@@ -84,9 +84,9 @@ -> IO () new = ffi "(function(url, cb, f, err) {\ \var ws = new WebSocket(url);\- \ws.onmessage = function(e) {A(cb,[ws, [0,e.data],0]);};\- \ws.onopen = function(e) {A(f,[ws,0]);};\- \ws.onerror = function(e) {A(err,[0]);};\+ \ws.onmessage = function(e) {B(A(cb,[ws, [0,e.data],0]));};\+ \ws.onopen = function(e) {B(A(f,[ws,0]));};\+ \ws.onerror = function(e) {B(A(err,[0]));};\ \return ws;\ \})" @@ -98,9 +98,9 @@ newBin = ffi "(function(url, cb, f, err) {\ \var ws = new WebSocket(url);\ \ws.binaryType = 'blob';\- \ws.onmessage = function(e) {A(cb,[ws,e.data,0]);};\- \ws.onopen = function(e) {A(f,[ws,0]);};\- \ws.onerror = function(e) {A(err,[0]);};\+ \ws.onmessage = function(e) {B(A(cb,[ws,e.data,0]));};\+ \ws.onopen = function(e) {B(A(f,[ws,0]));};\+ \ws.onerror = function(e) {B(A(err,[0]));};\ \return ws;\ \})"
src/Haste/Version.hs view
@@ -9,7 +9,7 @@ import Haste.Environment (hasteSysDir, ghcBinary) hasteVersion :: Version-hasteVersion = Version [0, 4] []+hasteVersion = Version [0, 4, 1] [] ghcVersion :: String ghcVersion = unsafePerformIO $ do