summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds/T6118.hs
blob: aaa78e7cee84f759e9acd065a6d7ad6364a44f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE PolyKinds, DataKinds, KindSignatures, RankNTypes,
             TypeFamilies, FlexibleInstances, UndecidableInstances #-}

module T6118 where

import GHC.Exts

data Nat = Zero | Succ Nat
data List a = Nil | Cons a (List a)

class SingE (a :: k) where
  type Demote a :: *

instance SingE (a :: Bool) where
  type Demote a = Bool
instance SingE (a :: Nat) where
  type Demote a = Nat

instance SingE (a :: Maybe k) where
  type Demote (a :: Maybe k) = Maybe (Demote (Any :: k))

instance SingE (a :: List k) where
  type Demote (a :: List k) = List (Demote (Any :: k))