FPSheet: A Spreadsheet program with Haskell as the scripting language
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.obj Added .obj/ folder, and excluding all content within it Jul 13, 2018
imgs amended example image Jul 15, 2018
.gitignore Added .obj/ folder, and excluding all content within it Jul 13, 2018
.valgrindRules List library v1.0 Dec 2, 2015
LICENSE Initial commit Jul 12, 2018
README.md Stating objective to rewrite this in Haskell in the TODO list Jul 16, 2018
crash.c Unified source code style Jul 17, 2018
crash.h List library v1.0 Dec 2, 2015
curses_ctrl.c Unified source code style Jul 17, 2018
curses_ctrl.h memory check - done Jul 14, 2018
debug.c Unified source code style Jul 17, 2018
debug.h sheets are saved and parsed now! Oct 26, 2016
ghci.c Unified source code style Jul 17, 2018
ghci.h Memory check Jul 14, 2018
listlib.c Unified source code style Jul 17, 2018
listlib.h Added destructor function for freeing map and list entries Jul 13, 2018
listlib_test.c Unified source code style Jul 17, 2018
listlib_test.h source style format Oct 2, 2016
main.c Unified source code style Jul 17, 2018
maindefs.h Added destructor function for freeing map and list entries Jul 13, 2018
makefile Merge branch 'master' of ssh://surfer123.mooo.com:8585/~/FPSheet Nov 17, 2016
mathlib.c Made a start on column letters Dec 29, 2015
mathlib.h Made a start on column letters Dec 29, 2015
memlib.c Unified source code style Jul 17, 2018
memlib.h source style format Oct 2, 2016
mpc-LICENSE.md Added mpc's license Jul 15, 2018
mpc.c sheets are saved and parsed now! Oct 26, 2016
mpc.h sheets are saved and parsed now! Oct 26, 2016
parsers.c Unified source code style Jul 17, 2018
parsers.h goto command Oct 30, 2016
safety.h source style format Oct 2, 2016
sheet.c Unified source code style Jul 17, 2018
sheet.h editStr memory bug fix Jul 15, 2018
strlib.c Unified source code style Jul 17, 2018
strlib.h edit cursor is clearly visualized Jul 12, 2018
valgrind.sh List library v1.0 Dec 2, 2015

README.md

FPSheet

A Spreadsheet program with Haskell as the scripting language

Alt text

FPSheet is a spreadsheet program that runs inside a terminal. The scripting language for computing cell's values from formulas runs Haskell internally. This arguably provides a more uniform experience than what is provided by the scripting languages of standard spreadsheet programs. Note: this README currently assumes some familiarity from the reader with ghc's ghci tool.

Currently the tool starts a ghci session in the background. When a cell is defined or edited, a unique variable is defined or redefined inside this ghci session. For example, if cell ABD124 is edited to: "45", FPSheet sends the following to the ghci session: "let aBD124 = 45". Similarly, if cell A4 is edited to: "A5 * 10", FPSheet sends the following to the ghci session: "let a4 = a5 * 10".

Interestingly, since Haskell is lazily evaluated, and since Haskell regards function values as first class citizens, any custom function can be defined inside a cell. Any other cell can then apply this function simply by referring to the cell.

Installation

dependencies: libncurses, libm, ghc

Additional dependency mention: libmpc (parser combinators in c), it is already present within the repo however with some minor type related edits.

run: make

Usage

Run the fpsheet executable. (no interaction with arguments yet)

The tool currently always loads a spreadsheet instance from file ./.sheet (if this file is present, and is parseable). Similarly, currently upon exit the tool always saves the spreadsheet to ./.sheet.

The tool starts in navigation mode. This mode is comparable to vim's command mode. The arrow keys move the cursor over cells. The cursor can be moved straight to a certain cell by typing ":" followed by the cell's coordinate. In a similar fasion it is possible to move the cursor to a certain row (by typing ":" followed by the row number) and to move the cursor to a certain column (by typing ":" followed by the column name). The tool can be closed by typing ":q" in this mode (note that currently this is actually ":wq" as currently the tool always saves the state upon shutdown).

Cells with definitions starting with a ":" character are treated as ghci commands and are sent as is to ghci (whereas any other cell's definition is prepended with "let <cell coordinate> = ". This gives access to ghci's internals such as inferred types of cells (e.g. try out defining a cell as ":t <some other cell>").

Pressing "v" in navigation mode changes the mode to visual mode. Underlining of cells can be toggled in this mode by pressing "u". A double press of "d" in visual mode deletes the selected cell's content. Pressing ESCAPE exits visual mode.

TODOs

  • Rewrite in Haskell
  • Copy pasting cells (properly handling loose and stuck cell references)
  • Reading and writing of user defined save files (i.e. any filename, not just ".sheet").
  • Exporting to and importing from excell savefiles
  • Undo & redo
  • Many many more vital features (aka: TODO: write these out)

WHY C?!?!

No idea