tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
958 stars 83 forks source link

MonadComprehensions not supported #665

Closed sellout closed 3 years ago

sellout commented 3 years ago

Describe the bug If MonadComprensions is used, modules that use list comprehensions now error, where Ormolu previously formatted them successfully.

To Reproduce Add {-# language MonadComprehensions #-} to a module containing list comprehensions that Ormolu normally passes.

Expected behavior I think that MonadComprehensions doesn't change the syntax provided by list comprehensions at all, it only weakens the type constraint internally, so code should format identically regardless of that extension. So I think the fix is to replace https://github.com/tweag/ormolu/blob/64735598c78ce9e3ab45c100ee03f4a81599da1c/src/Ormolu/Printer/Meat/Declaration/Value.hs#L705 with

      MonadComp -> compBody

Environment

mrkkrp commented 3 years ago

Would you like to open a PR and make this work?