summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/T10284.hs
blob: c703284e515541b12e446713bec5a807901934a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# OPTIONS_GHC -fdefer-type-errors -fno-warn-deferred-type-errors #-}

import Control.Exception
import Data.Functor

a :: Int
a = 'a'

main :: IO ()
main = do
  catch (void $ evaluate a)
        (\e -> do let err = show (e :: TypeError)
                  putStrLn ("As expected, TypeError: " ++ err))
  catch (void $ evaluate a)
        (\e -> do let err = show (e :: ErrorCall)
                  putStrLn ("Something went horribly wrong: " ++ err))