| Copyright | Copyright 2024 Yoo Chung |
|---|---|
| License | Apache-2.0 |
| Maintainer | dev@chungyc.org |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Symtegration.Symbolic.Haskell
Contents
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 "(+)".