Skip to content

Indenting of record definition when internal #658

Closed
@cmeeren

Description

Online here

Input:

type RequestParser<'ctx, 'a> = internal {
  consumedFields: Set<ConsumedFieldName>
  parse: 'ctx -> Request ->  Async<Result<'a, Error list>>
  prohibited: ProhibitedRequestGetter list
}

Output:

type RequestParser<'ctx, 'a> =
  internal { consumedFields: Set<ConsumedFieldName>
             parse: 'ctx -> Request -> Async<Result<'a, Error list>>
             prohibited: ProhibitedRequestGetter list }

As mentioned in #657 I strongly dislike code that is indented to "match up".

I usually format records like at the top (input) because it's the easiest format to extend (press enter from end of last line to add new field, don't have to worry about placing cursor inside the brackets and spacing them correctly at the next line). But another alternative to the current Fantomas behaviour that does not indent the whole definition due to internal is this:

type RequestParser<'ctx, 'a> =
  internal
    { consumedFields: Set<ConsumedFieldName>
      parse: 'ctx -> Request ->  Async<Result<'a, Error list>>
      prohibited: ProhibitedRequestGetter list }

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