packages feed

calculator-0.2.0.0: src/Calculator/Help.hs

module Calculator.Help (help) where

--------------------------------------------------------------------------------

import           Calculator.Prim.Definitions (binaryOps, defFuns, defVars)

--------------------------------------------------------------------------------

import           Data.List                   (intercalate, intersperse)

--------------------------------------------------------------------------------

help :: [String]
help = [ "Commands:"
       , "   :var x=pi          -- Binds x to pi"
       , "   :func f(x)=x+1     -- Binds f(x) to \"x + 1\""
       , "   :func f(x,y)=x+y   -- Binds f(x) to \"x + 1\""
       , "   :reset             -- Reset variable and function bindings"
       , "   :show              -- Display all variable bindings"
       , "   :? or :help        -- Display this help message"
       , ""
       , "Supported Operations: " ++ intersperse ' ' (map fst binaryOps)
       , ""
       , "Pre-defined variables: " ++ intercalate ", " (map fst defVars)
       , ""
       , "Provided Functions: "
       , "   " ++ intercalate ", " (map fst defFuns)
       ]

--------------------------------------------------------------------------------