symtegration-0.4.0: Library for symbolic integration of mathematical expressions.
CopyrightCopyright 2024 Yoo Chung
LicenseApache-2.0
Maintainerdev@chungyc.org
Safe HaskellNone
LanguageGHC2021

Symtegration.Symbolic.Haskell

Description

Support for converting symbolic representations of mathematical expressions into equivalent Haskell code.

Synopsis

Documentation

toHaskell :: Expression -> Text Source #

Converts an Expression into an equivalent Haskell expression.

>>> toHaskell $ BinaryApply Add (Number 1) (Number 3)
"1 + 3"
>>> toHaskell $ 1 + 3
"1 + 3"

Symbols are included without quotation.

>>> toHaskell $ ("x" + "y") * 4
"(x + y) * 4"

Support functions

getUnaryFunctionText :: UnaryFunction -> Text Source #

Returns the corresponding Haskell function name.

getBinaryFunctionText :: BinaryFunction -> Text Source #

Returns the corresponding Haskell function name.

For binary operators, it will be the infix form. In other words, "+" will be returned for Add, not "(+)".