GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:16:54Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/14471Certain do blocks cause TH to barf when ApplicativeDo is enabled2019-07-07T18:16:54ZAlexis KingCertain do blocks cause TH to barf when ApplicativeDo is enabledThe following program fails with an error:
```hs
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE TemplateHaskell #-}
main = $([|do
return ()
return ()
return ()|])
```
```
Exotic.hs:4:12: error:
Exotic statement not (yet) handle...The following program fails with an error:
```hs
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE TemplateHaskell #-}
main = $([|do
return ()
return ()
return ()|])
```
```
Exotic.hs:4:12: error:
Exotic statement not (yet) handled by Template Haskell
[return ();
return (),
return ()]
```
It only happens when `ApplicativeDo` is enabled.
Furthermore, while this example is extremely minimal, this issue isn’t restricted to `ApplicativeDo`’s special handling of `return`. The following example produces the same error:
```hs
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE TemplateHaskell #-}
main = $([|do
getLine
getLine
getLine|])
```
```
Exotic.hs:4:12: error:
Exotic statement not (yet) handled by Template Haskell
[getLine;
getLine,
getLine]
```
This *doesn’t* happen with fewer than three statements in the `do` block, but it *does* happen with more.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 8.2.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Certain do blocks cause TH to barf when ApplicativeDo is enabled","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program fails with an error:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ApplicativeDo #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n\r\nmain = $([|do\r\n return ()\r\n return ()\r\n return ()|])\r\n}}}\r\n{{{\r\nExotic.hs:4:12: error:\r\n Exotic statement not (yet) handled by Template Haskell\r\n [return ();\r\n return (),\r\n return ()]\r\n}}}\r\n\r\nIt only happens when `ApplicativeDo` is enabled.\r\n\r\nFurthermore, while this example is extremely minimal, this issue isn’t restricted to `ApplicativeDo`’s special handling of `return`. The following example produces the same error:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ApplicativeDo #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n\r\nmain = $([|do\r\n getLine\r\n getLine\r\n getLine|])\r\n}}}\r\n{{{\r\nExotic.hs:4:12: error:\r\n Exotic statement not (yet) handled by Template Haskell\r\n [getLine;\r\n getLine,\r\n getLine]\r\n}}}\r\n\r\nThis ''doesn’t'' happen with fewer than three statements in the `do` block, but it ''does'' happen with more.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Michael SloanMichael Sloan