Justification of infix patterns #289

Open
opened 2020-03-16 07:57:28 +01:00 by expipiplus1 · 1 comment
expipiplus1 commented 2020-03-16 07:57:28 +01:00 (Migrated from github.com)

I know this would require knowing the fixity of patterns, nevertheless:

It would be nice if brittany would left or right justify patterns as appropriate depending on their associativity direction. For instance (given infixr :)

Currently brittany formats thusly, which at a glance implies : associates to the left

baz :: [a] -> Int
baz = \case
  _ : _ : _ -> 0
  _     : _ -> 0

Perhaps it would be nicer to format as

baz :: [a] -> Int
baz = \case
  _ : _ : _ -> 0
  _ : _      -> 0

or even

baz :: [a] -> Int
baz = \case
  _ : _ : _ -> 0
  _ :   _   -> 0

This is a very minor issue!

I know this would require knowing the fixity of patterns, nevertheless: It would be nice if brittany would left or right justify patterns as appropriate depending on their associativity direction. For instance (given `infixr :`) Currently brittany formats thusly, which at a glance implies `:` associates to the left ```haskell baz :: [a] -> Int baz = \case _ : _ : _ -> 0 _ : _ -> 0 ``` Perhaps it would be nicer to format as ```haskell baz :: [a] -> Int baz = \case _ : _ : _ -> 0 _ : _ -> 0 ``` or even ```haskell baz :: [a] -> Int baz = \case _ : _ : _ -> 0 _ : _ -> 0 ``` This is a very minor issue!
tfausak commented 2020-07-21 14:25:00 +02:00 (Migrated from github.com)

This is similar to #79 and #85 except that it deals with patterns rather than expressions.

This is similar to #79 and #85 except that it deals with patterns rather than expressions.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#289
There is no content yet.