Skip to content

Parsing errors location not helpful #2605

Open
@zmrocze

Description

@zmrocze

Hey,

over the past few days with dhall oftentimes I encountered parsing errors with the error location very distant to the fix location. The debugging often gave me good few minutes of "find elmo" fun.

The location and description of parsing errors often seems in human terms unrelated to the error.

Below one such minimal unparsing example. Will add more. The parsing error occurs here at the m letter in map = with description: "expecting whitespace or }".

{ profiles.mk2_3by4 = {
  setting_note_0vel_is_noteoff = True,
  map =
    let config =
      ({
        intervals =
          let mkIntervals = \({ pressed_channel : Integer, played_channel : Integer  }) -> 
            lib.list-map Integer (lib.Pair lib.Note { intervals : List lib.Note})
              (\(i : Integer) -> { 
                key = { note = lib.int-add +60 i, channel = pressed_channel },
                val = { intervals = [ { note = i, channel = played_channel } ] }
              })
              (lib.range { from = -9, to = +4 })
          in
            [
              (mkIntervals { pressed_channel = +0, played_channel = +0 }),
              (mkIntervals { pressed_channel = +1, played_channel = +1 })
            ]
      })
    in lib.by_intervals config
  },
}

The error "really" happens in the definition of mkIntervals where the lambda lacks its argument name, there's only the argument type.

Another example is where usage of : instead of = in record values results in errors somewhere else completely.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions