From 562a8b1b6b46679d06fef8a7b74a4ad664df8213 Mon Sep 17 00:00:00 2001 From: JonathanILevi <35940342+JonathanILevi@users.noreply.github.com> Date: Fri, 21 Feb 2020 14:04:36 -0600 Subject: [PATCH] Documentation for how operators and functions are. --- src/Numeric/MathExpr.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Numeric/MathExpr.hs b/src/Numeric/MathExpr.hs index 5e2c2ac..7db9765 100644 --- a/src/Numeric/MathExpr.hs +++ b/src/Numeric/MathExpr.hs @@ -9,15 +9,26 @@ module Numeric.MathExpr 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 -- 2.34.1