diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-07-14 13:48:45 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-07-14 13:48:45 +0100 |
commit | 49703b98a01bf2ac3f7fb5cd63334887a3d975ac (patch) | |
tree | 468cf87d2a6a39786c241bcfab2a86bfdad1098a /testsuite | |
parent | c2cb067041705658b6144f611a5c23e2c8606b7b (diff) | |
download | haskell-49703b98a01bf2ac3f7fb5cd63334887a3d975ac.tar.gz |
Test Trac #5978 and #7010
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/T7010.hs | 44 | ||||
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/T7010.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/all.T | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T5978.hs | 26 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T5978.stderr | 10 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 3 |
6 files changed, 92 insertions, 3 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T7010.hs b/testsuite/tests/indexed-types/should_fail/T7010.hs new file mode 100644 index 0000000000..cb32014e6c --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T7010.hs @@ -0,0 +1,44 @@ +{-# LANGUAGE TypeFamilies #-}
+
+module T7010 where
+
+type Vector = Serial Float
+data Serial v = Serial
+
+class MakeValueTuple a where
+ type ValueTuple a :: *
+
+instance MakeValueTuple Float where
+ type ValueTuple Float = IO Float
+
+instance (MakeValueTuple v) => MakeValueTuple (Serial v) where
+ type ValueTuple (Serial v) = Serial (ValueTuple v)
+
+
+stereoFromMono :: (v, v)
+stereoFromMono = undefined
+
+processIO ::
+ (MakeValueTuple a) =>
+ (ValueTuple a, ValueTuple a) ->
+ (a, a)
+processIO = undefined
+
+
+phoneme :: (Vector, Vector)
+phoneme = processIO stereoFromMono
+
+
+withArgs ::
+ (MakeValueTuple b) =>
+ (a, ValueTuple b) ->
+ (a, b)
+withArgs = undefined
+
+plug ::
+ (MakeValueTuple b) =>
+ (b, ValueTuple b)
+plug = undefined
+
+filterFormants :: (Float, Vector)
+filterFormants = withArgs plug
diff --git a/testsuite/tests/indexed-types/should_fail/T7010.stderr b/testsuite/tests/indexed-types/should_fail/T7010.stderr new file mode 100644 index 0000000000..25194a700b --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T7010.stderr @@ -0,0 +1,8 @@ +
+T7010.hs:44:27:
+ Couldn't match type `Serial (ValueTuple Float)' with `IO Float'
+ Expected type: (Float, ValueTuple Vector)
+ Actual type: (Float, ValueTuple Float)
+ In the first argument of `withArgs', namely `plug'
+ In the expression: withArgs plug
+ In an equation for `filterFormants': filterFormants = withArgs plug
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index dca20ae037..d7d66dfa79 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -75,5 +75,5 @@ test('T5515', normal, compile_fail, ['']) test('T5763', expect_broken(5673), compile_fail, ['']) test('T5934', normal, compile_fail, ['']) test('T6123', normal, compile_fail, ['']) - -test('ExtraTcsUntch', normal, compile_fail, [''])
\ No newline at end of file +test('ExtraTcsUntch', normal, compile_fail, ['']) +test('T7010', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/T5978.hs b/testsuite/tests/typecheck/should_fail/T5978.hs new file mode 100644 index 0000000000..2c761ddc98 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T5978.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE FunctionalDependencies #-}
+module T5978 where
+
+class C from to | from -> to where
+
+instance C Float Char where
+instance C Double Bool where
+
+
+polyFoo :: (C from to) => from
+polyFoo = undefined
+
+polyBar ::
+ (C fromA toA, C fromB toB) =>
+ (toA -> toB) ->
+ fromA -> fromB
+polyBar = undefined
+
+
+monoBar :: Double
+monoBar = polyBar id monoFoo
+
+monoFoo :: Float
+monoFoo = polyFoo
+
diff --git a/testsuite/tests/typecheck/should_fail/T5978.stderr b/testsuite/tests/typecheck/should_fail/T5978.stderr new file mode 100644 index 0000000000..9edfde0721 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T5978.stderr @@ -0,0 +1,10 @@ +
+T5978.hs:22:11:
+ Couldn't match type `Bool' with `Char'
+ When using functional dependencies to combine
+ C Double Bool,
+ arising from the dependency `from -> to'
+ in the instance declaration at T5978.hs:8:10
+ C Double Char, arising from a use of `polyBar' at T5978.hs:22:11-17
+ In the expression: polyBar id monoFoo
+ In an equation for `monoBar': monoBar = polyBar id monoFoo
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 0d047bf1ad..48caf69d90 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -274,5 +274,6 @@ test('T6001', normal, compile_fail, ['']) test('T6022', expect_broken(6022), compile_fail, ['']) test('T5853', normal, compile_fail, ['']) test('T6078', normal, compile_fail, ['']) - test('FDsFromGivens', normal, compile_fail, ['']) +test('T5978', normal, compile_fail, ['']) + |