packages feed

calculator 0.3.1.1 → 0.4.0.0

raw patch · 8 files changed

+14/−61 lines, 8 filesdep ~QuickCheckdep ~containersdep ~gtk

Dependency ranges changed: QuickCheck, containers, gtk, haskeline, parsec, plot-gtk-ui, transformers

Files

README.md view
@@ -21,13 +21,13 @@ To install *without* plotting support.  ```bash-$ cabal install calculator+$ stack install calculator ```  To install *with* plotting support.  ```bash-$ cabal install calculator --flags="plot-gtk-ui"+$ stack install calculator --flags="plot-gtk-ui" ```  ## TODO
calculator.cabal view
@@ -1,5 +1,5 @@ name:                calculator-version:             0.3.1.1+version:             0.4.0.0 synopsis:            A calculator repl, with variables, functions & Mathematica like dynamic plots. description:         A calculator repl that processes mathematical expressions.                      Does basic arithmetic, and provides pre-defined basic mathematical functions.@@ -11,17 +11,13 @@ license:             GPL-2 license-file:        LICENSE author:              Sumit Sahrawat-maintainer:          sumit.sahrawat.apm13@itbhu.ac.in+maintainer:          sumit.sahrawat.apm13@iitbhu.ac.in -- copyright:            category:            Math build-type:          Simple extra-source-files:  README.md cabal-version:       >=1.10 -flag plot-gtk-ui-  default:             False-  description:         Use plot-gtk-ui to provide plotting commands- executable calculator   main-is:             Main.hs   other-modules:       Calculator.Evaluator.Base@@ -44,17 +40,15 @@                      , Calculator.Color   -- other-extensions:       build-depends:       base >=4.7 && <4.9-                     , containers >= 0.5.5.1 && <0.6.0.0-                     , haskeline >=0.7.1.0 && <0.7.3.0-                     , parsec >=3.1.7 && <3.2+                     , containers+                     , haskeline+                     , parsec+                     , plot-gtk-ui+                     , gtk+                     , transformers   hs-source-dirs:      src/   ghc-options:         -Wall   default-language:    Haskell2010-  if flag(plot-gtk-ui)-     cpp-options:      -DPLOT-     build-depends:    plot-gtk-ui >=0.0.2.0-                     , gtk >=0.13.0 && <0.14.0-                     , transformers >= 0.4.2.0  test-suite model-test-arithmetic   type:                exitcode-stdio-1.0@@ -79,10 +73,10 @@                      , Calculator.Color                      , Model.Arithmetic   hs-source-dirs:      tests/ src/-  build-depends:       QuickCheck >= 2.7.6 && <2.7.7-                     , base >=4.7 && <4.9-                     , containers >= 0.5.5.1 && <0.6.0.0-                     , parsec >=3.1.7 && <3.2+  build-depends:       base >=4.7 && <4.9+                     , QuickCheck+                     , containers+                     , parsec   ghc-options:         -Wall   default-language:    Haskell2010 
src/Calculator/Evaluator/Cmd.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP              #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies     #-} @@ -19,8 +18,6 @@  -------------------------------------------------------------------------------- -#ifdef PLOT- import           Calculator.Prim.Bindings       (getFun) import           Calculator.Prim.Function       (Function, apply, arity) @@ -30,8 +27,6 @@ import           Data.List                      (foldl1') import           Data.Maybe -#endif- --------------------------------------------------------------------------------  evalCmd :: Bindings -> Cmd -> Result@@ -50,8 +45,6 @@  -------------------------------------------------------------------------------- -#ifdef PLOT- evalCmd b (Plot s rs) =     case getFun s b of       Nothing -> Error $ "Unknown function: " ++ s@@ -81,7 +74,5 @@       _ <- initGUI       fromJust $ plotWithArity (arity f) ((\(Right x) -> x) . apply f) ranges       mainGUI--#endif  --------------------------------------------------------------------------------
src/Calculator/Help.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- module Calculator.Help (help) where  --------------------------------------------------------------------------------@@ -20,9 +18,7 @@        , "   :func f(x)=x+1     -- Binds f(x) to \"x + 1\""        , "   :func f(x,y)=x+y   -- Binds f(x, y) to \"x + y\""        , "   :reset             -- Reset variable and function bindings"-#ifdef PLOT        , "   :plot              -- For plotting (detailed below)"-#endif        , "   :show              -- Display all variable bindings"        , "   :? or :help        -- Display this help message"        , bold "Unary Operators: " ++ intersperse ' ' (map fst unaryOps)@@ -35,15 +31,11 @@        , " but not everywhere, e.g in commands"        , "   : func ...                    -- doesn't work"        , bold "Plotting: "-#ifdef PLOT        , "   :plot f (0, 1)"        , "   -- Plot a single argument function 'f' in range (0, 1)"        , "   :plot f (0, 1) (1, 2)"        , "   -- Plot a two argument function 'f' in range (0, 1)"        , "   -- where the second argument can be varied between 1 and 2"-#else-       , "   Plotting functionality not enabled during install"-#endif        ]  --------------------------------------------------------------------------------
src/Calculator/Parser/Cmd.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- module Calculator.Parser.Cmd     ( parseCmd     , parseAssignCmd@@ -14,12 +12,8 @@ import           Calculator.Parser.Expr        (parseExpr) import           Calculator.Prim.Cmd           (Cmd (..)) -#ifdef PLOT- import           Calculator.Prim.Expr          (Expr) -#endif- --------------------------------------------------------------------------------  import           Control.Applicative           ((<*))@@ -40,9 +34,7 @@          <|> parseReset          <|> parseAssignCmd          <|> parseFuncCmd-#ifdef PLOT          <|> parsePlotCmd-#endif  -------------------------------------------------------------------------------- -- help -> "?" | "help"@@ -65,8 +57,6 @@ -------------------------------------------------------------------------------- -- plot -> "plot" id -#ifdef PLOT- parsePlotCmd :: Parser Cmd parsePlotCmd = do   _ <- string "plot"@@ -88,8 +78,6 @@   _ <- spaces   _ <- char ')'   return (l, u)--#endif  -------------------------------------------------------------------------------- -- assignCmd -> "var" id "=" expr
src/Calculator/Prim/Cmd.hs view
@@ -14,8 +14,6 @@          | Help          | Reset          | Display-#ifdef PLOT          | Plot String [(Expr, Expr)]-#endif  --------------------------------------------------------------------------------
src/Calculator/Prim/Result.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- module Calculator.Prim.Result     ( Result (..)     ) where@@ -14,8 +12,6 @@             | Text String             | Error String             | Value Double-#ifdef PLOT             | Action (IO ())-#endif  --------------------------------------------------------------------------------
src/Main.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- module Main where  --------------------------------------------------------------------------------@@ -21,9 +19,7 @@  -------------------------------------------------------------------------------- -#ifdef PLOT import           Control.Monad.IO.Class      (liftIO)-#endif  -------------------------------------------------------------------------------- @@ -48,9 +44,7 @@                   Text t  -> padOut b " ~~ " t                   Error e -> padOut b " !! " e                   NewBindings b' -> repl b'-#ifdef PLOT                   Action io      -> liftIO io >> repl b-#endif  --------------------------------------------------------------------------------