packages feed

yesod-fay 0.4.0.3 → 0.4.0.4

raw patch · 2 files changed

+15/−7 lines, 2 files

Files

Yesod/Fay.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE FlexibleInstances     #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -105,13 +106,15 @@ import           Language.Haskell.TH.Syntax (Exp (LitE), Lit (StringL),                                              Q,                                              qAddDependentFile, qRunIO)-import           System.Environment         (getEnvironment)+import           Control.Exception (IOException,catch)+import           Prelude hiding (catch) import           System.Directory+import           System.Environment         (getEnvironment) import           Text.Julius                (Javascript (Javascript), julius) import           Yesod.Core+import           Yesod.Fay.Data import           Yesod.Form.Jquery          (YesodJquery (..)) import           Yesod.Static-import           Yesod.Fay.Data  jsMainCall :: Bool -> String -> Builder jsMainCall False _ = mempty@@ -207,7 +210,7 @@                     Nothing -> error $ "Unable to parse input: " ++ show txt                     Just cmd -> f go cmd       where-        go Returns = jsonToRepJson . showToFay+        go Returns = returnJson . showToFay  langYesodFay :: String langYesodFay = $(qRunIO $ fmap (LitE . StringL . unpack) $ readTextFile "Language/Fay/Yesod.hs")@@ -265,11 +268,13 @@       packageConf <- fmap (lookup "HASKELL_PACKAGE_SANDBOX") getEnvironment       result <- compileFileWithState conf {           configPackageConf = packageConf+         } fp       case result of         Left e -> return (Left e)-        Right (source,state) -> do+        Right (source',_,state) -> do           let files = stateImported state+              source = "\n(function(){\n" ++ source' ++ "\n})();\n"               (fp_hi,fp_o) = refreshTo           writeFile fp_hi (unlines (filter ours (map snd files)))           writeFile fp_o source@@ -300,7 +305,9 @@              changed <- anyM (fmap (> thisModTime) . getModificationTime) modules              if changed                 then refresh-                else fmap Right (readFile fp_o)+                else catch (fmap Right (readFile fp_o))+                           (\(_ :: IOException) ->+                             refresh)  -- | Does a full compile of the Fay code via GHC for type checking, and then -- embeds the Fay-generated Javascript as a static string. File changes during@@ -360,6 +367,7 @@         liftIO (compileFayFile (mkfp name) config                 { configTypecheck = False                 , configExportRuntime = exportRuntime+                , configSourceMap = True                 })                 >>= \eres -> do         (case eres of
yesod-fay.cabal view
@@ -2,10 +2,10 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                yesod-fay-version:             0.4.0.3+version:             0.4.0.4 synopsis:            Utilities for using the Fay Haskell-to-JS compiler with Yesod. description:         For initial discussion, see <http://www.yesodweb.com/blog/2012/10/yesod-fay-js>. This is a work-in-progress.-homepage:            https://github.com/snoyberg/yesod-fay+homepage:            https://github.com/fpco/yesod-fay license:             MIT license-file:        LICENSE author:              Michael Snoyman