Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment doesn't understand QualifiedDo #1847

Open
scuellar opened this issue Jun 7, 2024 · 0 comments
Open

Alignment doesn't understand QualifiedDo #1847

scuellar opened this issue Jun 7, 2024 · 0 comments

Comments

@scuellar
Copy link

scuellar commented Jun 7, 2024

haskell mode does not recognize QualifiedDo notation and gets alignment wrong.

The following simple example, from the Qualified Do user guide, should align like

{-# LANGUAGE QualifiedDo #-}
import qualified Some.Module.Monad as M

action :: M.SomeType a
action = M.do x <- u
                   res
                   M.return x

But haskell-mod aligns it as

{-# LANGUAGE QualifiedDo #-}
import qualified Some.Module.Monad as M

action :: M.SomeType a
action = M.do x <- u
                                res
                                M.return x

Probably thinking that M.do is a function, and not special notation.

It currently accepts the following alignment which also parses correctly, but looks ugly.

action :: M.SomeType a
action =
  M.do
  x <- u
  res
  M.return x

Furthermore, since the notation is not recognized, it will get confused with other multi-line notation, like list. Such as in the following example, which Haskell mode will align to configurations that don't parse.

action :: M.SomeType a
action =
  M.do
  x <- u
  fooList
    [  M.do
       res1
    , M.do
      res2
    ]  
  M.return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant