Safe Haskell | Safe-Infered |
---|
Hascal
is both a simple but extendable calculator library for Haskell
and a command-line program using it.
Also, its source code is a nice example for a minimalistic Haskell project.
Functions
Operators
operators :: [(Char, CReal -> CReal -> CReal)]Source
operators
is the default list of operators.
An operator consists of one character and a function with of type
CReal -> CReal -> CReal
.
operators
includes:
- addition, represented by
'+'
- subtraction, represented by
'-'
- multiplication, represented by
'c'
- division, represented by
'/'
- exponentiation, represented by
'^'
- logarithming (with flipped arguments, see below), represented by
'?'
such that these laws are held:
(a - b == c) == (a == b + c) (a / b == c) == (a == b * c) (a ? b == c) == (a == b ^ c)