on develop help sign in
Support for haskell-src-exts 1.18
5f89214Hamish Mackenzie
reflex.cabal+2−2
@@ -107,8 +107,8 @@ library
107 cpp-options: -DUSE_TEMPLATE_HASKELL
107 cpp-options: -DUSE_TEMPLATE_HASKELL
108 build-depends:
108 build-depends:
109 dependent-sum >= 0.3 && < 0.5,
109 dependent-sum >= 0.3 && < 0.5,
110− haskell-src-exts >= 1.16 && < 1.18,
110+ haskell-src-exts >= 1.16 && < 1.19,
111− haskell-src-meta == 0.6.*,
111+ haskell-src-meta >= 0.6 && < 0.8,
112 template-haskell >= 2.9 && < 2.12
112 template-haskell >= 2.9 && < 2.12
113 exposed-modules:
113 exposed-modules:
114 Reflex.Dynamic.TH
114 Reflex.Dynamic.TH
src/Reflex/Dynamic/TH.hs+10
@@ -88,12 +88,22 @@ mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ H
88 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
88 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
89 Hs.ParseOk e -> qDynPure $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
89 Hs.ParseOk e -> qDynPure $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
90 where TH.Name (TH.OccName occName) (TH.NameG _ _ (TH.ModName modName)) = 'unqMarker
90 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
91 antiE x = case x of
100 antiE x = case x of
92 Hs.SpliceExp se ->
101 Hs.SpliceExp se ->
93 Hs.App (Hs.Var $ Hs.Qual (Hs.ModuleName modName) (Hs.Ident occName)) $ case se of
102 Hs.App (Hs.Var $ Hs.Qual (Hs.ModuleName modName) (Hs.Ident occName)) $ case se of
94 Hs.IdSplice v -> Hs.Var $ Hs.UnQual $ Hs.Ident v
103 Hs.IdSplice v -> Hs.Var $ Hs.UnQual $ Hs.Ident v
95 Hs.ParenSplice ps -> ps
104 Hs.ParenSplice ps -> ps
96 _ -> x
105 _ -> x
106+#endif
97 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
107 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
98 | modName == modName' && occName == occName' = 'unqMarker
108 | modName == modName' && occName == occName' = 'unqMarker
99 reinstateUnqDyn x = x
109 reinstateUnqDyn x = x