Skip to content

Delay Errors Until Runtime

I would like to add an -XDelayErrors flag to GHC that

  • changes most type errors into warnings
  • replaces the faulty expressions with runtime exceptions

This would make haskell development a lot easier. For example, this makes it possible to load buggy code into ghci to be able to execute it and show inferred types.

$ cat hello.lhs 
> main = putStr "Hello World" >> putStr ','

$ inplace/bin/ghc-stage2 --make hello -XDelayErrors
[1 of 1] Compiling Main             ( hello.lhs, hello.o )
Linking hello ...

$ ./hello 
Hello World
hello: hello.lhs:1:41:
    Couldn't match expected type `GHC.Base.String'
                with actual type `GHC.Types.Char'
    In the first argument of `System.IO.putStr', namely ','
    In the second argument of `(GHC.Base.>>)', namely
      System.IO.putStr ','
    In the expression:
      System.IO.putStr "Hello World" GHC.Base.>> System.IO.putStr ','
Trac metadata
Trac field Value
Version 7.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information