fay 0.23.0.1 → 0.23.1.0
raw patch · 14 files changed
+67/−22 lines, 14 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- fay.cabal +1/−1
- src/Fay/Compiler/Typecheck.hs +4/−1
- src/Fay/Config.hs +3/−0
- src/main/Main.hs +3/−0
- src/tests/Test/Compile.hs +4/−4
- tests/Compile/Pretty.hs +0/−9
- tests/Compile/Pretty.res +0/−7
- tests/Compile/pretty.hs +9/−0
- tests/Compile/pretty.res +7/−0
- tests/Compile/prettyOperators.hs +9/−0
- tests/Compile/prettyOperators.res +7/−0
- tests/Compile/prettyThunks.hs +9/−0
- tests/Compile/prettyThunks.res +7/−0
CHANGELOG.md view
@@ -2,6 +2,10 @@ See full history at: <https://github.com/faylang/fay/commits> +#### 0.23.1.0++* Add `--show-ghc-calls` and `configShowGhcCalls` to print invocations to GHC.+ #### 0.23.0.1 * Allow `mtl-compat 0.2.*` and `transformers-compat 0.4.*"`.
fay.cabal view
@@ -1,5 +1,5 @@ name: fay-version: 0.23.0.1+version: 0.23.1.0 synopsis: A compiler for Fay, a Haskell subset that compiles to JavaScript. description: Fay is a proper subset of Haskell which is type-checked with GHC, and compiled to JavaScript. It is lazy, pure, has a Fay monad,
src/Fay/Compiler/Typecheck.hs view
@@ -40,7 +40,10 @@ , "-i" ++ intercalate ":" includeDirs , fp ] ++ ghcPackageDbArgs ++ wallF ++ map ("-package " ++) packages exists <- doesFileExist GHCPaths.ghc- res <- readAllFromProcess (if exists then GHCPaths.ghc else "ghc") flags ""+ let ghcPath = if exists then GHCPaths.ghc else "ghc"+ when (configShowGhcCalls cfg) $+ putStrLn . intercalate " " $ ghcPath : flags+ res <- readAllFromProcess ghcPath flags "" either (return . Left . GHCError . fst) (return . Right . fst) res where wallF | configWall cfg = ["-Wall"]
src/Fay/Config.hs view
@@ -25,6 +25,7 @@ , configOptimizeNewtypes , configPrettyThunks , configPrettyOperators+ , configShowGhcCalls ) , defaultConfig , defaultConfigWithSandbox@@ -76,6 +77,7 @@ , configOptimizeNewtypes :: Bool -- ^ Optimize away newtype constructors? , configPrettyThunks :: Bool -- ^ Use pretty thunk names? , configPrettyOperators :: Bool -- ^ Use pretty operators?+ , configShowGhcCalls :: Bool -- ^ Print commands sent to GHC? } deriving (Show) defaultConfig :: Config@@ -106,6 +108,7 @@ , configOptimizeNewtypes = True , configPrettyThunks = False , configPrettyOperators = False+ , configShowGhcCalls = False } defaultConfigWithSandbox :: IO Config
src/main/Main.hs view
@@ -44,6 +44,7 @@ , optTypecheckOnly :: Bool , optVersion :: Bool , optWall :: Bool+ , optShowGhcCalls :: Bool , optFiles :: [String] } @@ -75,6 +76,7 @@ , configOptimizeNewtypes = not $ optNoOptimizeNewtypes opts , configPrettyThunks = optPrettyThunks opts || optPrettyAll opts , configPrettyOperators = optPrettyOperators opts || optPrettyAll opts+ , configShowGhcCalls = optShowGhcCalls opts } if optVersion opts then runCommandVersion@@ -128,6 +130,7 @@ <*> switch (long "typecheck-only" <> help "Only invoke GHC for typechecking, don't produce any output") <*> switch (long "version" <> help "Output version number") <*> switch (long "Wall" <> help "Typecheck with -Wall")+ <*> switch (long "show-ghc-calls" <> help "Print commands sent to ghc") <*> many (argument (ReadM ask) (metavar "<hs-file>...")) where strsOption :: Mod OptionFields [String] -> Parser [String]
src/tests/Test/Compile.hs view
@@ -96,14 +96,14 @@ assertPretty :: Config -> String -> Assertion assertPretty cfg flagName = do- res <- compileFile cfg "tests/Compile/Pretty.hs"+ res <- compileFile cfg $ "tests/Compile/" ++ flagName ++ ".hs" case res of Left l -> assertFailure $ "Should compile, but failed with: " ++ show l Right js -> do- writeFile "tests/Compile/Pretty.js" js- (err, out) <- either id id <$> readAllFromProcess "node" ["tests/Compile/Pretty.js"] ""+ writeFile ("tests/Compile/" ++ flagName ++ ".js") js+ (err, out) <- either id id <$> readAllFromProcess "node" ["tests/Compile/" ++ flagName ++ ".js"] "" when (err /= "") $ assertFailure err- expected <- readFile "tests/Compile/Pretty.res"+ expected <- readFile $ "tests/Compile/" ++ flagName ++ ".res" assertEqual (flagName ++ " node stdout") expected out case_pretty :: Assertion
− tests/Compile/Pretty.hs
@@ -1,9 +0,0 @@-module Pretty where--import Prelude--main = do- let n = 3::Int- print . length' 0 . takeWhile (<=n) $ [0..]- putStrLn $ if (n + 5) ^ 2 == 64 && n*8 == 26 then "T" else "F"- forM [1..5] $ \k -> putStrLn $ if odd k then "odd" else "even"
− tests/Compile/Pretty.res
@@ -1,7 +0,0 @@-4-F-odd-even-odd-even-odd
+ tests/Compile/pretty.hs view
@@ -0,0 +1,9 @@+module Pretty where++import Prelude++main = do+ let n = 3::Int+ print . length' 0 . takeWhile (<=n) $ [0..]+ putStrLn $ if (n + 5) ^ 2 == 64 && n*8 == 26 then "T" else "F"+ forM [1..5] $ \k -> putStrLn $ if odd k then "odd" else "even"
+ tests/Compile/pretty.res view
@@ -0,0 +1,7 @@+4+F+odd+even+odd+even+odd
+ tests/Compile/prettyOperators.hs view
@@ -0,0 +1,9 @@+module Pretty where++import Prelude++main = do+ let n = 3::Int+ print . length' 0 . takeWhile (<=n) $ [0..]+ putStrLn $ if (n + 5) ^ 2 == 64 && n*8 == 26 then "T" else "F"+ forM [1..5] $ \k -> putStrLn $ if odd k then "odd" else "even"
+ tests/Compile/prettyOperators.res view
@@ -0,0 +1,7 @@+4+F+odd+even+odd+even+odd
+ tests/Compile/prettyThunks.hs view
@@ -0,0 +1,9 @@+module Pretty where++import Prelude++main = do+ let n = 3::Int+ print . length' 0 . takeWhile (<=n) $ [0..]+ putStrLn $ if (n + 5) ^ 2 == 64 && n*8 == 26 then "T" else "F"+ forM [1..5] $ \k -> putStrLn $ if odd k then "odd" else "even"
+ tests/Compile/prettyThunks.res view
@@ -0,0 +1,7 @@+4+F+odd+even+odd+even+odd