summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T18388.hs
blob: a5975a6eb59a596f7ac7ca05c77e8f7458ad4290 (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
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
module T18388 where

class C x y where
  m :: x -> y -> y

newtype Tagged x a = MkTagged a
instance C x (Tagged x a) where
  m _ = id

$([d| newtype Id1 a = MkId1 a
        deriving (C x) via forall x. Tagged x a

      newtype Id2 a = MkId2 a
        deriving (C x) via           Tagged x a
    |])

newtype List1 a = MkList1 [a]
newtype List2 a = MkList2 [a]
$([d| deriving via forall a. [a] instance Eq a => Eq (List1 a) |])
$([d| deriving via           [a] instance Eq a => Eq (List2 a) |])

$([d| f = id @a :: forall a. a -> a |])