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 /compiler/hsSyn | |
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 'compiler/hsSyn')
-rw-r--r-- | compiler/hsSyn/Convert.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs index 47bbfb99bf..520eb138d6 100644 --- a/compiler/hsSyn/Convert.hs +++ b/compiler/hsSyn/Convert.hs @@ -252,7 +252,7 @@ cvtDec (ClassD ctxt cl tvs fds decs) Right def -> return def Left (_, msg) -> failWith msg -cvtDec (InstanceD ctxt ty decs) +cvtDec (InstanceD o ctxt ty decs) = do { let doc = text "an instance declaration" ; (binds', sigs', fams', ats', adts') <- cvt_ci_decs doc decs ; unless (null fams') (failWith (mkBadDecMsg doc fams')) @@ -264,7 +264,17 @@ cvtDec (InstanceD ctxt ty decs) , cid_binds = binds' , cid_sigs = Hs.mkClassOpSigs sigs' , cid_tyfam_insts = ats', cid_datafam_insts = adts' - , cid_overlap_mode = Nothing } } + , cid_overlap_mode = fmap (L loc . overlap) o } } + where + overlap pragma = + case pragma of + TH.Overlaps -> Hs.Overlaps "OVERLAPS" + TH.Overlappable -> Hs.Overlappable "OVERLAPPABLE" + TH.Overlapping -> Hs.Overlapping "OVERLAPPING" + TH.Incoherent -> Hs.Incoherent "INCOHERENT" + + + cvtDec (ForeignD ford) = do { ford' <- cvtForD ford |