[Haskell-cafe] -fdefer-more-errors

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Thu May 28 08:26:58 UTC 2015


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



More information about the Haskell-Cafe mailing list