[GHC] #5624: Delay Errors Until Runtime
GHC
cvs-ghc at haskell.org
Mon Aug 13 18:03:12 CEST 2012
#5624: Delay Errors Until Runtime
-------------------------------+--------------------------------------------
Reporter: atnnn | Owner:
Type: feature request | Status: new
Priority: high | Milestone: 7.6.1
Component: Compiler | Version: 7.3
Resolution: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
-------------------------------+--------------------------------------------
Changes (by simonpj):
* owner: atnnn =>
* status: closed => new
* resolution: fixed =>
Comment:
This isn't documented (yet -- Paolo is going to add a short section to the
user manual), but currently `-fdefer-type-errors` is switched off for
"naked expressions" typed at the command prompt. Why? Because such
expressions are typechecked, and then immediately evaluated. So if you
said
{{{
ghci -fdefer-type-errors
Prelude> True && 'x'
}}}
you'd get a warning (from type checking) and an immediately-following
error (when evaluating the expression):
{{{
Warning: Can't unify Bool and Char
Error: Can't unify Bool and Char
}}}
This is a bit stupid, and it's a very common case.
If you use a "statement" rather than an expression, you get deferred type
errors, thus
{{{
Prelude> let v = True && 'x'
Warning: Can't unify Bool and Char
Prelude> v
Error: Can't unify Bool and Char
}}}
Does that make sense? Nothing deep here; it's just a user-interface
issue. Yell if you think the behaviour should be different.
I'm re-opening the ticket for Paolo to add a short manual section.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5624#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list