on develop help sign in
Merge fix from primary branch
commitf54ec2043ca28f4d7e680a809410b8b1c03fba40 authorSamuel May <ag.eitilt@gmail.com> dateFri 29 Dec 2017, 23:35 (9 years ago) parenta15856f5f89214
1 file changed+17−1
src/Reflex/Dynamic/TH.hs+17−1
src/Reflex/Dynamic/TH.hs+17−1
@@ -1,4 +1,10 @@
1−{-# LANGUAGE TemplateHaskell, ScopedTypeVariables, TypeOperators, GADTs, EmptyDataDecls, PatternGuards #-}
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE EmptyDataDecls #-}
3+{-# LANGUAGE GADTs #-}
4+{-# LANGUAGE PatternGuards #-}
5+{-# LANGUAGE ScopedTypeVariables #-}
6+{-# LANGUAGE TemplateHaskell #-}
7+{-# LANGUAGE TypeOperators #-}
28module Reflex.Dynamic.TH (qDyn, unqDyn, mkDyn) where
39
410import Reflex.Dynamic
@@ -56,12 +62,22 @@ mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ H
5662 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
5763 Hs.ParseOk e -> qDyn $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
5864 where TH.Name (TH.OccName occName) (TH.NameG _ _ (TH.ModName modName)) = 'unqMarker
65+#if MIN_VERSION_haskell_src_exts(1,18,0)
66+ antiE :: Hs.Exp Hs.SrcSpanInfo -> Hs.Exp Hs.SrcSpanInfo
67+ antiE x = case x of
68+ Hs.SpliceExp l se ->
69+ Hs.App l (Hs.Var l $ Hs.Qual l (Hs.ModuleName l modName) (Hs.Ident l occName)) $ case se of
70+ Hs.IdSplice l2 v -> Hs.Var l2 $ Hs.UnQual l2 $ Hs.Ident l2 v
71+ Hs.ParenSplice _ ps -> ps
72+ _ -> x
73+#else
5974 antiE x = case x of
6075 Hs.SpliceExp se ->
6176 Hs.App (Hs.Var $ Hs.Qual (Hs.ModuleName modName) (Hs.Ident occName)) $ case se of
6277 Hs.IdSplice v -> Hs.Var $ Hs.UnQual $ Hs.Ident v
6378 Hs.ParenSplice ps -> ps
6479 _ -> x
80+#endif
6581 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
6682 | modName == modName' && occName == occName' = 'unqMarker
6783 reinstateUnqDyn x = x