Changes between Version 9 and Version 10 of DeferErrorsToRuntime


Ignore:
Timestamp:
Dec 21, 2011 2:42:35 PM (4 years ago)
Author:
dreixel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeferErrorsToRuntime

    v9 v10  
    3737the way".
    3838
     39
     40== Example ==
     41
     42Here'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
     48module Main where
     49
     50t5624 :: IO ()
     51t5624 = putStr "Hello World" >> putStr ','
     52
     53a :: Int
     54a = 'p'
     55
     56data B = B
     57b :: B -> Bool
     58b x = x == x
     59
     60data C a where
     61  C1 :: C Int
     62  C2 :: Bool -> C Bool
     63
     64c :: C Int -> Bool
     65c (C2 x) = True
     66
     67d :: a -> a
     68d = 1
     69
     70e = 'p'
     71f = e 'q'
     72
     73h :: a -> (Char,Char)
     74h x = (x,'c')
     75
     76data T a where
     77  K  :: a -> T a
     78
     79i a = seq (not (K a)) ()
     80
     81class MyClass a where myOp :: a -> String
     82
     83j = myOp 23 -- Two errors, should not combine them
     84
     85k :: (Int ~ Bool) => Int -> Bool
     86k x = x
     87
     88l :: IO ()
     89l = putChar >> putChar 'p'
     90
     91
     92main :: IO ()
     93main = print "No errors!"
     94}}}
     95
     96This module compiles and runs in the `ghc-defer` branch.
     97
    3998== Implementation details ==
    4099