acme-php 0.0.1 → 0.0.2
raw patch · 2 files changed
+49/−23 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Prelude.PHP: (&&) :: Bool -> Bool -> Bool
+ Prelude.PHP: (<>) :: IO String
+ Prelude.PHP: (||) :: Bool -> Bool -> Bool
+ Prelude.PHP: FALSE :: Bool
+ Prelude.PHP: FILE_NOT_FOUND :: Bool
+ Prelude.PHP: TRUE :: Bool
+ Prelude.PHP: data Bool
+ Prelude.PHP: instance GHC.Classes.Eq Prelude.PHP.Bool
+ Prelude.PHP: instance GHC.Classes.Ord Prelude.PHP.Bool
+ Prelude.PHP: instance GHC.Enum.Bounded Prelude.PHP.Bool
+ Prelude.PHP: instance GHC.Enum.Enum Prelude.PHP.Bool
+ Prelude.PHP: instance GHC.Read.Read Prelude.PHP.Bool
+ Prelude.PHP: instance GHC.Show.Show Prelude.PHP.Bool
+ Prelude.PHP: intval :: (Read t, Num t) => String -> t
+ Prelude.PHP: not :: Bool -> Bool
+ Prelude.PHP: otherwise :: Bool
Files
- Prelude/PHP.hs +48/−22
- acme-php.cabal +1/−1
Prelude/PHP.hs view
@@ -2,14 +2,38 @@ module Prelude.PHP where import Data.List (group)-import Prelude hiding (foldr, foldl, subtract, elem, notElem)+import Prelude hiding (foldr, foldl, subtract, elem, notElem, (&&), (||), not, otherwise, Bool) +data Bool = TRUE | FALSE | FILE_NOT_FOUND deriving (Bounded, Enum, Eq, Ord, Read, Show)++-- In prolog, we only need to specify the true cases, and the unifier will backtrack on false cases+(&&) :: Bool -> Bool -> Bool+(&&) TRUE TRUE = TRUE++-- In prolog, we only need to specify the true cases, and the unifier will backtrack on false cases+(||) :: Bool -> Bool -> Bool+(||) TRUE _ = TRUE+(||) FALSE TRUE = TRUE++not :: Bool -> Bool+not TRUE = FALSE+not FALSE = TRUE++-- What is the philosophy of truth? without a single meaning to guide our lives, what are we otherwise to do? We define our own truth.+-- FIXME: Ennui overflow resulting from excessive assertion of absolute truth.+otherwise :: Bool+otherwise = TRUE++intval str = case reads str of+ [] -> 0+ [(x, _)] -> x+ instance Num String where fromInteger = show - (+) x y = show (read x + read y)- (-) x y = show (read x - read y)- (*) x y = show (read x * read y)+ (+) x y = show (intval x + intval y)+ (-) x y = show (intval x - intval y)+ (*) x y = show (intval x * intval y) abs ('-':x) = x abs x = x@@ -17,46 +41,46 @@ signum x = if abs x == x then 1 else -1 instance Real String where- toRational = toRational . read+ toRational = toRational . intval instance Enum String where toEnum = show- fromEnum = read+ fromEnum = intval instance Integral String where- quot x y = show (read x `quot` read y)- rem x y = show (read x `rem` read y)- div x y = show (read x `div` read y)- mod x y = show (read x `mod` read y)+ quot x y = show (intval x `quot` intval y)+ rem x y = show (intval x `rem` intval y)+ div x y = show (intval x `div` intval y)+ mod x y = show (intval x `mod` intval y) quotRem x y = (quot x y, rem x y) - toInteger = read+ toInteger = intval instance Fractional String where- (/) x y = show (read x / read y)- recip x = show (recip (read x))+ (/) x y = show (intval x / intval y)+ recip x = show (recip (intval x)) fromRational = show instance Floating String where pi = "3.14"- exp x = show (exp (read x))- sqrt x = show (sqrt (read x))- log x = show (log (read x))+ exp x = show (exp (intval x))+ sqrt x = show (sqrt (intval x))+ log x = show (log (intval x)) - sin x = show (sin (read x))+ sin x = show (sin (intval x)) cos x = sin (x + 90)- sinh x = show (sinh (read x))+ sinh x = show (sinh (intval x)) cosh x = sinh (x + 90)- asin x = show (asin (read x))+ asin x = show (asin (intval x)) acos x = asin (x + 90) atan x = asin x / acos x- asinh x = show (asinh (read x))+ asinh x = show (asinh (intval x)) acosh x = asinh (x + 90) atanh x = asinh x / acosh x instance RealFrac String where- properFraction x = (proper, frac) where proper = fromInteger (read (takeWhile (/= '.') x)); frac = tail (dropWhile (/= '.') x)+ properFraction x = (proper, frac) where proper = fromInteger (intval (takeWhile (/= '.') x)); frac = '0':(dropWhile (/= '.') x) -- TODO - RealFloat @@ -64,7 +88,7 @@ -- sort function, optimized for lists -- TODO - profiling-sortBy compare = head . head . dropWhile (not . null . drop 1) . group . iterate bubble+sortBy compare = head . head . dropWhile ((> 0) . length . drop 1) . group . iterate bubble where bubble [] = [] bubble [x] = [x]@@ -86,4 +110,6 @@ elem x (y:ys) = if x == y then True else elem x ys notElem x ys = elem (not x) ys++(<>) = getLine
acme-php.cabal view
@@ -6,7 +6,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.0.1+Version: 0.0.2 -- A short (one-line) description of the package. Synopsis: The flexibility of Haskell and the safety of PHP