fay-base 0.21.0.0 → 0.21.1.0
raw patch · 7 files changed
+22/−16 lines, 7 filesdep ~fayPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: fay
API changes (from Hackage documentation)
- Prelude: seq :: a -> b -> b
+ Prelude: seq :: () => a -> b -> b
Files
- CHANGELOG.md +4/−0
- fay-base.cabal +2/−2
- src/Data/MutMap.hs +5/−6
- src/Data/Ratio.hs +4/−3
- src/Data/Time.hs +1/−1
- src/Data/Var.hs +1/−1
- src/Prelude.hs +5/−3
CHANGELOG.md view
@@ -1,5 +1,9 @@ ## Changelog +## 0.21.1.0 (2018-03-09)++* fay 0.24.0.0 support+ ## 0.21.0.0 (2017-08-02) * Changed the definition of `splitOn` from `Char -> Text -> [Text]` to `Text -> Text -> [Text]` to make it more general and to match `text:Data.Text.splitOn`. Thanks to A. Bram Neijt!
fay-base.cabal view
@@ -1,5 +1,5 @@ name: fay-base-version: 0.21.0.0+version: 0.21.1.0 synopsis: The base package for Fay. description: The base package for Fay. This package amongst others exports Prelude and FFI which you probably want to use with Fay.@@ -59,4 +59,4 @@ Unsafe.Coerce build-depends: base == 4.*- , fay >= 0.21.1 && < 0.24+ , fay >= 0.21.1 && < 0.25
src/Data/MutMap.hs view
@@ -22,7 +22,6 @@ import Data.Defined import Data.MutMap.Internal import Data.Text (Text)-import qualified Data.Text as T import FFI import Prelude @@ -37,7 +36,7 @@ mutFromList = mutFromListI . map (\(key, val) -> KeyValI (addSalt key) val) mutFromListI :: [KeyValI a] -> Fay (MutMap a)-mutFromListI = ffi "function() { var r = {}; $.each(%1, function(ix, x) { r[x.slot1] = x.slot2; }); return r; }()"+mutFromListI = ffi "function() { var r = {}; for(var key in %1) { r[%1[key].slot1] = %1[key].slot2; } return r; }()" -- Query @@ -63,21 +62,21 @@ mutAssocsI = ffi "function() { var r = []; for (var k in %1) { r.push({ instance : 'KeyValI', slot1 : k, slot2 : %1[k] }); } return r; }()" mutClone :: MutMap a -> Fay (MutMap a)-mutClone = ffi "jQuery['extend']({}, %1)"+mutClone = ffi "Fay$$objConcat({}, %1)" -- Note: Also clones. mutMapM :: (a -> Fay b) -> MutMap a -> MutMap b-mutMapM = ffi "jQuery['map'](jQuery['extend']({}, %2), %1)"+mutMapM = ffi "function () { var r = {}; for(var key in %2){ r[key] = %1(%2[key]); } return r;}()" mutMapM_ :: (a -> Fay ()) -> MutMap a -> Fay ()-mutMapM_ = ffi "jQuery['map'](%2, function(x) { %1(x); return x; })"+mutMapM_ = ffi "function () { var r = {}; for(var key in %2){ %1(%2[key]); } return;}()" -- Note: Also clones. mutMapMaybeM :: (a -> Fay (Maybe b)) -> MutMap a -> MutMap b mutMapMaybeM f = mutMapMaybeMI $ \x -> f x >>= return . toDefined mutMapMaybeMI :: (a -> Fay (Defined b)) -> MutMap a -> MutMap b-mutMapMaybeMI = ffi "jQuery['map']($['extend']({}, %2), %1)"+mutMapMaybeMI = ffi "function () { var r = {}; for(var key in %2){ r[key] = %1(%2[key]); } return r;}()" -- Mutation
src/Data/Ratio.hs view
@@ -27,9 +27,10 @@ (%) :: Int -> Int -> Rational x % y = reduce (x * signum y) (abs y) where reduce :: Int -> Int -> Rational- reduce x y | y == 0 = error "can't devide by zero"- | otherwise = let d = gcd x y- in Ratio (x `quot` d) (y `quot` d)+ reduce x' y' = if y' == 0+ then error "can't devide by zero"+ else let d = gcd x' y'+ in Ratio (x' `quot` d) (y' `quot` d) numerator, denominator :: Rational -> Int numerator (Ratio n _) = n
src/Data/Time.hs view
@@ -65,4 +65,4 @@ -- | Show a day. Meant for debugging purposes, not production presentation. showDay :: Day -> Text showDay =- ffi "date.getUTCFullYear() + ' ' + showMonth(date) + ' ' + (date.getUTCDate() + 1)"+ ffi "(%1).getUTCFullYear() + ' ' + ((%1).getUTCMonth() + 1) + ' ' + ((%1).getUTCDate() + 1)"
src/Data/Var.hs view
@@ -144,7 +144,7 @@ subscribeAndRead :: Var a -> (a -> Fay void) -> Fay (() -> Fay ()) subscribeAndRead v f = do x <- get v- f x+ _ <- f x subscribe v f -- | Subscribe to a 'Var', but only call handler when it actually changes, and
src/Prelude.hs view
@@ -209,7 +209,9 @@ ) where +#ifdef FAY import Data.Data+#endif import Fay.FFI import "base" Prelude (Bool (True, False), Eq, seq, (&&), (/=), (==), (||))@@ -290,7 +292,7 @@ -- | Monomorphic return for Fay. return :: a -> Fay a-return = ffi "Fay$$return(%1)"+return = ffi "Fay$$$_return(%1)" fail :: String -> Fay a fail = error@@ -792,7 +794,7 @@ init :: [a] -> [a] init [] = error "init: empty list"-init [a] = []+init [_] = [] init (h:t) = h : init t last :: [a] -> a@@ -824,7 +826,7 @@ drop :: Int -> [a] -> [a] drop 0 xs = xs drop _ [] = []-drop n xss@(x:xs) = if n < 0 then xss+drop n xss@(_:xs) = if n < 0 then xss else drop (n-1) xs splitAt :: Int -> [a] -> ([a], [a])