Testsuite: delete Windows line endings [skip ci] (#11631)
[ghc.git] / testsuite / tests / deriving / should_fail / T4846.hs
1 {-# LANGUAGE RankNTypes, ScopedTypeVariables, StandaloneDeriving, GADTs, GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
2
3 module Main where
4
5 import Data.Typeable
6
7 data Expr a where
8 Lit :: Typeable a => a -> Expr a
9
10 class A a where
11 mk :: a
12
13 class (Typeable a, A a) => B a where
14 mkExpr :: Expr a
15 mkExpr = Lit mk
16
17 -- dfunAE
18 instance B a => A (Expr a) where
19 mk = mkExpr
20
21 -- dfunAB
22 instance A Bool where
23 mk = True
24
25 newtype BOOL = BOOL Bool
26 deriving (Typeable, A)
27
28 instance B Bool
29 deriving instance B BOOL --dfunBB
30
31 showType :: forall a . Expr a -> String
32 showType (Lit _) = show (typeOf (undefined :: a))
33
34 test1 = showType (mk :: Expr BOOL) -- Prints "Bool" (wrong?)
35 test2 = showType (Lit mk :: Expr BOOL) -- Prints "Main.BOOL" (correct)
36
37 main = do { print test1; print test2 }