Holes in GHC

Thijs Alkemade thijsalkemade at gmail.com
Thu Jan 26 21:41:04 CET 2012

On Thu, Jan 26, 2012 at 8:33 PM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> I'm sorry to be slow, but I still don't understand what you intend.  I wonder whether you could give a series of examples?  Is this something to do with GHCi?  Or some hypothetical IDE? Or do you expect to compile Foo.hs with some holes in it, and get some output relating to the holes?   Be as concrete as you possibly can.  Precisely how do you expect people to interact with the system you envisage? What do they type in?  What output do they see on the screen?
> Simon

The primary goal is to make this part of GHCi. Say, you're working on
a file Foo.hs in your favorite editor, and you have:


foo = foldr __ 0 [1..5]


And you have no idea what you should use at the location of the "__".
You bring up GHCi, and load it as a module:

$ ghci
GHCi, version 7.5.20120126: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load Foo.hs
[1 of 1] Compiling Main             ( Foo.hs, interpreted )
Found a hole at Foo.hs:1:13-14: Integer -> Integer -> Integer

You notice it needs a function, so you make some more changes and hit
save, so Foo.hs now contains:


foo = foldr (\x -> __) 0 [1..5]


You reload GHCi, to see if you made progress:

*Main> :r
[1 of 1] Compiling Main             ( Foo.hs, interpreted )
Found a hole at Foo.hs:1:20-21: Integer -> Integer

And that's it. It might help IDEs later on, but that is not our goal.

Thijs Alkemade

More information about the Glasgow-haskell-users mailing list