fay 0.14.2.0 → 0.14.3.0
raw patch · 4 files changed
+27/−22 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- examples/tailrecursive.hs +1/−1
- fay.cabal +4/−8
- js/runtime.js +2/−2
- src/Test/Util.hs +20/−11
examples/tailrecursive.hs view
@@ -34,7 +34,7 @@ -- tail recursive sum' 0 acc = acc-sum' n acc = sum' (n - 1) (acc + n)+sum' n acc = let x = acc + n in x `seq` sum' (n - 1) x getSeconds :: Fay Double getSeconds = ffi "new Date()"
fay.cabal view
@@ -1,5 +1,5 @@ name: fay-version: 0.14.2.0+version: 0.14.3.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,@@ -21,14 +21,10 @@ . /Release Notes/ .- * Recursively check package directories for .hs files.- .- * Fix examples.- .- * Show line numbers in FFI errors.- .- * Support () in pattern matches.+ * Fix serialization of Defined/Nullable. .+ * Fix Closure compression for Defined/Nullable.+ * See full history at: <https://github.com/faylang/fay/commits> homepage: http://fay-lang.org/ bug-reports: https://github.com/faylang/fay/issues
js/runtime.js view
@@ -196,7 +196,7 @@ if (fayObj instanceof $_Language$Fay$FFI$Undefined) { jsObj = undefined; } else {- jsObj = Fay$$fayToJsUserDefined(args[0],fayObj["slot1"]);+ jsObj = Fay$$fayToJs(args[0],fayObj.slot1); } }@@ -205,7 +205,7 @@ if (fayObj instanceof $_Language$Fay$FFI$Null) { jsObj = null; } else {- jsObj = Fay$$fayToJsUserDefined(args[0],fayObj["slot1"]);+ jsObj = Fay$$fayToJs(args[0],fayObj.slot1); } }
src/Test/Util.hs view
@@ -1,23 +1,32 @@-module Test.Util where+module Test.Util+ ( fayPath+ , isRight+ , fromLeft+ ) where import Control.Applicative import System.Directory-import System.Process.Extra+import System.Process.Extra (readAllFromProcess) -- Path to the fay executable, looks in cabal-dev, dist, PATH in that order. fayPath :: IO (Maybe FilePath)-fayPath = do- cabalDev <- doesFileExist cabalDevPath- if cabalDev- then return (Just cabalDevPath)- else do- dist <- doesFileExist distPath- if dist- then return (Just distPath)- else either (const Nothing) (Just . concat . lines . snd) <$> readAllFromProcess "which" ["fay"] ""+fayPath =+ (<|>) <$> firstWhereM doesFileExist [cabalDevPath, distPath] <*> usingWhich where cabalDevPath = "./cabal-dev/bin/fay" distPath = "./dist/build/fay/fay"+ usingWhich = fmap (concat . lines . snd) . hush <$> readAllFromProcess "which" ["fay"] ""++firstWhereM :: (Monad m) => (a -> m Bool) -> [a] -> m (Maybe a)+firstWhereM pred ins = case ins of+ [] -> return Nothing+ a:as -> pred a >>= \b ->+ if b then return (Just a)+ else firstWhereM pred as++-- from the package `errors`+hush :: Either a b -> Maybe b+hush = either (const Nothing) Just isRight :: Either a b -> Bool isRight (Right _) = True