[Haskell-cafe] Code review. API Guidance.

Sumit Sahrawat, Maths & Computing, IIT (BHU) sumit.sahrawat.apm13 at iitbhu.ac.in
Sun Feb 15 01:54:28 UTC 2015


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.

[1] : https://github.com/sumitsahrawat/calculator
[2] : https://github.com/sumitsahrawat/plot-lab

-- 
Regards

Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150215/72465b29/attachment.html>


More information about the Haskell-Cafe mailing list