Skip to content

haskell-indent-align-def, via haskell-indent-start-of-def, causes type of definition to align with '=' #235

Closed
@philipdexter

Description

@philipdexter

Calling an align on

test :: Int -> Int -> Int
test x y = x
test x y     = y

gives

test     :: Int -> Int -> Int
test x y = x
test x y = y

I have looked briefly and I haven't found any Haskell code that uses this indentation style. I believe it should give

test :: Int -> Int -> Int
test x y = x
test x y = y

I have created a patch that changes

  • haskell-indent-start-of-def to discard type lines (note: start-of-def is only called when P-ARG is nil)
  • haskell-indent-align-guards-and-rhs to take a universal argument that switches on the P-ARG argument to haskell-indent-align-def

Result:

  • to include type definitions in alignment prefix C-u

Thoughts?

There are other places in the alignment code that this could be changed. However I wanted to keep this fix simple and I didn't want to forbid aligning of code like

test :: Int
testSecond :: Int

to

test       :: Int
testSecond :: Int

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions