haskell-src-meta-0.8.3.patch 3.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
diff -ru haskell-src-meta-0.8.3.orig/src/Language/Haskell/Meta/Syntax/Translate.hs haskell-src-meta-0.8.3/src/Language/Haskell/Meta/Syntax/Translate.hs
--- haskell-src-meta-0.8.3.orig/src/Language/Haskell/Meta/Syntax/Translate.hs	2019-03-02 19:42:56.000000000 -0500
+++ haskell-src-meta-0.8.3/src/Language/Haskell/Meta/Syntax/Translate.hs	2019-09-07 16:14:45.414486693 -0400
@@ -83,11 +83,23 @@
 instance (ToExp a) => ToExp [a] where
   toExp = TH.ListE . fmap toExp
 instance (ToExp a, ToExp b) => ToExp (a,b) where
-  toExp (a,b) = TH.TupE [toExp a, toExp b]
+  toExp (a,b) = TH.TupE $
+#if MIN_VERSION_template_haskell(2,16,0)
+                map Just
+#endif
+                [toExp a, toExp b]
 instance (ToExp a, ToExp b, ToExp c) => ToExp (a,b,c) where
-  toExp (a,b,c) = TH.TupE [toExp a, toExp b, toExp c]
+  toExp (a,b,c) = TH.TupE $
+#if MIN_VERSION_template_haskell(2,16,0)
+                  map Just
+#endif
+                  [toExp a, toExp b, toExp c]
 instance (ToExp a, ToExp b, ToExp c, ToExp d) => ToExp (a,b,c,d) where
-  toExp (a,b,c,d) = TH.TupE [toExp a, toExp b, toExp c, toExp d]
+  toExp (a,b,c,d) = TH.TupE $
+#if MIN_VERSION_template_haskell(2,16,0)
+                    map Just
+#endif
+                    [toExp a, toExp b, toExp c, toExp d]
 
 
 instance ToPat TH.Lit where
@@ -273,8 +285,20 @@
   toExp (Exts.Case _ e alts)           = TH.CaseE (toExp e) (map toMatch alts)
   toExp (Exts.Do _ ss)                 = TH.DoE (map toStmt ss)
   toExp e@Exts.MDo{}                   = noTH "toExp" e
-  toExp (Exts.Tuple _ Exts.Boxed xs)   = TH.TupE (fmap toExp xs)
-  toExp (Exts.Tuple _ Exts.Unboxed xs) = TH.UnboxedTupE (fmap toExp xs)
+  toExp (Exts.Tuple _ Exts.Boxed xs)   = TH.TupE (fmap
+#if MIN_VERSION_template_haskell(2,16,0)
+                                                       (Just . toExp)
+#else
+                                                       toExp
+#endif
+                                                             xs)
+  toExp (Exts.Tuple _ Exts.Unboxed xs) = TH.UnboxedTupE (fmap
+#if MIN_VERSION_template_haskell(2,16,0)
+                                                              (Just . toExp)
+#else
+                                                              toExp
+#endif
+                                                                    xs)
   toExp e@Exts.TupleSection{}          = noTH "toExp" e
   toExp (Exts.List _ xs)               = TH.ListE (fmap toExp xs)
   toExp (Exts.Paren _ e)               = TH.ParensE (toExp e)
diff -ru haskell-src-meta-0.8.3.orig/src/Language/Haskell/Meta/Utils.hs haskell-src-meta-0.8.3/src/Language/Haskell/Meta/Utils.hs
--- haskell-src-meta-0.8.3.orig/src/Language/Haskell/Meta/Utils.hs	2019-03-02 19:42:56.000000000 -0500
+++ haskell-src-meta-0.8.3/src/Language/Haskell/Meta/Utils.hs	2019-09-07 16:16:09.779248579 -0400
@@ -350,7 +350,13 @@
   in replicateM n (newName "a")
       >>= \ns -> return (Just (LamE
                     [ConP dConN (fmap VarP ns)]
-                    (TupE $ fmap VarE ns)))
+                    (TupE $ fmap
+# if MIN_VERSION_template_haskell(2,16,0)
+                                 (Just . VarE)
+# else
+                                 VarE
+# endif
+                                      ns)))
 #else
 fromDataConI (DataConI dConN ty _tyConN _fxty) =
   let n = arityT ty