Records in Haskell

Thomas Schilling nominolo at
Mon Sep 19 04:27:39 CEST 2011

On 16 September 2011 16:31, Ryan Newton <rrnewton at> wrote:

> I started playing around with Leksah and scion/emacs (searching for "what's the type of this expr" support) and was a little disappointed that this functionality doesn't seem to exist yet.  Or am I wrong and it exists somewhere?

The problem is when you have incomplete programs.  Scion does allow
you to ask for the type of a subexpression(1), but it can only do so
if the program type checks.  In many cases you can get an incomplete
program to type check by adding "undefine"s, but that doesn't work in
the general case.  You may get issues with ambiguous types with no
defaulting rules.  Ambiguity checking is a separate stage in the type
checker (at least it was before 7.0.*) so it's possible in principle
to add an option to the GHC API to allow such programs to pass the
type checker.

I'm not a fan of TDNR because it would make programs even more
sensitive to imports than they are now (the current issue is due to
type classes and the lack of control about importing them).  I also
fear that it would interact badly with things an IDE has to do.  I may
be wrong, though, as some people seem to claim the opposite.  I
haven't had the chance to think about that fully.

Personally, I like the type class + special label type solution best, so far.

(1) It's disabled in the current master branch, but it's available in
the fork used by EclipseFP and it does indeed work there.

Push the envelope. Watch it bend.

More information about the Glasgow-haskell-users mailing list