From e0bbad0e165369b6f47a7de1d72779d429653343 Mon Sep 17 00:00:00 2001
From: Alan Zimmerman <alan.zimm@gmail.com>
Date: Wed, 23 Oct 2019 22:05:08 +0100
Subject: [PATCH] Update TH generation for Unit x vs (x)

See https://gitlab.haskell.org/ghc/ghc/issues/17371
---
 patches/free-5.1.2.patch | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/patches/free-5.1.2.patch b/patches/free-5.1.2.patch
index c89a2df9..0db32c77 100644
--- a/patches/free-5.1.2.patch
+++ b/patches/free-5.1.2.patch
@@ -1,10 +1,15 @@
 diff --git a/src/Control/Monad/Free/TH.hs b/src/Control/Monad/Free/TH.hs
-index 1a5ace9..856bb39 100644
+index 1a5ace9..225de20 100644
 --- a/src/Control/Monad/Free/TH.hs
 +++ b/src/Control/Monad/Free/TH.hs
-@@ -112,7 +112,13 @@ mkArg (VarT n) t
+@@ -110,9 +110,17 @@ mkArg (VarT n) t
+             [ "expected final return type `" ++ pprint n ++ "'"
+             , "but got `" ++ pprint name ++ "'"
              , "in a constructor's argument type: `" ++ pprint t ++ "'" ]
-           let tup = foldl AppT (TupleT $ length ts) ts
+-          let tup = foldl AppT (TupleT $ length ts) ts
++          let tup = case ts of
++                      [t'] -> t'
++                      _    -> foldl AppT (TupleT $ length ts) ts
            xs <- mapM (const $ newName "x") ts
 -          return $ Captured tup (LamE (map VarP xs) (TupE (map VarE xs)))
 +          return $ Captured tup (LamE (map VarP xs) (TupE (map
-- 
GitLab