diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2009-08-24 02:47:55 +0000 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2009-08-24 02:47:55 +0000 |
commit | 40abae88824f3ed2316870da154bfd1fb1f87bef (patch) | |
tree | def9ca5f95721c61c48230840f523f5654582ba9 /testsuite/tests/ghc-regress/indexed-types/should_compile/T3220.hs | |
parent | 19054d35e0b7214c32fb349b87c4b959e797e91a (diff) | |
download | haskell-40abae88824f3ed2316870da154bfd1fb1f87bef.tar.gz |
TFs: T3220
Diffstat (limited to 'testsuite/tests/ghc-regress/indexed-types/should_compile/T3220.hs')
-rw-r--r-- | testsuite/tests/ghc-regress/indexed-types/should_compile/T3220.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-regress/indexed-types/should_compile/T3220.hs b/testsuite/tests/ghc-regress/indexed-types/should_compile/T3220.hs new file mode 100644 index 0000000000..7d6190a7fa --- /dev/null +++ b/testsuite/tests/ghc-regress/indexed-types/should_compile/T3220.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE TypeFamilies, ScopedTypeVariables#-} + +module T3220 where + +class Foo m where + type Bar m :: * + action :: m -> Bar m -> m + +right x m = action m (Right x) + +right' :: (Either a b ~ Bar m, Foo m) => b -> m -> m +right' x m = action m (Right x) + +instance Foo Int where + type Bar Int = Either Int Int + action m a = either (*) (+) a m + +instance Foo Float where + type Bar Float = Either Float Float + action m a = either (*) (+) a m + +foo = print $ right (1::Int) (3 :: Int) +bar = print $ right (1::Float) (3 :: Float)
\ No newline at end of file |