summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_fail/T16181.hs
blob: 29692dd1a173d80f9d8ce3bda42c27fb9db960c1 (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
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE KindSignatures #-}
module T16181 where

import Control.Monad.Trans.Class
import Control.Monad.Reader
import Data.Functor.Const (Const(..))
import Data.Functor.Classes
import Data.Kind
import Data.Proxy

newtype FlipConst a b = FlipConst b
  deriving (Show1, Eq1) via (Const b)

data Foo m x = Foo { foo :: m x }
newtype Q x m a = Q {unQ :: Foo m x -> m a}
    deriving (Functor, Applicative, Monad, MonadReader (Foo m x)) via (ReaderT (Foo m x) m)
    deriving MonadTrans via (ReaderT (Foo m x))

class C (f :: Type -> Type) where
  m :: Proxy f -> String
instance C (Either a) where
  m _ = "Either"
data T a
  deriving C via Either a