Haskell

Páginas: 39 (9731 palabras) Publicado: 31 de mayo de 2012
wxHaskell
A Portable and Concise GUI Library for Haskell
Daan Leijen
Institute of Information and Computing Sciences, Utrecht University P.O.Box 80.089, 3508 TB Utrecht, The Netherlands

daan@cs.uu.nl

Abstract
wxHaskell is a graphical user interface (GUI) library for Haskell that is built on wxWidgets: a free industrial strength GUI library for C++ that has been ported to all majorplatforms, including Windows, Gtk, and MacOS X. In contrast with many other libraries, wxWidgets retains the native look-and-feel of each particular platform. We show how distinctive features of Haskell, like parametric polymorphism, higher-order functions, and first-class computations, can be used to present a concise and elegant monadic interface for portable GUI programs.

There is no intrinsicdifficulty in implementing a GUI library that provides the above features. However, the amount of work and maintainance associated with such project should not be underestimated; many GUI libraries had a promising start, but failed to be maintained when new features or platforms arose. With wxHaskell, we try to avoid this pitfall by building on an existing cross-platform framework named wxWidgets: afree industrial strength GUI library for C++ [43]. wxWidgets provides a common interface to native widgets on all major GUI platforms, including Windows, Gtk, and Mac OS X. It has been in development since 1992 and has a very active development community. The library also has strong support from the industry and has been used for large commercial applications, for example, AOL communicator and AVGanti-virus. wxHaskell consists of two libraries, WXCore and WX. The WXCore library provides the core interface to wxWidgets functionality. It exposes about 2800 methods and more than 500 classes of wxWidgets. Using this library is just like programming wxWidgets in C++ and provides the raw functionality of wxWidgets. The extensive interface made it possible to already develop substantial GUIprograms in wxHaskell, including a Bayesian belief network editor and a generic structure editor, called Proxima [41]. The WXCore library is fully Haskell’98 compliant and uses the standard foreign function interface [11] to link with the wxWidgets library. The WX library is implemented on top of WXCore and provides many useful functional abstractions to make the raw wxWidgets interface easier to use.This is where Haskell shines, and we use type class overloading, higher-order functions, and polymorphism to capture common programming patterns. In particular, in Section 6 we show how attribute abstractions can be used to model widget settings and event handlers. Furthermore, WX contains a rich combinator library to specify layout. In section 7, we use the layout combinator library as a particularexample of a general technique for declarative abstraction over imperative interfaces. As described later in this article, the WX library does use some extensions to Haskell’98, like existential types. Most of this article is devoted to programming wxHaskell with the WX library, and we start with two examples that should give a good impression of the functionality of the library.

Categoriesand Subject Descriptors
D.1.1 [Programming Techniques]: Applicative (Functional) Programming; D.3.2 [Programming Languages]: Language Classifications—Applicative (Functional) Programming; D.2.2 [Design Tools and Techniques]: User interfaces.

General Terms
Design, Languages.

Keywords
Graphical user interface, combinator library, layout, wxWidgets, Haskell, C++.

1

Introduction

Theideal graphical user interface (GUI) library is efficient, portable across platforms, retains a native look-and-feel, and provides a lot of standard functionality. A Haskell programmer also expects good abstraction facilities and a strong type discipline. wxHaskell is a free GUI library for Haskell that aims to satisfy these criteria [25].

Permission to make digital or hard copies of all or...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Haskell
  • haskell
  • programas de haskell
  • Resumen Haskell
  • Haskell
  • Haskell
  • Haskell
  • Haskell

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS