haste-compiler 0.5.4.2 → 0.5.5.0
raw patch · 10 files changed
+84/−13 lines, 10 filesdep ~Cabal
Dependency ranges changed: Cabal
Files
- haste-compiler.cabal +6/−6
- lib/Integer.js +1/−1
- lib/pointers.js +11/−0
- libraries/haste-lib/src/Haste/Binary.hs +33/−0
- libraries/haste-lib/src/Haste/DOM/JSString.hs +1/−1
- libraries/haste-lib/src/Haste/JSON.hs +1/−1
- src/Haste/Opts.hs +1/−1
- src/Haste/PrimOps.hs +8/−0
- src/Haste/Version.hs +2/−1
- src/haste-boot.hs +20/−2
haste-compiler.cabal view
@@ -1,5 +1,5 @@ Name: haste-compiler-Version: 0.5.4.2+Version: 0.5.5.0 License: BSD3 License-File: LICENSE Synopsis: Haskell To ECMAScript compiler@@ -105,7 +105,7 @@ buildable: False Hs-Source-Dirs: src Include-Dirs: include- GHC-Options: -Wall -O2+ GHC-Options: -Wall -threaded if flag(portable) CPP-Options: -DPORTABLE if flag(static)@@ -186,10 +186,10 @@ if os(linux) GHC-Options: -static -optl-static -optl-pthread - Build-Depends: base >= 4 && < 5,- directory >= 1 && < 1.3,- process >= 1 && < 1.3,- Cabal,+ Build-Depends: base >= 4 && < 5,+ directory >= 1 && < 1.3,+ process >= 1 && < 1.3,+ Cabal >= 1.22 && < 1.24, containers, filepath, binary,
lib/Integer.js view
@@ -37,7 +37,7 @@ return a.div(b); } var I_divMod = function(a,b) {- return {_:0, a:I_div(self, other), b:a.mod(b)};+ return {_:0, a:I_div(a,b), b:a.mod(b)}; } var I_quot = function(a,b) {return a.div(b);} var I_rem = function(a,b) {return a.mod(b);}
lib/pointers.js view
@@ -14,8 +14,19 @@ addr['v'][type][addr.off/elemsize + off] = x; } +function writeOffAddr64(addr, off, x) {+ addr['v']['w32'][addr.off/8 + off*2] = x.low;+ addr['v']['w32'][addr.off/8 + off*2 + 1] = x.high;+}+ function readOffAddr(type, elemsize, addr, off) { return addr['v'][type][addr.off/elemsize + off];+}++function readOffAddr64(signed, addr, off) {+ var w64 = hs_mkWord64( addr['v']['w32'][addr.off/8 + off*2]+ , addr['v']['w32'][addr.off/8 + off*2 + 1]);+ return signed ? hs_word64ToInt64(w64) : w64; } // Two addresses are equal if they point to the same buffer and have the same
libraries/haste-lib/src/Haste/Binary.hs view
@@ -17,6 +17,7 @@ import Data.Int import Data.Word import Data.Char+import GHC.Fingerprint.Type import qualified Haste.JSString as J (length) import Haste.Prim import Haste.Concurrent@@ -89,6 +90,16 @@ gput :: f t -> Put gget :: Get (f t) +instance Binary Bool where+ put True = putWord8 1+ put _ = putWord8 0+ get = do+ n <- getWord8+ case n of+ 0 -> pure False+ 1 -> pure True+ _ -> fail $ "Not a valid Bool: " ++ show n+ instance Binary Word8 where put = putWord8 get = getWord8@@ -101,6 +112,15 @@ put = putWord32le get = getWord32le +instance Binary Word64 where+ get = do+ lo <- get :: Get Word32+ hi <- get :: Get Word32+ return $ fromIntegral lo .|. shiftL (fromIntegral hi) 32+ put x = do+ put (fromIntegral x :: Word32)+ put (fromIntegral (shiftR x 32) :: Word32)+ instance Binary Int8 where put = putInt8 get = getInt8@@ -113,6 +133,15 @@ put = putInt32le get = getInt32le +instance Binary Int64 where+ get = do+ lo <- get :: Get Int32+ hi <- get :: Get Int32+ return $ fromIntegral lo .|. shiftL (fromIntegral hi) 32+ put x = do+ put (fromIntegral x :: Int32)+ put (fromIntegral (shiftR x 32) :: Int32)+ instance Binary Int where put = putInt32le . fromIntegral get = fromIntegral <$> getInt32le@@ -124,6 +153,10 @@ instance Binary Double where put = putFloat64le get = getFloat64le++instance Binary Fingerprint where+ get = Fingerprint <$> get <*> get+ put (Fingerprint a b) = put a >> put b instance (Binary a, Binary b) => Binary (a, b) where put (a, b) = put a >> put b
libraries/haste-lib/src/Haste/DOM/JSString.hs view
@@ -57,7 +57,7 @@ jsElemsByClassName :: JSString -> IO [Elem] jsElemsByClassName = ffi "(function(c){\-\return document.getElementsByClassName(e);})"+\return document.getElementsByClassName(c);})" jsCreateElem :: JSString -> IO Elem jsCreateElem = ffi "(function(t){return document.createElement(t);})"
libraries/haste-lib/src/Haste/JSON.hs view
@@ -66,7 +66,7 @@ negate _ = numFail abs (Num a) = Num (abs a) abs _ = numFail- signum (Num a) = signum (Num a)+ signum (Num a) = Num (signum a) signum _ = numFail fromInteger n = Num (fromInteger n)
src/Haste/Opts.hs view
@@ -191,7 +191,7 @@ "the interpreter. This behavior can be controlled using the --onload, --onexec", "and --start options.", "",- "A summary of the available options are given below."+ "A summary of the available options is given below." ] -- | Like 'words', except it breaks on commas instead of spaces.
src/Haste/PrimOps.hs view
@@ -233,10 +233,12 @@ WriteOffAddrOp_Int8 -> writeOffAddr xs "i8" 1 WriteOffAddrOp_Int16 -> writeOffAddr xs "i16" 2 WriteOffAddrOp_Int32 -> writeOffAddr xs "i32" 4+ WriteOffAddrOp_Int64 -> writeOffAddr64 xs WriteOffAddrOp_Word -> writeOffAddr xs "w32" 4 WriteOffAddrOp_Word8 -> writeOffAddr xs "w8" 1 WriteOffAddrOp_Word16 -> writeOffAddr xs "w16" 2 WriteOffAddrOp_Word32 -> writeOffAddr xs "w32" 4+ WriteOffAddrOp_Word64 -> writeOffAddr64 xs WriteOffAddrOp_WideChar-> writeOffAddr xs "w32" 4 WriteOffAddrOp_Float -> writeOffAddr xs "f32" 4 WriteOffAddrOp_Double -> writeOffAddr xs "f64" 8@@ -245,10 +247,12 @@ ReadOffAddrOp_Int8 -> readOffAddr xs "i8" 1 ReadOffAddrOp_Int16 -> readOffAddr xs "i16" 2 ReadOffAddrOp_Int32 -> readOffAddr xs "i32" 4+ ReadOffAddrOp_Int64 -> readOffAddr64 xs True ReadOffAddrOp_Word -> readOffAddr xs "w32" 4 ReadOffAddrOp_Word8 -> readOffAddr xs "w8" 1 ReadOffAddrOp_Word16 -> readOffAddr xs "w16" 2 ReadOffAddrOp_Word32 -> readOffAddr xs "w32" 4+ ReadOffAddrOp_Word64 -> readOffAddr64 xs False ReadOffAddrOp_WideChar -> readOffAddr xs "w32" 4 ReadOffAddrOp_Float -> readOffAddr xs "f32" 4 ReadOffAddrOp_Double -> readOffAddr xs "f64" 8@@ -357,11 +361,15 @@ Right $ callForeign "writeOffAddr" [litS etype,litN esize,addr,off,rhs] writeOffAddr _ _ _ = error "writeOffAddr primop with too few arguments!"+ writeOffAddr64 (addr:off:rhs:_) =+ Right $ callForeign "writeOffAddr64" [addr, off, rhs] readOffAddr (addr:off:_) etype esize = Right $ callForeign "readOffAddr" [litS etype,litN esize,addr,off] readOffAddr _ _ _ = error "readOffAddr primop with too few arguments!"+ readOffAddr64 (addr:off:_) esigned =+ Right $ callForeign "readOffAddr64" [lit esigned, addr, off] callF f = Right $ callForeign f xs
src/Haste/Version.hs view
@@ -5,6 +5,7 @@ showBootVersion, parseBootVersion, showVersion ) where+import Paths_haste_compiler import Data.Version import Config (cProjectVersion) import Text.ParserCombinators.ReadP@@ -12,7 +13,7 @@ -- | Current Haste version. hasteVersion :: Version-hasteVersion = Version [0,5,4,2] []+hasteVersion = version -- | Current Haste version as an Int. The format of this version number is -- MAJOR*10 000 + MINOR*100 + MICRO.
src/haste-boot.hs view
@@ -146,7 +146,7 @@ hdr :: String hdr = "Fetch, build and install all libraries necessary to use Haste.\n" -data CabalOp = Configure | Build | Install | Clean+data CabalOp = Configure | Build | Install | Clean | Do String main :: IO () main = shell_ $ do@@ -343,8 +343,23 @@ , "-f-integer-gmp" , "-f-sse2" , "-f-sse41"- , "./haste-lib"]+ , "./haste-lib"+ ] + -- Install QuickCheck+ libdir <- pwd+ inTempDirectory $ do+ hasteCabal (Do "unpack") ["QuickCheck-2.6"]+ inDirectory "QuickCheck-2.6" $ do+ run_ "patch" [ "-p1"+ , "-i"+ , libdir </> "quickcheck-2.6-amp.patch"+ ] ""+ hasteCabal Install [ "-f-templatehaskell"+ , "--allow-newer=base"+ , "./QuickCheck-2.6"+ ]+ -- Export monads-tf; it seems to be hidden by default run_ hastePkgBinary ["expose", "monads-tf"] "" where@@ -376,6 +391,9 @@ hasteCabal Clean args = withEnv "HASTE_BOOTING" (const "1") $ run_ hasteCabalBinary as "" where as = "clean" : args+ hasteCabal (Do what) args =+ withEnv "HASTE_BOOTING" (const "1") $ run_ hasteCabalBinary as ""+ where as = what : args vanillaCabal args = run_ "cabal" args ""