Food for thought: Numeric.Special
Keith Wansbrough
Keith.Wansbrough@cl.cam.ac.uk
Fri, 06 Jun 2003 11:38:29 +0100
> Keith.Wansbrough writes:
> > Automate!
> >
> > You must avoid actually writing the import declarations for each
> > function by hand.
>
> If the functions are all of the complexity of sin, cos, etc., it is hard to
> improve significantly on:
>
> foreign import ccall sin :: Double -> Double
>
> There's just not much information you can leave out of this.
> (Perhaps you could save the first three tokens but they're not that hard to
> cut and paste).
I was imagining a tool (or a hand-crafted Perl script if necessary)
that turned
double gsl_sf_sin(double x);
into
foreign import ccall "gsl_sf_sin" sin :: Double -> Double
That wouldn't be too hard, and if there really are zillions of
functions, it would save a lot of work for the straightforward cases.
--KW 8-)
--
Keith Wansbrough <kw217@cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.