Hello everyone.
I have an application (a calculator repl [1]) and I'm looking to convert it into an package that provides both library and executable.
I'm looking for suggestions for what might be a good API for such a library.
I'm not looking for an extended code review, just the placement of functions in modules, and which functions to export.
The current source tree looks like this.
src/ $ tree .
.
├── Calculator
│ ├── Color.hs -- Colored output
│ ├── Evaluator
│ │ ├── Base.hs -- Common evaluation functions
│ │ ├── Cmd.hs -- Evaluate special commands
│ │ ├── Expr.hs -- Expression evaluation
│ │ ├── Func.hs -- Convert specification for a function into a mathematical function
│ │ └── Statement.hs -- Evaluate either expression or command
│ ├── Help.hs -- Help message
│ ├── Parser
│ │ ├── Base.hs -- Common parsers, number, id etc.
│ │ ├── Cmd.hs
│ │ ├── Expr.hs
│ │ └── Statement.hs
│ └── Prim -- Primitives
│ ├── Bindings.hs -- Variable and Function Bindings
│ ├── Cmd.hs
│ ├── Definitions.hs -- Basic definitions, pre-defined variables and functions etc.
│ ├── Expr.hs
│ ├── Function.hs -- Tried to formalize the notion of a function of multiple arguments without currying.
│ └── Statement.hs
├── Main.hs
└── Model
└── Arithmetic.hs -- A calculator model built using Text.ParserCombinators.Parsec.Expr (for model testing)
I'm trying to have a library because I want to use a lot of the functionality provided by calculator in plot-lab [2], which is a plotting application.
I want to have a stable API, because I don't want to irresponsibly keep changing it according to my personal needs.