Updated Haskell Compiler and Libraries in Version 1.1
The forthcoming Version 1.1 of Haskell for Mac includes a major update of GHC, the embedded Haskell compiler, and of the included set of library packages. (This is only one of several improvements in Version 1.1. We will talk about the rest in subsequent blog posts.)
Partial type signatures
The most interesting user-facing addition to the compiler is support for partial type signatures. In Haskell, type signatures are almost always optional. They can be explicitly provided as a form of compiler-checked documentation, but they can also simply be inferred by the compiler. Sometimes, though, we would like a third option: we only want to explicitly provide part of a type signature. This may be because the signature is long, but most of it is obvious and we want to highlight the non-obvious portion. Or maybe, while prototyping, we don't want to fully commit yet. Or maybe, at a place where the compiler needs us to provide a concrete type, and that type is complicated, we only want to provide the needed portion.
The basic idea is that we can omit part of a type signature by writing an underscore character (
_) instead of the type, such as in
f :: [Int] -> _. Here
f is a function that we require to expect a list of integers as its argument, but we do not constrain the result type. The compiler will infer that part for us.
For a detailed explanation of partial type signatures, please have a look at the documentation in the user's guide of the Glasgow Haskell Compiler. You can ignore the compiler options needed to enable partial type signatures, though. In Haskell for Mac, this useful feature is active by default.
Standard library changes
The updated libraries come with a few changes to standard functions and type classes (from the
Prelude) that are mostly, but not fully backwards compatible. Breaking changes to standard libraries are rare. Hence, they have been very carefully consider by the Haskell developer community and they usually only affect somewhat more advanced code.
The main changes are that the type class
Applicative is now a superclass of
Monad and that a whole range of polymorphic list processing functions are now overloaded to also work on other data structures. For example, reductions, such as
foldl, can now be used on trees and other
The technical details including instructions for code migration are available in the GHC 7.10.x Migration Guide.
Updated package sets
The many library packages embedded in Haskell for Mac have been updated to include many improvements and bug fixes. Notable is, for instance, the powerful vector graphics library Diagrams 1.3 — have a look at the gallery.