Personally, I'd generally prefer if GHC got a little more interactive about name errors: "I couldn't find heod. Did you mean head?" And if the answer is yes, it could optionally edit the file for you, as well as continuing compilation.
That is a great idea.
I'd like to add that introducing a new option might not be necessary. How about automatically turning unresolved name errors into named type holes? That way, they would be deferred automatically with the existing option.
Michal
On Thursday, May 28, 2015 at 4:27:11 AM UTC-4, Tom Ellis wrote:Deferring type errors until runtime is a feature which probably helps a lot
with the adoption of Haskell. Newcomers can get the encouragement of a
mostly-working program even if there are type errors in a few places.
I can write
foo = 1 + 1
bar = head True
main = print foo
and still run the program or load it in GHCi.
Does anyone think it would also be beneficial to have "-fdefer-name-errors"?
If I write
foo = 1 + 1
bar = baz
main = print foo
but baz doesn't exist it would still be nice to let the program run or be
loaded in GHCi. This could be achieved by replacing all missing variables
by "error 'baz was not defined'" or similar.
If a suitable parser could be written it might even be possible to defer
syntax errors!
This kind of thing would make the experience with Haskell gentler for
newcomers, but also more pleasant for veterans!
Tom
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe