file io - Data storing in haskell - excel like rows and cols -



file io - Data storing in haskell - excel like rows and cols -

i have next quest:

i have write programme in haskell allow me create excel sheet. there columns , rows, , each cell can hold number or string or function (sum, mean, multiply etc). each of functions take parameters list of cells summed etc.

now trying figure out how store info program... thinking this:

data cellpos = cellpos int int -- row , col of cell info datatype = text | string | sumfunction | ...... deriving (enum) info cell = cell cellpos datatype -- here problem , how set here info type depends on datatype???

i wanted have big list of cell , search in specified column/row etc

but there must improve solution – maybe 2 dimensional array auto adjust size or something?

i have save/load sheet /from file...

let's reply 1 question @ time:

data cell = cell cellpos datatype

"but here problem , how set here info type depends on datatype???"

put info datatype:

data datatype = text string | number double | function cellpos (datatype -> datatype)

"i wanted have big list of cell , search in specified column/row etc. there must improve solution - maybe 2 dimmensional array auto adjust size or something?"

i suggest map cellpos datatype.

"i have save/load sheet /from file..."

the simplest thing derive show , read , utilize resulting functions readfile , writefile. caveat here (with respect datatype defined before in answer) functions cannot serialized. around this, create more explicit type functions in cells -- perhaps abstract syntax tree simple look language.

haskell file-io types

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -