<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Using monadic bind in ghci is not at all deprecated -- it's one of the main ways people interact with ghci. MVar, iorefs, etc also work within ghci. Almost anything you can do in haskell you can do in ghci.</div><div><br></div><div>Tom</div><div><br></div><div><br>El May 12, 2015, a las 20:02, Jeffrey Brown <<a href="mailto:jeffbrown.the@gmail.com">jeffbrown.the@gmail.com</a>> escribió:<br><br></div><blockquote type="cite"><div><div dir="ltr">Half solved! <br><br>David Gladstein pointed out that GHCI's "it" variable can at least sometimes solve the problem:<br><br>  Prelude System.IO> let x = 3<br>  Prelude System.IO> x<br>  3<br>  Prelude System.IO> let x = it + 1<br>  Prelude System.IO> x<br>  4<br><br>Then I discovered that in GHCI one can bind monadically:<br><br>  Prelude> x <- return 3<br>  Prelude> x <- return $ x + 1<br>  Prelude> x<br>  4<br>  <br>  Prelude> x <- getLine<br>  This line was user input, not computer output.<br>  Prelude> x<br>  "This line was user input, not computer output."<br>  Prelude><br><br>I don't remember seeing anyone demonstrate it; perhaps it is deprecated.<br><br>I would still very much like to know whether and if so how it is possible to let the user evaluate arbitrary haskell when running compiled code.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 12, 2015 at 1:19 PM, Jeffrey Brown <span dir="ltr"><<a href="mailto:jeffbrown.the@gmail.com" target="_blank">jeffbrown.the@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.)<br><br>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:<br>  let g0 = emptyDocument<br>  let s1 = newStatement ...<br>  let g1 = addStatement s1 g0<br>  let s2 = newStatement ...<br>  let g2 = addStatement s2 g1<br>  ...<br>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.<br><br>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 arbitrary Haskell?<br></div>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br></div></blockquote></body></html>