[Haskell-cafe] representing spreadsheets

Eric Rasmussen ericrasmussen at gmail.com
Fri May 27 20:48:10 CEST 2011


Hi everyone,

I'm hoping someone can point me in the right direction for a project I'm
working on. Essentially I would like to represent a grid of data (much like
a spreadsheet) in pure code. In this sense, one would need functions to
operate on the concepts of "rows" and "columns". A simple "cell" might be
represented like this:

data Cell =
    CellStr   Text
  | CellInt   Integer
  | CellDbl   Double
  | CellEmpty

The spreadsheet analogy isn't too literal as I'll be using this for data
with a more regular structure. For instance, one grid might have 3 columns
where every item in column one is a CellStr, every item in column two a
CellStr, and every item in column 3 a CellDbl, but within a given grid there
won't be surprise rows with extra columns or columns that contain some cell
strings, some cell ints, etc.

Representing cells in a matrix makes the most sense to me, in order to
facilitate access by columns or rows or both, and I'd like to know if
there's a particular matrix library that would work well with this idea.
However, I'm certainly open to any other data structures that may be better
suited to the task.

Thanks!
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110527/be2d1a8f/attachment.htm>


More information about the Haskell-Cafe mailing list