diff options
-rw-r--r-- | testsuite/tests/backpack/should_compile/T19244a.bkp | 43 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_compile/T19244b.bkp | 13 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_compile/all.T | 2 |
3 files changed, 58 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_compile/T19244a.bkp b/testsuite/tests/backpack/should_compile/T19244a.bkp new file mode 100644 index 0000000000..6897378240 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/T19244a.bkp @@ -0,0 +1,43 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE TypeSynonymInstances #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE RoleAnnotations #-} +unit user where + signature Map where + type role Map nominal representational + data Map k a + class Key k + instance Key String + empty :: Map k a + lookup :: Key k => k -> Map k a -> Maybe a + insert :: Key k => k -> a -> Map k a -> Map k a + module User where + import Prelude hiding (lookup) + import Map + x = lookup "foo" (insert "foo" True empty) +unit ordmap where + module Map(module Data.Map, Key) where + import Data.Map + type Key = Ord +unit eqmap where + module Map where + import Prelude hiding (lookup) + import qualified Prelude + type role Map nominal representational + newtype Map k a = Assoc [(k, a)] + type Key = Eq + -- Ugh, need the type signatures, otherwise the quantifiers + -- are put in the wrong order. See #12441 + empty :: Map k a + empty = Assoc [] + lookup :: Eq k => k -> Map k a -> Maybe a + lookup k (Assoc xs) = Prelude.lookup k xs + -- Need to insert redundant constraint to make it work... + insert :: Eq k => k -> a -> Map k a -> Map k a + insert k v (Assoc xs) = Assoc ((k,v):xs) +unit main where + dependency user[Map=ordmap:Map] (User as User.Ord) + dependency user[Map=eqmap:Map] (User as User.Eq) + + diff --git a/testsuite/tests/backpack/should_compile/T19244b.bkp b/testsuite/tests/backpack/should_compile/T19244b.bkp new file mode 100644 index 0000000000..152a7d6449 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/T19244b.bkp @@ -0,0 +1,13 @@ +{-# LANGUAGE Haskell2010 #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleInstances #-} +unit user where + signature Map where + class Key k + instance Key String + module User where import Map +unit ordmap where + module Map(Key) where type Key = Ord +unit main where + dependency user[Map=ordmap:Map] (User as User.Ord) diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T index ac8c2a7ed8..a747a461a4 100644 --- a/testsuite/tests/backpack/should_compile/all.T +++ b/testsuite/tests/backpack/should_compile/all.T @@ -58,3 +58,5 @@ test('T13149', expect_broken(13149), backpack_compile, ['']) test('T13214', normal, backpack_compile, ['']) test('T13250', normal, backpack_compile, ['']) test('T13323', normal, backpack_compile, ['']) +test('T19244a', expect_broken(19244), backpack_compile, ['']) +test('T19244b', expect_broken(19244), backpack_compile, ['']) |