| 39 | |

| 40 | == Example == |

| 41 | |

| 42 | Here's an example of all sorts of errors that can be deferred: |

| 43 | {{{ |

| 44 | {-# LANGUAGE FlexibleContexts #-} |

| 45 | {-# LANGUAGE GADTs #-} |

| 46 | {-# OPTIONS_GHC -fwarn-type-errors #-} |

| 47 | |

| 48 | module Main where |

| 49 | |

| 50 | t5624 :: IO () |

| 51 | t5624 = putStr "Hello World" >> putStr ',' |

| 52 | |

| 53 | a :: Int |

| 54 | a = 'p' |

| 55 | |

| 56 | data B = B |

| 57 | b :: B -> Bool |

| 58 | b x = x == x |

| 59 | |

| 60 | data C a where |

| 61 | C1 :: C Int |

| 62 | C2 :: Bool -> C Bool |

| 63 | |

| 64 | c :: C Int -> Bool |

| 65 | c (C2 x) = True |

| 66 | |

| 67 | d :: a -> a |

| 68 | d = 1 |

| 69 | |

| 70 | e = 'p' |

| 71 | f = e 'q' |

| 72 | |

| 73 | h :: a -> (Char,Char) |

| 74 | h x = (x,'c') |

| 75 | |

| 76 | data T a where |

| 77 | K :: a -> T a |

| 78 | |

| 79 | i a = seq (not (K a)) () |

| 80 | |

| 81 | class MyClass a where myOp :: a -> String |

| 82 | |

| 83 | j = myOp 23 -- Two errors, should not combine them |

| 84 | |

| 85 | k :: (Int ~ Bool) => Int -> Bool |

| 86 | k x = x |

| 87 | |

| 88 | l :: IO () |

| 89 | l = putChar >> putChar 'p' |

| 90 | |

| 91 | |

| 92 | main :: IO () |

| 93 | main = print "No errors!" |

| 94 | }}} |

| 95 | |

| 96 | This module compiles and runs in the `ghc-defer` branch. |

| 97 | |