Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/e1fde8aecea618b0a2d286b9feafa4a967b77155 >--------------------------------------------------------------- commit e1fde8aecea618b0a2d286b9feafa4a967b77155 Author: Simon Peyton Jones <[email protected]> Date: Wed May 16 11:15:02 2012 +0100 Test Trac #6015 and #6068 >--------------------------------------------------------------- tests/polykinds/T6015a.hs | 14 ++++++++++++++ tests/polykinds/T6068.hs | 27 +++++++++++++++++++++++++++ tests/polykinds/T6068.script | 2 ++ tests/polykinds/T6068.stdout | 1 + tests/polykinds/all.T | 2 ++ 5 files changed, 46 insertions(+), 0 deletions(-) diff --git a/tests/polykinds/T6015a.hs b/tests/polykinds/T6015a.hs new file mode 100644 index 0000000..f42019c --- /dev/null +++ b/tests/polykinds/T6015a.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE PolyKinds, KindSignatures, FunctionalDependencies, FlexibleInstances, + UndecidableInstances, TypeOperators, DataKinds, FlexibleContexts #-} + +module T6015a where + +import Prelude hiding ((++)) + +data T a = T + +class ((a :: [k]) ++ (b :: [k])) (c :: [k]) | a b -> c +instance ('[] ++ b) b +instance (a ++ b) c => ((x ': a) ++ b) (x ': c) + +test = T :: ('[True] ++ '[]) l => T l diff --git a/tests/polykinds/T6068.hs b/tests/polykinds/T6068.hs new file mode 100644 index 0000000..f9b7dc2 --- /dev/null +++ b/tests/polykinds/T6068.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, GADTs, MultiParamTypeClasses, + FunctionalDependencies, FlexibleInstances, UndecidableInstances, ExistentialQuantification #-} + +module T6068 where + +import Prelude hiding (Maybe, Nothing) + +data Maybe :: * -> * where + Nothing :: Maybe a + +data family Sing (a :: k) + +data instance Sing (a :: Maybe k) where + SNothing :: Sing Nothing + +data KProxy (a :: *) = KProxy +data Existential (p :: KProxy k) = + forall (a :: k). Exists (Sing a) + +class HasSingleton a (kp :: KProxy k) | a -> kp where + exists :: a -> Existential kp + +instance forall a (mp :: KProxy (Maybe ak)). HasSingleton (Maybe a) mp where + exists Nothing = Exists SNothing + +-- instance forall (a ::*) (mp :: KProxy (Maybe ak)). HasSingleton (Maybe ak) (Maybe a) mp where +-- exists Nothing = Exists SNothing diff --git a/tests/polykinds/T6068.script b/tests/polykinds/T6068.script new file mode 100644 index 0000000..6b34183 --- /dev/null +++ b/tests/polykinds/T6068.script @@ -0,0 +1,2 @@ +:l T6068 +:t exists Nothing diff --git a/tests/polykinds/T6068.stdout b/tests/polykinds/T6068.stdout new file mode 100644 index 0000000..32952bb --- /dev/null +++ b/tests/polykinds/T6068.stdout @@ -0,0 +1 @@ +exists Nothing :: Existential (Maybe *) kp diff --git a/tests/polykinds/all.T b/tests/polykinds/all.T index cb017f1..d2459d0 100644 --- a/tests/polykinds/all.T +++ b/tests/polykinds/all.T @@ -46,3 +46,5 @@ test('T6044', normal, compile, ['']) test('T6054', normal, run_command, ['$MAKE -s --no-print-directory T6054']) test('T6081', normal, compile, ['']) test('T6015', normal, compile, ['']) +test('T6015a', normal, compile, ['']) +test('T6068', normal, ghci_script, ['T6068.script']) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
