diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-18 22:44:19 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-20 16:22:07 +0200 |
commit | 915e07c33b143126e3c8de1d2ec22ccc709a9a24 (patch) | |
tree | fcde0a7ffc1466b6e53dbee6df835af07e9a7ecc /testsuite/tests/gadt/gadt25.hs | |
parent | 46ff80f26d1892e1b50e3f10c5d3fded33da6e81 (diff) | |
download | haskell-915e07c33b143126e3c8de1d2ec22ccc709a9a24.tar.gz |
Testsuite: tabs -> spaces [skip ci]
Diffstat (limited to 'testsuite/tests/gadt/gadt25.hs')
-rw-r--r-- | testsuite/tests/gadt/gadt25.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/testsuite/tests/gadt/gadt25.hs b/testsuite/tests/gadt/gadt25.hs index 99aecad3fb..452da8cd4a 100644 --- a/testsuite/tests/gadt/gadt25.hs +++ b/testsuite/tests/gadt/gadt25.hs @@ -5,7 +5,7 @@ module Foo where data TValue t where - TList :: [a] -> TValue [a] + TList :: [a] -> TValue [a] instance (Eq b) => Eq (TValue b) where (==) (TList p) (TList q) = (==) p q @@ -15,19 +15,19 @@ instance (Eq b) => Eq (TValue b) where Here's the reasoning (I have done a bit of renaming). * The TList constructor really has type - TList :: forall a. forall x. (a~[x]) => [x] -> TValue a + TList :: forall a. forall x. (a~[x]) => [x] -> TValue a * So in the pattern match we have - (Eq b) available from the instance header - TList p :: TValue b - x is a skolem, existentially bound by the pattern - p :: [x] - b ~ [x] available from the pattern match + (Eq b) available from the instance header + TList p :: TValue b + x is a skolem, existentially bound by the pattern + p :: [x] + b ~ [x] available from the pattern match * On the RHS we find we need (Eq [x]). * So the constraint problem we have is - (Eq b, b~[x]) => Eq [x] + (Eq b, b~[x]) => Eq [x] ["Given" => "Wanted"] Can we prove this? From the two given constraints we can see that we also have Eq [x], and that certainly proves Eq [x]. @@ -38,4 +38,4 @@ consequences of the "given" constraints, we might use the top-level Eq a => Eq [a] instance to solve the wanted Eq [x]. And now we need Eq x, which *isn't* a consequence of (Eq b, b~[x]). --}
\ No newline at end of file +-} |