Pull recent Hadrian changes from upstream
[ghc.git] / testsuite / tests / typecheck / should_compile / T3955.hs
1 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
2 {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
3
4 -- Test for Trac #3955
5
6 module T3955 where
7
8 import Control.Applicative (Applicative(..))
9 import Control.Monad (liftM, ap)
10
11 class (Monad m) => MonadReader r m
12 newtype Reader r a = Reader { runReader :: r -> a }
13
14 instance Functor (Reader r) where
15 fmap = liftM
16
17 instance Applicative (Reader r) where
18 pure = return
19 (<*>) = ap
20
21 instance Monad (Reader r) where
22 (>>=) = error "urk"
23 return = error "urk"
24
25 instance MonadReader r (Reader r)
26
27 newtype T a x = T (Reader a x)
28 deriving (Functor, Applicative, Monad, MonadReader a)
29
30 {-
31 [1 of 1] Compiling Main ( bug.hs, interpreted )
32 mkUsageInfo: internal name? a{tv amy}
33 Ok, modules loaded: Main.
34 -}