on develop help sign in
Support for haskell-src-exts 1.18
commit5f89214fd3de943c56799f6bb3bcd75ff7ec8183 authorHamish Mackenzie <Hamish.K.Mackenzie@googlemail.com> dateTue 4 Apr 2017, 22:19 (10 years ago) parent0f5b87d
2 files changed+12−2
reflex.cabal+2−2 src/Reflex/Dynamic/TH.hs+10
reflex.cabal+2−2
@@ -107,8 +107,8 @@ library
107107 cpp-options: -DUSE_TEMPLATE_HASKELL
108108 build-depends:
109109 dependent-sum >= 0.3 && < 0.5,
110− haskell-src-exts >= 1.16 && < 1.18,
111− haskell-src-meta == 0.6.*,
110+ haskell-src-exts >= 1.16 && < 1.19,
111+ haskell-src-meta >= 0.6 && < 0.8,
112112 template-haskell >= 2.9 && < 2.12
113113 exposed-modules:
114114 Reflex.Dynamic.TH
src/Reflex/Dynamic/TH.hs+10
@@ -88,12 +88,22 @@ mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ H
8888 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
8989 Hs.ParseOk e -> qDynPure $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
9090 where TH.Name (TH.OccName occName) (TH.NameG _ _ (TH.ModName modName)) = 'unqMarker
91+#if MIN_VERSION_haskell_src_exts(1,18,0)
92+ antiE :: Hs.Exp Hs.SrcSpanInfo -> Hs.Exp Hs.SrcSpanInfo
93+ antiE x = case x of
94+ Hs.SpliceExp l se ->
95+ Hs.App l (Hs.Var l $ Hs.Qual l (Hs.ModuleName l modName) (Hs.Ident l occName)) $ case se of
96+ Hs.IdSplice l2 v -> Hs.Var l2 $ Hs.UnQual l2 $ Hs.Ident l2 v
97+ Hs.ParenSplice _ ps -> ps
98+ _ -> x
99+#else
91100 antiE x = case x of
92101 Hs.SpliceExp se ->
93102 Hs.App (Hs.Var $ Hs.Qual (Hs.ModuleName modName) (Hs.Ident occName)) $ case se of
94103 Hs.IdSplice v -> Hs.Var $ Hs.UnQual $ Hs.Ident v
95104 Hs.ParenSplice ps -> ps
96105 _ -> x
106+#endif
97107 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
98108 | modName == modName' && occName == occName' = 'unqMarker
99109 reinstateUnqDyn x = x