Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Haskell Gets iOS Support, Several language and Performance Improvements

Haskell Gets iOS Support, Several language and Performance Improvements

This item in japanese

Lire ce contenu en français

GHC 7.8.1 was recently released, bringing several improvements to the Haskell ecosystem. Haskell can now be compiled for iOS, and sports new features such as Closed Type Families, Roles, Overloaded Lists, Pattern Synonyms as well as several performance improvements.

Haskell can be compiled for iOS via clang. This supports development using XCode 5. Due to the lack of cross-platform GUI libraries in Haskell, for now you need to develop the GUI separately in objectiveC and invoke Haskell functions from your GUI code. While this support was announced around 7 months back, this is the first major GHC release to include this support.

Note that Template Haskell is not available on iOS yet.

The cross-platform compilation story has also improved in general. For example, dynamic linking is supported better. GHCi (interactive) now uses the system dynamic linker by default, instead of the built-in static linker. With GHC, you can use a new compilation flag "--dynamic-too", to emit both static and dynamic object files at the same time. (by default GHC still uses static linking).

Some other features introduced in this release -

  • Closed Type Families - type families are used for overloading of data types. A closed family type has all of its equations defined in one place and cannot be extended - this is useful to avoid consequences not intended by the original developer.
  • Roles - to eliminate type unsafe definitions when using GeneralizedNewTypeDeriving
  • Overloaded Lists - Sugar to use list notations for construction of structures such as Set, Map, IntMap, Vector, Text and Array
  • Pattern Synonyms
  • Typeable is now poly-kinded, making Typeable1, Typeable2, etc. obsolete and deprecated.
  • Brand new I/O manager that scales linearly upto 32 cores
  • Several improvements to Template Haskell, such as support for Roles, annotation pragmas, "Typed Template Haskell expressions"
  • Parallel mode for make
  • Improved solver for type naturals (performance improvement)

A potentially breaking change coming in the next release (7.10) is that Applicative will be a super-class of Monad. To help ease the transition, the current version of GHC will emit a warning if - a type is an instance of Monad but not Applicative, MonadPlus but not Alternative, and when a local function named join, <*> or pure is defined.

There are also several other changes - you can refer the release notes for the full list.

Note that the Haskell Platform, which bundles GHC and tools to work with Haskell, has not yet been updated to use the latest version of GHC. 

Rate this Article