acme-php (empty) → 0.0.1
raw patch · 4 files changed
+180/−0 lines, 4 filesdep +basesetup-changed
Dependencies added: base
Files
- LICENSE +30/−0
- Prelude/PHP.hs +89/−0
- Setup.hs +2/−0
- acme-php.cabal +59/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c)2012, ++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Prelude/PHP.hs view
@@ -0,0 +1,89 @@+{-# LANGUAGE NoImplicitPrelude, ExtendedDefaultRules, TypeSynonymInstances, FlexibleInstances #-}+module Prelude.PHP where++import Data.List (group)+import Prelude hiding (foldr, foldl, subtract, elem, notElem)++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)++ abs ('-':x) = x+ abs x = x++ signum x = if abs x == x then 1 else -1++instance Real String where+ toRational = toRational . read++instance Enum String where+ toEnum = show+ fromEnum = read++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)++ quotRem x y = (quot x y, rem x y)++ toInteger = read++instance Fractional String where+ (/) x y = show (read x / read y)+ recip x = show (recip (read 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))++ sin x = show (sin (read x))+ cos x = sin (x + 90)+ sinh x = show (sinh (read x))+ cosh x = sinh (x + 90)+ asin x = show (asin (read x))+ acos x = asin (x + 90)+ atan x = asin x / acos x+ asinh x = show (asinh (read 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)++-- TODO - RealFloat++sort = sortBy compare++-- sort function, optimized for lists+-- TODO - profiling+sortBy compare = head . head . dropWhile (not . null . drop 1) . group . iterate bubble+ where+ bubble [] = []+ bubble [x] = [x]+ bubble (x:y:ys) = if compare x y == GT then y:x:(bubble ys) else if compare x y == EQ then x:(bubble (y:ys)) else if compare x y == LT then x:(bubble (y:ys)) else x:y:(bubble ys)++foldr :: (a -> b -> b) -> b -> [a] -> b+foldr f z [] = z+foldr f z (x:xs) = f x (foldr f z xs)++foldl :: (a -> b -> a) -> a -> [b] -> a+foldl f z xs = foldr (flip f) z (reverse xs)++foldl' f z xs = xs `seq` foldl f z xs++subtract :: Num a => a -> a -> a+subtract = (-)++elem x [] = False+elem x (y:ys) = if x == y then True else elem x ys++notElem x ys = elem (not x) ys+
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ acme-php.cabal view
@@ -0,0 +1,59 @@+-- acme-php.cabal auto-generated by cabal init. For additional options, see+-- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.+-- The name of the package.+Name: acme-php++-- 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++-- A short (one-line) description of the package.+Synopsis: The flexibility of Haskell and the safety of PHP++-- A longer description of the package.+Description: At last, a module that combines the dynamic-typing features of Haskell 2010 with the performance and strict semantics of PHP!++-- The license under which the package is released.+License: BSD3++-- The file containing the license text.+License-file: LICENSE++-- The package author(s).+Author: JoeQuinn++-- An email address to which users can send suggestions, bug reports,+-- and patches.+Maintainer: headprogrammingczar@gmail.com++Stability: experimental++-- A copyright notice.+-- Copyright: ++Category: Acme++Build-type: Simple++-- Extra files to be distributed with the package, such as examples or+-- a README.+-- Extra-source-files: ++-- Constraint on the version of Cabal needed to build this package.+Cabal-version: >=1.2+++Library+ -- Modules exported by the library.+ Exposed-modules: Prelude.PHP+ + -- Packages needed in order to build this package.+ Build-depends: base >=4 && <5+ + -- Modules not exported by this package.+ -- Other-modules: + + -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.+ -- Build-tools: +