packages feed

fay 0.19.0.1 → 0.19.0.2

raw patch · 6 files changed

+20/−10 lines, 6 files

Files

CHANGELOG.md view
@@ -2,6 +2,10 @@  See full history at: <https://github.com/faylang/fay/commits> +#### 0.19.0.2 (2014-01-30)++Bugfixes:+* Don't export transcoding information for fay-base packages when compiling with --no-stdlib  #### 0.19.0.1 (2014-01-15) 
examples/json.hs view
@@ -1,5 +1,3 @@-- module Console where  import           FFI@@ -11,10 +9,12 @@ myData :: MyData myData = MyData { xVar = pack "asdfasd", yVar = 9 } - main = do 	jsonSerialized <- toJSON myData 	jsonDeserialized <- toMyData jsonSerialized+	-- The "instance" field below is required for reliable parsing.+	-- If your JSON source doesn't have an "instance" field, you can+	-- add one like this: ffi "%1['instance']='MyData',%1" :: Json -> MyData 	fromStringData <- toMyData "{\"xVar\":3,\"yVar\":-1,\"instance\":\"MyData\"}" 	print' jsonSerialized 
fay.cabal view
@@ -1,5 +1,5 @@ name:                fay-version:             0.19.0.1+version:             0.19.0.2 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.hs view
@@ -95,18 +95,23 @@ -- | Compile given the location and source string. compileFileWithSource :: FilePath -> String -> Compile ([JsStmt], [JsStmt]) compileFileWithSource filepath contents = do+  exportStdlib <- config configExportStdlib   ((hstmts,fstmts),st,wr) <- compileWith filepath compileModuleFromAST compileFileWithSource desugar contents   modify $ \s -> s { stateImported      = stateImported      st                    , stateJsModulePaths = stateJsModulePaths st                    }-  hstmts' <- maybeOptimize $ hstmts ++ writerCons wr ++ makeTranscoding wr+  hstmts' <- maybeOptimize $ hstmts ++ writerCons wr ++ makeTranscoding exportStdlib (stateModuleName st) wr   fstmts' <- maybeOptimize fstmts   return (hstmts', fstmts')   where-    makeTranscoding :: CompileWriter -> [JsStmt]-    makeTranscoding CompileWriter{..} =-      let fay2js = if null writerFayToJs then [] else fayToJsHash writerFayToJs-          js2fay = if null writerJsToFay then [] else jsToFayHash writerJsToFay+    makeTranscoding :: Bool -> ModuleName a -> CompileWriter -> [JsStmt]+    makeTranscoding exportStdlib moduleName CompileWriter{..} =+      let fay2js = if null writerFayToJs || (anStdlibModule moduleName && not exportStdlib)+                     then []+                     else fayToJsHash writerFayToJs+          js2fay = if null writerJsToFay || (anStdlibModule moduleName && not exportStdlib)+                     then []+                     else jsToFayHash writerJsToFay       in fay2js ++ js2fay     maybeOptimize :: [JsStmt] -> Compile [JsStmt]     maybeOptimize stmts = do
src/Fay/Compiler/Exp.hs view
@@ -38,6 +38,7 @@   Paren _ exp                        -> compileExp exp   Var _ qname                        -> compileVar qname   Lit _ lit                          -> compileLit lit+  App _ (Var _ (UnQual _ (Ident _ "ffi"))) _ -> throwError (FfiNeedsTypeSig exp)   App _ exp1 exp2                    -> compileApp exp1 exp2   NegApp _ exp                       -> compileNegApp exp   InfixApp _ exp1 op exp2            -> compileInfixApp exp1 op exp2
src/Fay/Types.hs view
@@ -201,7 +201,7 @@   | FfiFormatIncompleteArg SrcSpanInfo   | FfiFormatInvalidJavaScript SrcSpanInfo String String   | FfiFormatNoSuchArg SrcSpanInfo Int-  | FfiNeedsTypeSig S.Decl+  | FfiNeedsTypeSig S.Exp   | GHCError String   | InvalidDoBlock   | ParseError S.SrcLoc String