Skip to content
Snippets Groups Projects
Commit e0bbad0e authored by Alan Zimmerman's avatar Alan Zimmerman
Browse files

Update TH generation for Unit x vs (x)

parent 43c8ce16
No related branches found
No related tags found
No related merge requests found
Pipeline #11755 passed
diff --git a/src/Control/Monad/Free/TH.hs b/src/Control/Monad/Free/TH.hs 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 --- a/src/Control/Monad/Free/TH.hs
+++ b/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 ++ "'" ] , "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 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 VarE xs)))
+ return $ Captured tup (LamE (map VarP xs) (TupE (map + return $ Captured tup (LamE (map VarP xs) (TupE (map
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment