Alastair Reid alastair at reid-consulting-uk.ltd.uk
Fri May 21 18:43:03 EDT 2004

> > Purely functional languages like Haskell are excellent
> > within certain niches, but non-trivial problems exist with language
> > interoperability between lazy and strict languages.
> >
> > I believe that is uncontroversial.

Actually, I think Haskell has one of the better language interoperability 
stories going and that lazy-vs-strict is a very well solved problem.

Problems that do crop up in interfacing to foreign languages are:

1) Differences in type system.
   Any two languages are bound to have some differences 
   between their type systems and there's always going to be
   some problems dealing with that.  OO and type-classes happen
   to be superficially similar and yet radically different.

   These happen with any two languages.  Thought they are
   probably more of an issue because of...

2) Attitudes to type safety.
   C programmers overcome any type incompatibility with void*
   and type casts.  Haskell programmers look for ways to avoid
   doing so.  This can occupy many a happy evening :-)

   (I don't know if the situation has changed but the SML-NJ
   folks used to have a very simple foreign function interface
   which made type errors appallingly easy to make.  This
   seemed to be quite acceptable to them whereas Haskell's ffi
   was designed to make type errors much harder to make. Which
   approach is the right one?)

3) Attitudes to grunge.
   C programmers are used to having complicated, fragile-looking
   interfaces so it's quite common to do things like passing 
   a function an array and a count of how many things are in
   the array.  Haskell programmers look for ways to avoid such
   fragility but, of course, it takes more up-front effort
   to develop a safer interface and gives you a good solid
   push down that slippery slope of perfectionism on which 
   Haskell folk so often find themselves.

And, in the specific case of GUI programming, I think there's been a problem 
of not enough people, too many ideas on how GUI programming should be done, 
and too many GUI libs to try interfacing to.  (Obviously, if we'd worked on 
Windows exclusively, there would have been less choice so we'd have been more 

Alastair Reid

More information about the Glasgow-haskell-users mailing list