Skip to content

Wingman inserts layout-breaking spaces when case-splitting in do block #1486

Closed
@isovector

Description

@isovector

as reported by @jhrcek:

data Thing = A | B | C

getThing :: IO Thing
getThing = pure A

f :: Int -> IO ()
f i = do
    thing <- getThing
    _

this case splits to

f :: Int -> IO ()
f i = do
    thing <- getThing
     (case thing of
       A -> _
       B -> _
       C -> _
    )

but notice the leading space. In expressions it doesn't matter, but here YIKES.

Seems related to alanz/ghc-exactprint#91, except that we aren't calling addAnnotationsForPretty anymore. Maybe generated splices just need a setPrecedingLine (-1) 0 to get rid of this leading column?

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: wingmantype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions