[Haskell-beginners] How Haskell Fits Into an Operating System / API Environment
apfelmus at quantentunnel.de
Sun Aug 11 10:58:15 CEST 2013
Philippe Sismondi wrote:
> I am interested in tracking down discussions on how Haskell fits into
> an operating system environment. That is probably not a very clear
> question, so let me explain.
> One of the great obstacles I have faced in using two of my favourite
> languages (Common Lisp and Haskell) for anything practical is that I
> am constantly frustrated by their relationship with the host OS, or
> perhaps more accurately with the APIs provided by the OS.
> For example, I tend to program mostly on OS X. I have a reasonable
> knowledge of Cocoa, and can get quite a lot done with Objective-C.
> So, if I want to use Haskell on OS X, I can run off and learn about
> Haskell's FFI, or some hand-rolled widget package, etc. But here is
> the problem: Cocoa et al provide an entire ecosystem that includes
> data structures, error handling, and so on. So, when trying to use
> Haskell with a GUI, or perhaps to do some audio processing, or other
> things that are provided by the OS X APIs, I feel that I am layering
> two quite incompatible worlds together: Haskell and its host
> I ran into the same dilemma with Common Lisp. Clozure Common Lisp
> provides an excellent Cocoa binding. But using it feels (to me) like
> communications between alien races. The OS APIs want to do things the
> Objective-C way, and that is (clearly) not the Haskell or Lisp way.
> One soon notices that books on Haskell pay virtually no attention to
> this issue. At least, the ones I have don't.
> Maybe what I am really experiencing is that OS X just "wants" to be
> programmed in its native language. I had something of a better
> feeling about using F# on Windows, because that architecture does
> leverage the native stuff much better.
> The upshot is that I remain skeptical that Haskell is actually a
> practical language for many kinds of development.
> Can anyone point me to discussions on this? I may be having a
> dimwitted interval here, but I don't know what to search to find
I'm not entirely sure I understand your question.
The fact that, say, Objective-C uses quite a different way of speech
than Haskell is not surprising, these are two different languages after
all. You would have similar problems in an imaginary world where Haskell
were the norm and Objective-C the exception. If you want to use both at
once, you have to invest work in building a bridge. For instance, you
can present Haskell in a more Objective-C-y fashion, or the other way
round, or some middle ground. That's just how it is and it applies to
Concerning Objective-C specifically, there was a very nice project
implementing a slick FFI for Cocoa in Haskell. Unfortunately, it has
been dead for years now.
Somewhat related, there is actually an (experimental) OS written in
In case you're not that interested in integrating with the entire OS,
but are just looking for a GUI library in Haskell anyway, I would like
to toot my own horn and point to threepenny-gui, which uses the web
browser as a display.
More information about the Beginners