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