
Evaluating arguments only if and when they are needed. This is the first
#14367: Lazy evaluation can be invalidated -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AntC): Replying to [ticket:14367 vanto]: principle of lazy evaluation.\\
Example:\\ ...\\ These results are all correct because the evaluated expression (function) is non-strict.\\
No, not an accurate statement. Those examples are ''both'' type-correct ''and'' evaluate a non-strict function.
The same expression below with a changed argument:\\ ...\\
That example is not type-correct.
Here the error message should not have priority. \\
Type errors ''always'' "have priority" before evaluating an expression. (Except if you set `-fdefer-type-errors` or `-fdefer-typed-holes`, as @goldfire correctly points out.) GHC is chiefly a compiler, not an interpreter. Haskell is a statically- typed language. Compiled code would be unusable in general if GHC accepted type-incorrect code, then delayed until run-time to see whether it needed to evaluate some type-incorrect expression. Programs would run ok today but crash tomorrow. I think you'll find every statically-typed compiled language behaves like that. It really has nothing to do with lazy evaluation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14367#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler