diff options
author | Iavor S. Diatchki <iavor.diatchki@gmail.com> | 2016-04-17 12:56:31 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-04-17 14:42:15 +0200 |
commit | 04b70cda4ed006c7e3df40e169550a00aba79524 (patch) | |
tree | 480cfd9e0e2bf8a937295311b113115458f62e71 /testsuite/tests/th/TH_overlaps.hs | |
parent | 97f2b16483aae28dc8fd60b6d2e1e283618f2390 (diff) | |
download | haskell-04b70cda4ed006c7e3df40e169550a00aba79524.tar.gz |
Add TemplateHaskell support for Overlapping pragmas
Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari
Reviewed By: RyanGlScott, bgamari
Subscribers: RyanGlScott, thomie
Differential Revision: https://phabricator.haskell.org/D2118
Diffstat (limited to 'testsuite/tests/th/TH_overlaps.hs')
-rw-r--r-- | testsuite/tests/th/TH_overlaps.hs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_overlaps.hs b/testsuite/tests/th/TH_overlaps.hs new file mode 100644 index 0000000000..9fd2180dcb --- /dev/null +++ b/testsuite/tests/th/TH_overlaps.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE TemplateHaskell, FlexibleInstances #-} +module TH_overlaps where + +import Language.Haskell.TH + +class C1 a where c1 :: a +class C2 a where c2 :: a +class C3 a where c3 :: a + +[d| + instance {-# OVERLAPPABLE #-} C1 [a] where c1 = [] + instance C1 [Int] where c1 = [1] + + instance C2 [a] where c2 = [] + instance {-# OVERLAPPING #-} C2 [Int] where c2 = [1] + + instance C3 [a] where c3 = [] + instance {-# OVERLAPS #-} C3 [[a]] where c3 = [[]] + instance C3 [[Int]] where c3 = [[1]] + |] + +test1 :: ([Char],[Int]) +test1 = (c1,c1) + +test2 :: ([Char],[Int]) +test2 = (c2,c2) + +test3 :: ([Char],[[Char]],[[Int]]) +test3 = (c3,c3,c3) |