Holes in GHC

Thijs Alkemade thijsalkemade at gmail.com
Mon Jul 23 16:47:12 CEST 2012

Hi Simon and others,

Yes, an update on our holes in GHC project was very due.

What I've been working on:

- The command line flag -XHoles and as a language pragma {-# LANGUAGE Holes #-} now work
- Holes print a warning message with:
	- The origin of their type variables
	- Their local environment
- Most of the code has been cleaned up to prepare it for submission as a patch.

As an example of the message, consider the module:


{-# LANGUAGE Holes #-}

test x = foldr _ x _


This prints:


[1 of 1] Compiling Main             ( test2.hs, interpreted )

test2.hs:3:16: Warning:
    Found hole `_' with type a0 -> b -> b
    Where: `b' is a rigid type variable bound by
               the inferred type of test :: b -> b at test2.hs:3:1
           `a0' is a free type variable
    In scope: x :: b

test2.hs:3:20: Warning:
    Found hole `_' with type [a0]
    Where: `a0' is a free type variable
    In scope: x :: b
Ok, modules loaded: Main


The 3 currently remaining issues:

- Free type variables are not tidied consistently. For every one of these hole warnings, the same TidyEnv is reused, without taking the updates from the other holes into account. I'm pretty sure I know where this happens and how I could fix it.
- What I thought would be the local environment doesn't actually seem to be it. The holes store in their origin the result of `getLclTypeEnv' at their location, but as the Note [Bindings with closed types] says, the TopLevelFlag of these don't actually differentiate the top level from the non-top level bindings. I think it would be more helpful to only show the non-top level bindings at the hole's location, any hints about how to obtain just these would be appreciated.
- The holes do not have very accurate source location information, like some other errors have. The hole has its origin, ("test2.hs:3:16"), but somehow not something like: "In the expression: folder _ x _, In an equation for `test': test x = foldr _ x _". Help with how that is supposed to work would also be appreciated.

I'm attaching a patch of all my changes compared to HEAD as of about a week ago. All my work can also still be found on https://github.com/xnyhps/ghc.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff.gz
Type: application/x-gzip
Size: 8774 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120723/9444519d/attachment.bin>
-------------- next part --------------

Best regards,
Thijs Alkemade
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120723/9444519d/attachment.pgp>

More information about the Glasgow-haskell-users mailing list