summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/T2850.hs
blob: 68bae857cfb3870b96a08cb1dd236d0601517343 (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 GeneralizedNewtypeDeriving, TypeFamilies, FlexibleContexts, FlexibleInstances #-}

module T2850 where

import Data.Kind (Type)

class K a where
  bar :: a -> a

class K (B a) => M a where
  data B a :: Type
  foo :: B a -> B a

instance M Bool where
  data B Bool = B1Bool Bool | B2Bool Bool
  foo = id

instance K (B Bool) where
  bar = id

-- The 'deriving K' gives the (K (B Int)) instance
-- needed for the superclasses of M
instance M Int where
  newtype B Int = BInt (B Bool) deriving K
  foo = id