Holes in GHC
Matthew Farkas-Dyck
strake888 at gmail.com
Sun Jan 29 05:22:03 CET 2012
On 26/01/2012, Thijs Alkemade <thijsalkemade at gmail.com> wrote:
> Let me try to describe the goal better. The intended users are people
> new to Haskell or people working with existing code they are not
> familiar with. When starting with Haskell, at least in my experience,
> it happens lot that you have an idea about what you need to write, but
> there are some parts in the expression you're working on you don't
> know yet.
>
> This is where you would want to use a hole. Just like undefined, it
> has type `a`, so it can be used anywhere (and when compiling, we
> intend to turn it into an exception too), but the difference with
> undefined is that after the typechecking has succeeded, you get a list
> of your holes, with the type that was inferred for them, as a sort of
> todo-list.
>
Megawin. Many times, lost in a tangle of code, this was just what I
needed, and, alas, just what I lacked.
>
> Regards,
> Thijs Alkemade
Also, I think it would be nice to have a mode in which GHC would just
print the type of each hole in a module. Otherwise, one might have to
load each needed module in GHCi, which could be awkward, especially if
the holed term is in definition of others.
Cheers,
MFD
More information about the Glasgow-haskell-users
mailing list