haste-compiler 0.4.4.3 → 0.4.4.4
raw patch · 7 files changed
+35/−57 lines, 7 filesdep −bytestring-builderdep ~bytestringdep ~ghcPVP ok
version bump matches the API change (PVP)
Dependencies removed: bytestring-builder
Dependency ranges changed: bytestring, ghc
API changes (from Hackage documentation)
Files
- haste-compiler.cabal +3/−9
- src/Data/JSTarget/Optimize.hs +3/−1
- src/Data/JSTarget/PP.hs +9/−25
- src/Data/JSTarget/Print.hs +4/−4
- src/Haste/Config.hs +4/−5
- src/Haste/Linker.hs +11/−12
- src/Haste/Version.hs +1/−1
haste-compiler.cabal view
@@ -1,5 +1,5 @@ Name: haste-compiler-Version: 0.4.4.3+Version: 0.4.4.4 License: BSD3 License-File: LICENSE Synopsis: Haskell To ECMAScript compiler@@ -108,9 +108,8 @@ binary, containers, data-default,- bytestring >= 0.9.2.1,+ bytestring >= 0.10.4, utf8-string,- blaze-builder, array, ghc-paths, random,@@ -294,12 +293,7 @@ random, binary, data-binary-ieee754,- bytestring >= 0.9.2.1,- -- We don't use bytestring-builder directly, but its instances- -- propagate into Haste anyway, like it or not, so we must be able to- -- check which version is used to know if we should make a custom- -- IsString instance for Builder or not.- bytestring-builder,+ bytestring, utf8-string, -- For Haste.Compiler shellmate >= 0.1.5,
src/Data/JSTarget/Optimize.hs view
@@ -7,6 +7,7 @@ import Data.JSTarget.Op import Data.JSTarget.Traversal import Control.Applicative+import Control.Monad import qualified Data.Map as M import qualified Data.Set as S @@ -31,6 +32,7 @@ topLevelInline (AST ast js) = flip runTravM js $ do unTrampoline ast+-- return ast >>= inlineAssigns >>= optimizeArrays >>= optimizeThunks@@ -307,7 +309,7 @@ -- guaranteed to use no more stack frames than we would have without this -- optimization. unTrampoline :: Stm -> TravM Stm-unTrampoline s = go s >>= go >>= go+unTrampoline = go >=> go >=> go where go s = do ntcs <- gatherNonTailcalling s
src/Data/JSTarget/PP.hs view
@@ -15,8 +15,7 @@ import qualified Data.ByteString.Lazy as BS import Data.JSTarget.AST (AST (..), Name (..), JumpTable, Lbl, Stm) import Data.JSTarget.Traversal (JSTrav)-import Blaze.ByteString.Builder-import Blaze.ByteString.Builder.Char.Utf8 as B+import Data.ByteString.Builder -- | Pretty-printing options data PPOpts = PPOpts {@@ -37,15 +36,6 @@ emptyNS :: NameSupply emptyNS = (FinalName 0, M.empty) -intDec :: Int -> Builder-intDec = B.fromString . show--doubleDec :: Double -> Builder-doubleDec = B.fromString . show--integerDec :: Integer -> Builder-integerDec = B.fromString . show- newtype PP a = PP {unPP :: PPOpts -> IndentLvl -> NameSupply@@ -129,16 +119,16 @@ -- | Turn a FinalName into a Builder. buildFinalName :: FinalName -> Builder buildFinalName (FinalName 0) =- B.fromString "_0"+ fromString "_0" buildFinalName (FinalName fn) =- fromChar '_' <> go fn mempty+ charUtf8 '_' <> go fn mempty where arrLen = 62 chars = listArray (0,arrLen-1) $ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" go 0 acc = acc go n acc = let (rest, ix) = n `quotRem` arrLen - in go rest (fromChar (chars ! ix) <> acc)+ in go rest (charUtf8 (chars ! ix) <> acc) -- | Indent the given builder another step. indent :: PP a -> PP a@@ -153,9 +143,9 @@ instance Buildable Builder where put x = PP $ \_ _ ns _ b -> (ns, b <> x, ()) instance Buildable String where- put = put . B.fromString+ put = put . stringUtf8 instance Buildable Char where- put = put . fromChar+ put = put . charUtf8 instance Buildable Int where put = put . intDec instance Buildable Double where@@ -166,7 +156,8 @@ instance Buildable Integer where put = put . integerDec instance Buildable Bool where- put x = put $ if x then B.fromString "true" else B.fromString "false"+ put True = "true"+ put False = "false" -- | Emit indentation up to the current level. ind :: PP ()@@ -194,15 +185,8 @@ ppList _ _ = return () -#if MIN_VERSION_bytestring(0,10,4) || MIN_VERSION_bytestring_builder(0,10,4)--- bytestring contains this instance from 0.10.4.0 onwards-#else-instance IsString Builder where- fromString = B.fromString-#endif- instance IsString (PP ()) where- fromString = put . B.fromString+ fromString = put . stringUtf8 -- | Pretty-printer class. Each part of the AST needs an instance of this. class Pretty a where
src/Data/JSTarget/Print.hs view
@@ -5,7 +5,7 @@ import Data.JSTarget.AST import Data.JSTarget.Op import Data.JSTarget.PP as PP-import Blaze.ByteString.Builder.Char.Utf8+import Data.ByteString.Builder import Data.Monoid import Control.Monad import Data.Char@@ -13,12 +13,12 @@ instance Pretty Var where pp (Foreign name) =- put $ fromString name+ put $ stringUtf8 name pp (Internal name comment) = do pp name doComment <- getOpt nameComments when (doComment && not (null comment)) $- put $ "/* " <> fromString comment <> " */"+ put $ "/* " <> stringUtf8 comment <> " */" instance Pretty Name where pp name = finalNameFor name >>= put . buildFinalName@@ -237,7 +237,7 @@ let bparens = case b of Lit (LNum n) | n < 0 -> \x -> "(".+. pp x .+. ")" _ -> parensR- parensL a .+. put (fromString $ show op) .+. bparens b+ parensL a .+. put (stringUtf8 $ show op) .+. bparens b where parensL x = if expPrec x < opPrec op then "(" .+. pp x .+. ")"
src/Haste/Config.hs view
@@ -4,8 +4,7 @@ safeMultiply, debugLib) where import Data.JSTarget import Control.Shell (replaceExtension, (</>))-import Blaze.ByteString.Builder-import Blaze.ByteString.Builder.Char.Utf8+import Data.ByteString.Builder import Data.Monoid import Haste.Environment import Outputable (Outputable)@@ -42,10 +41,10 @@ -- | Replace the first occurrence of $HASTE_MAIN with Haste's entry point -- symbol. insertSym :: String -> AppStart-insertSym [] _ = fromString ""+insertSym [] _ = stringUtf8 "" insertSym str sym- | Just r <- stripPrefix "$HASTE_MAIN" str = sym <> fromString r- | (l,r) <- span (/= '$') str = fromString l <> insertSym r sym+ | Just r <- stripPrefix "$HASTE_MAIN" str = sym <> stringUtf8 r+ | (l,r) <- span (/= '$') str = stringUtf8 l <> insertSym r sym -- | Execute the program when the document has finished loading. startOnLoadComplete :: AppStart
src/Haste/Linker.hs view
@@ -9,8 +9,7 @@ import Control.Applicative import Data.JSTarget import qualified Data.ByteString.Lazy as B-import Blaze.ByteString.Builder-import Blaze.ByteString.Builder.Char.Utf8+import Data.ByteString.Builder import Data.Monoid import System.IO (hPutStrLn, stderr) @@ -29,8 +28,8 @@ ds <- getAllDefs cfg (targetLibPath cfg : libPaths cfg) mainmod pkgid mainSym let myDefs = if wholeProgramOpts cfg then topLevelInline ds else ds (progText, myMain') = prettyProg (ppOpts cfg) mainSym myDefs- callMain = fromString "B(A(" <> myMain' <> fromString ", [0]));"- launchApp = appStart cfg (fromString "hasteMain")+ callMain = stringUtf8 "B(A(" <> myMain' <> stringUtf8 ", [0]));"+ launchApp = appStart cfg (stringUtf8 "hasteMain") rtslibs <- mapM readFile $ rtsLibs cfg extlibs <- mapM readFile $ jsExternals cfg@@ -39,19 +38,19 @@ $ assembleProg (wrapProg cfg) extlibs rtslibs progText callMain launchApp where assembleProg True extlibs rtslibs progText callMain launchApp =- fromString (unlines extlibs)- <> fromString "var hasteMain = function() {"- <> fromString (unlines rtslibs)+ stringUtf8 (unlines extlibs)+ <> stringUtf8 "var hasteMain = function() {"+ <> stringUtf8 (unlines rtslibs) <> progText <> callMain- <> fromString "};\n"+ <> stringUtf8 "};\n" <> launchApp assembleProg _ extlibs rtslibs progText callMain launchApp =- fromString (unlines extlibs)- <> fromString (unlines rtslibs)+ stringUtf8 (unlines extlibs)+ <> stringUtf8 (unlines rtslibs) <> progText- <> fromString "\nvar hasteMain = function() {" <> callMain- <> fromString "};"+ <> stringUtf8 "\nvar hasteMain = function() {" <> callMain+ <> stringUtf8 "};" <> launchApp -- | Produce an info message if verbose reporting is enabled.
src/Haste/Version.hs view
@@ -14,7 +14,7 @@ -- | Current Haste version. hasteVersion :: Version-hasteVersion = Version [0, 4, 4, 3] []+hasteVersion = Version [0, 4, 4, 4] [] -- | Current Haste version as an Int. The format of this version number is -- MAJOR*10 000 + MINOR*100 + MICRO.