Hi,<br><br>I am attempting to mimic matlab/octave using ghci, including a facility for updateable graphs of data.<br><br>1) It would be nice to be able to load a script of commands from the prompt<br><br>\begin{file}<br><br>
script Sine where<br><br>import "hmatrix" Numeric.Vector<br>import "plot" Graphics.Rendering.Plot<br><br>let ts = linspace 1000 (0,1 :: Double)<br>let ss = sin (15*2*pi*ts) -- 15 Hz sine wave<br><br>figure1 <- display $ plot (ts,[line ss blue])<br>
<br>\end{file}<br><br>The idea is (apart from the import commands) is each line is equivalent to an input line in ghci. Note that the last line binds a variable from an action in the top level IO monad, something not possible in a module.<br>
<br>2) It would be nice to have multiline inputs if the parser can tell that the input is incomplete rather than malformed. One case is an empty 'do' construct:<br><br>\begin{interaction}<br><br>Prelude> :load Sine<br>
Sine> :show bindings<br>ts :: Data.Vector.Storable Double<br>ss :: Data.Vector.Storable Double<br>figure :: Graphics.Rendering.Plot.Figure.Figure ()<br>Sine> withFigureMVar figure1 $ do<br> Figure a > withTitle $ do<br>
Text a > setText "15 Hz sine wave"<br> Text a > setFontSize 16<br> Text a > <br>
Figure a ><br>Sine> <br><br>\end{interaction}<br><br>(an empty line ends the 'do' construct and returns to next higher level).<br><br>Is this a feasible addition to GHCi? This way the full power of GHCi is accessible to an interactive mathematics session rather than developing a custom interface on top of the GHC API.<br>
<br>Vivian<br>