[Haskell-cafe] type dependency
haskell at list.mightyreason.com
Mon Jul 10 06:59:11 EDT 2006
Henning Thielemann wrote:
> On Mon, 10 Jul 2006, Donn Cave wrote:
>> After reasonable success with an FFI exercise, I have run into a
>> typing issue that has me stuck.
>> The foreign software is a C plotting library that my colleagues
>> use, really simple and mostly quite amenable to Haskell-ization.
>> The one fly in the ointment is the graph coordinate type, which
>> is a union of double & int64. The graph object has switches for
>> the actual type of x and y coordinates, set at creation time.
> Will you make that plotter wrapper public?
> I rolled my own GNUPlot wrapper some time ago:
About gnuplot (which I use a lot).
When I saw the GSL Haskell wrapper was using calls to gnuplot to print, I went
looking for how to make gnuplot behave better as a middle-end instead of back-end.
I made a new output terminal device for gnuplot that wrote a description of the
plot drawing commands. Thus I opened a pipe in haskell and invoked gnuplot to
write to it. The new output commands were interpreted by the usual "read"
haskell command into a list of data which I could then use the Cocoa bindings
of gtk haskell to render in a window.
All the graphics and the basic text renders properly, but I ran into problems
with extended text. The main one being that gnuplot does not have a proper
definition of the lexing/parsing of extended text. The actual c-code that does
the operation is not cleanly designed and the behavior conflicts with the help
text. But this was just a hobby exercise, so I have not quite finished it.
What I do have is something could accurately take the "demo" gnuplot into a
stream of data/commands that could be rendered (via a handy monad) into a
cairo/gtk window drawable that looks like the output of other terminals.
More information about the Haskell-Cafe