Skip to content

Record Dot Syntax conflicts #63

@Dessix

Description

@Dessix

When using Record Dot Syntax, Floskell is willing to break the code:

By default, this breaks when formatted with the base and cramer styles, and any others which do not use a workaround:

askAppCommand :: RIO App CliCommand
askAppCommand = do
  env <- ask @App
  return $ env.appCommand
  -- Gets replaced with:
  -- return $ env . appCommand
  -- Which attempts to compose a record with its field accessor

But this workaround preserves compilation across format calls:

  "op": {
      ". in expression": {
        "force-linebreak": false,
        "spaces": "none",
        "linebreaks": "after"
      }
  }

... Unfortunately, that workaround immediately breaks most point-free code, including the below:

a . b . c
-- Gets replaced with:
-- a.b.c
-- Which attempts to access `a` as a record with field `b` having field `c`

So far as I can tell, there's no viable configuration that produces the intended behaviour in both scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions