Merge branch 'master' of http://darcs.haskell.org//testsuite
[ghc.git] / testsuite / tests / polykinds / T6068.hs
1 {-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, GADTs, MultiParamTypeClasses,
2 FunctionalDependencies, FlexibleInstances, UndecidableInstances, ExistentialQuantification #-}
3
4 module T6068 where
5
6 import Prelude hiding (Maybe, Nothing)
7
8 data Maybe :: * -> * where
9 Nothing :: Maybe a
10
11 data family Sing (a :: k)
12
13 data instance Sing (a :: Maybe k) where
14 SNothing :: Sing Nothing
15
16 data KProxy (a :: *) = KProxy
17 data Existential (p :: KProxy k) =
18 forall (a :: k). Exists (Sing a)
19
20 class HasSingleton a (kp :: KProxy k) | a -> kp where
21 exists :: a -> Existential kp
22
23 instance forall a (mp :: KProxy (Maybe ak)). HasSingleton (Maybe a) mp where
24 exists Nothing = Exists SNothing
25
26 -- instance forall (a ::*) (mp :: KProxy (Maybe ak)). HasSingleton (Maybe ak) (Maybe a) mp where
27 -- exists Nothing = Exists SNothing