fay-base 0.14.2.0 → 0.14.3.0
raw patch · 2 files changed
+43/−21 lines, 2 filesdep ~fayPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: fay
API changes (from Hackage documentation)
+ Prelude: data Fay a :: * -> *
+ Prelude: seq :: a -> b -> b
Files
- fay-base.cabal +7/−3
- src/Prelude.hs +36/−18
fay-base.cabal view
@@ -1,12 +1,12 @@ name: fay-base-version: 0.14.2.0+version: 0.14.3.0 synopsis: The base package for Fay. description: The base package for Fay. This package exports Prelude and FFI which you probably want to use with Fay. license: BSD3 license-file: LICENSE author: Chris Done-maintainer: chrisdone@gmail.com+maintainer: Adam Bergmark homepage: https://github.com/faylang/fay-base bug-reports: https://github.com/faylang/fay-base/issues copyright: 2012 Chris Done@@ -15,10 +15,14 @@ cabal-version: >=1.8 data-files: src/Prelude.hs src/FFI.hs src/Data/Data.hs +source-repository head+ type: git+ location: https://github.com/faylang/fay.git+ library hs-source-dirs: src exposed: False exposed-modules: Prelude ,FFI ,Data.Data- build-depends: base == 4.*, fay >= 0.14.1.0+ build-depends: base == 4.*, fay >= 0.14.3.0
src/Prelude.hs view
@@ -76,6 +76,7 @@ -- Functions ,until ,($!)+ ,seq ,const ,id ,(.)@@ -199,6 +200,7 @@ -- IO ,print ,putStrLn+ ,Fay ) #endif where@@ -211,6 +213,35 @@ ,(||),(&&),seq,Eq,(==),(/=)) --------------------------------------------------------------------------------+-- Fixities++infixr 9 .+infixr 8 ^, ^^, **+infixl 7 *, /, `quot`, `rem`, `div`, `mod`+infixl 6 +, -++-- The (:) operator is built-in syntax, and cannot legally be given+-- a fixity declaration; but its fixity is given by:+-- infixr 5 :++-- Provided by base prelude+-- infix 4 ==, /=+-- infixr 3 &&+-- infixr 2 ||+-- infixr 0 $, $!++infixr 4 <, <=, >=, >+infixl 1 >>, >>=+infixr 1 =<<+infixr 0 $, $!++-- PreludeList++infixl 9 !!+infixr 5 +++infix 4 `elem`, `notElem`++-------------------------------------------------------------------------------- -- Aliases of base type String = Base.String@@ -271,7 +302,6 @@ (=<<) :: (a -> Fay b) -> Fay a -> Fay b f =<< x = x >>= f-infixr 1 =<< -- | Evaluate each action in the sequence from left to right, -- and collect the results.@@ -397,7 +427,7 @@ error :: String -> a error = ffi "(function() { throw %1 })()" --- | Throws “undefined” via "error".+-- | Throws "undefined" via "error". undefined :: a undefined = error "Prelude.undefined" @@ -413,7 +443,6 @@ ($!) :: (a -> b) -> a -> b f $! x = x `seq` f x-infixr 0 $! const :: a -> b -> a const a _ = a@@ -423,11 +452,9 @@ (.) :: (t1 -> t) -> (t2 -> t1) -> t2 -> t (f . g) x = f (g x)-infixr 9 . ($) :: (t1 -> t) -> t1 -> t f $ x = f x-infixr 0 $ flip :: (t1 -> t2 -> t) -> t2 -> t1 -> t flip f x y = f y x@@ -452,14 +479,12 @@ | x > 0 && y < 0 = quot (x-1) y - 1 | x < 0 && y > 0 = quot (x+1) y - 1 div x y = quot x y-infixl 7 `div` mod :: Int -> Int -> Int mod x y | x > 0 && y < 0 = rem (x-1) y + y + 1 | x < 0 && y > 0 = rem (x+1) y + y - 1 mod x y = rem x y-infixl 7 `mod` divMod :: Int -> Int -> (Int, Int) divMod x y@@ -468,10 +493,10 @@ divMod x y = quotRem x y min :: (Num a) => a -> a -> a-min = ffi "Math.min(%1,%2)"+min = ffi "Math.min(Fay$$_(%1),Fay$$_(%2))" max :: (Num a) => a -> a -> a-max = ffi "Math.max(%1,%2)"+max = ffi "Math.max(Fay$$_(%1),Fay$$_(%2))" recip :: Double -> Double recip x = 1 / x@@ -507,16 +532,14 @@ -- | Uses Math.pow. (**) :: Double -> Double -> Double (**) = unsafePow-infixr 8 ** -- | Uses Math.pow. (^^) :: Double -> Int -> Double (^^) = unsafePow-infixr 8 ^^ -- | Uses Math.pow. unsafePow :: (Num a,Num b) => a -> b -> a-unsafePow = ffi "Math.pow(%1,%2)"+unsafePow = ffi "Math.pow(Fay$$_(%1),Fay$$_(%2))" -- | Implemented in Fay, it's not fast. (^) :: Num a => a -> Int -> a@@ -524,7 +547,6 @@ | b == 0 = 1 | even b = let x = a ^ (b `quot` 2) in x * x a ^ b = a * a ^ (b - 1)-infixr 8 ^ -- | Implemented in Fay, not fast. logBase :: Double -> Double -> Double@@ -619,7 +641,6 @@ -- | Uses quot'. quot :: Int -> Int -> Int quot x y = if y == 0 then error "Division by zero" else quot' x y-infixl 7 `quot` -- | Uses ~~(a/b). quot' :: Int -> Int -> Int@@ -632,7 +653,6 @@ -- | Uses rem'. rem :: Int -> Int -> Int rem x y = if y == 0 then error "Division by zero" else rem' x y-infixl 7 `rem` -- | Uses %%. rem' :: Int -> Int -> Int@@ -725,14 +745,12 @@ (++) :: [a] -> [a] -> [a] x ++ y = conc x y-infixr 5 ++ (!!) :: [a] -> Int -> a a !! b = if b < 0 then error "(!!): negative index" else go a b where go [] _ = error "(!!): index too large" go (h:_) 0 = h go (_:t) n = go t (n-1)-infixl 9 !! head :: [a] -> a head [] = error "head: empty list"@@ -744,7 +762,7 @@ init :: [a] -> [a] init [] = error "init: empty list"-init [a] = [a]+init [a] = [] init (h:t) = h : init t last :: [a] -> a