diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/T2203b.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_compile/T2203b.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/T2203b.hs b/testsuite/tests/indexed-types/should_compile/T2203b.hs new file mode 100644 index 0000000000..74517aeadd --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/T2203b.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE ScopedTypeVariables, TypeFamilies #-} + +module T2203b where + +class Foo a where + type TheFoo a + foo :: TheFoo a -> a + foo' :: a -> Int + +class Bar b where + bar :: b -> Int + +instance (b ~ TheFoo a, Foo a) => Bar (Either a b) where + bar (Left a) = foo' a + bar (Right b) = foo' (foo b :: a) + +instance Foo Int where + type TheFoo Int = Int + foo = id + foo' = id + +val :: Either Int Int +val = Left 5 + +res :: Int +res = bar val
\ No newline at end of file |