digraphs-with-text icon indicating copy to clipboard operation
digraphs-with-text copied to clipboard

Saving configuration data

Open JeffreyBenjaminBrown opened this issue 6 years ago • 0 comments

Since RSLT is an instance of Read and Show, it can already be saved as plain text:

>>> g <- ui empty -- after executing this, I added the expression "a # b" and then exited the ui
>>> s = show g -- s is g represented as a String
>>> s
"mkGraph [(0,Word \"a\"),(1,Word \"b\"),(2,Tplt [\"\",\"\",\"\"]),(3,Rel)] [(3,0,RelEdge (Mbr 1)),(3,1,RelEdge (Mbr 2)),(3,2,RelEdge TpltRole)]"
>>> writeFile "data.rslt" s
>>> s' <- readFile "data.rslt"
>>> g' = read h :: RSLT
>>> g'
mkGraph [(0,Word "a"),(1,Word "b"),(2,Tplt ["","",""]),(3,Rel)] [(3,0,RelEdge (Mbr 1)),(3,1,RelEdge (Mbr 2)),(3,2,RelEdge TpltRole)]

However, the user cannot yet save configuration details like "decorate tasks by prepending the symbol TODO", "Order expressions by priority", or "Hide anything marked 'boring'."

The configuration data will need to refer to the graph. It would be most naturally encoded as part of the graph. That will require expanding the data model (the number of Expr constructors).

A less elegant but easier alternative would be to store the configuration data as QNodes that match on text. This has the drawback, though, that if the text of the graph changes, the QNodes can become invalid.

JeffreyBenjaminBrown avatar Oct 03 '17 01:10 JeffreyBenjaminBrown