-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parse and evaluate math expressions with variables and functions -- -- A simple tool to evaluate math expressions as strings with support for -- custom functions and operators @package mathexpr @version 0.3.1.0 module Numeric.MathExpr -- | Evaluate an expression Example: `evaluate def "x + y ^ 2" [("x", 1), -- ("y", 2)] evaluate :: Settings -> String -> [(String, Double)] -> Double -- | 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 :: [(Char, Int, Double -> Double -> Double)] -> [(String, Double -> Double)] -> Settings [operators] :: Settings -> [(Char, Int, Double -> Double -> Double)] [functions] :: Settings -> [(String, Double -> Double)] -- | Functions are in the form (name, function) Example: ("ln", log) defaultFunctions :: [([Char], Double -> Double)] -- | Operators are in the form (character, precedence, function) Example: -- (+, 0, (+)), ('', 1, ()) (higher the precedence, the sooner the -- operator operates) defaultOperators :: [(Char, Int, Double -> Double -> Double)] instance Data.Default.Class.Default Numeric.MathExpr.Settings