| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Hascal
Description
Hascal is a simple, minimalistic, tiny calculator library and program.
- Hascal only understands single-character operators.
- Hascal only understands infix operators.
- Hascal does not understand parantheses.
_is hard-coded as single prefix for negating numbers.- By default, Hascal understands the operators
+,-,*,/,^, and?(logarithm). - By default, Hascal understands the constants
pi,e, andi. - Using Hascal as a library, you can add new operators and new constants using a configuration data type.
The hascal executable program is easy to use. In a shell, type:
>>>hascal 1+2-3*4/5^6?7-1.7263530417152033
Given a configuration, the hascal function similarly evaluates an
expression of type String. In a Haskell interpreter like GHCI, type:
>>>hascal def "1+2-3*4/5^6?7"Right (0.2736469582847967 :+ 0.0)
>>>hascal def "1++2"Left "Error at \"\"."
Documentation
A class for types with a default value.
Instances