[Haskell-cafe] evaluate arbitrary code + mutable variables
jeffbrown.the at gmail.com
Tue May 12 20:19:09 UTC 2015
I wrote a graph-like data type, with some functions for adding statements
and relationships between statements. (It's different from a graph in that
there's no edge/vertex distinction; there are only statements, but a
statement might refer to other statements.)
Currently I'm using them in GHCI. Because it does not allow one to change a
variable, I keep having to do things like this:
let g0 = emptyDocument
let s1 = newStatement ...
let g1 = addStatement s1 g0
let s2 = newStatement ...
let g2 = addStatement s2 g1
If I wrote a standalone application, I could use mutable variables, so I
would not have to define a new object every time I want to modify an
existing one. However I like being able to type in arbitrary code into GHCI.
Can one have both of those at once? That is, could I either (1) use MVars
from within GHCI, or (2) write a standalone app that lets the user evaluate
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe