summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds/T9750.hs
blob: 9cce81d7a61e1b5b289d053ad6771beb2b1544f8 (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
35
36
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE FlexibleInstances      #-}
{-# LANGUAGE TypeFamilies           #-}
{-# LANGUAGE DataKinds              #-}
{-# LANGUAGE ScopedTypeVariables    #-}

module T9750 where

import Data.Kind (Type)
import GHC.TypeLits ( Symbol, KnownSymbol )

--------------------------------------------------------------------------------

data Meta = MetaCons Symbol
data M1 (c :: Meta) = M1

class Generic a where
  type Rep a :: Type
  from  :: a -> Rep a

--------------------------------------------------------------------------------

data A = A1

instance Generic A where
  type Rep A = M1 ('MetaCons "test")
  from A1 = M1

class GShow' f where
  gshowsPrec' :: f -> ShowS

instance (KnownSymbol c) => GShow' (M1 ('MetaCons c)) where
  gshowsPrec' = error "urk"

instance GShow' A where
  gshowsPrec' = gshowsPrec' . from