mathexpr 0.3.0.0 → 0.3.1.0
raw patch · 2 files changed
+14/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- mathexpr.cabal +1/−1
- src/Numeric/MathExpr.hs +13/−2
mathexpr.cabal view
@@ -1,5 +1,5 @@ name: mathexpr-version: 0.3.0.0+version: 0.3.1.0 synopsis: Parse and evaluate math expressions with variables and functions description: A simple tool to evaluate math expressions as strings with support for custom functions and operators homepage: https://github.com/mdibaiee/mathexpr
src/Numeric/MathExpr.hs view
@@ -9,15 +9,26 @@ import Data.Maybe (isJust, fromJust) import Data.List (find) + -- | Operators are in the form (character, precedence, function)+ -- Example: ('+', 0, (+)), ('', 1, ())+ -- (higher the precedence, the sooner the operator operates)+ --+ -- Functions are in the form (name, function)+ -- Example: ("ln", log) data Settings = Settings { operators :: [(Char, Int, Double -> Double -> Double)] , functions :: [(String, Double -> Double)] }-+ -- | Operators are in the form (character, precedence, function)+ -- Example: ('+', 0, (+)), ('', 1, ())+ -- (higher the precedence, the sooner the operator operates) defaultOperators = [ ('+', 0, (+)), ('-', 0, (-)), ('*', 1, (*)), ('/', 1, (/)), ('^', 2, (**)) ]++ -- | Functions are in the form (name, function)+ -- Example: ("ln", log) defaultFunctions = [("ln", log), ("sin", sin), ("cos", cos)] instance Default Settings where@@ -62,7 +73,7 @@ where replace c | isVariable c = pad $ show $ fromJust $ c `lookup` vars- | otherwise = c+ | otherwise = pad c isVariable c = isJust $ c `lookup` vars