Relevant Bindings no longer reports shadowed bindings (fixes #12176)
[ghc.git] / testsuite / tests / typecheck / should_fail / T9612.hs
1 {-# LANGUAGE FlexibleInstances, FunctionalDependencies, MultiParamTypeClasses #-}
2 module T9612 where
3 import Data.Monoid
4 import Control.Monad.Trans.Writer.Lazy( Writer, WriterT )
5 import Data.Functor.Identity( Identity )
6
7 class (Monoid w, Monad m) => MonadWriter w m | m -> w where
8 writer :: (a,w) -> m a
9 tell :: w -> m ()
10 listen :: m a -> m (a, w)
11 pass :: m (a, w -> w) -> m a
12
13 f ::(Eq a) => a -> (Int, a) -> Writer [(Int, a)] (Int, a)
14 f y (n,x) {- | y == x = return (n+1, x)
15 | otherwise = -}
16 = do tell (n,x)
17 return (1,y)
18
19
20 instance (Monoid w, Monad m) => MonadWriter w (WriterT w m) where