Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing errors location not helpful #2605

Open
zmrocze opened this issue Sep 17, 2024 · 2 comments
Open

Parsing errors location not helpful #2605

zmrocze opened this issue Sep 17, 2024 · 2 comments

Comments

@zmrocze
Copy link

zmrocze commented Sep 17, 2024

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.

@Gabriella439
Copy link
Collaborator

This is more of an issue with the Haskell implementation, so I'll move this to the Haskell repository's issue tracker

@Gabriella439 Gabriella439 transferred this issue from dhall-lang/dhall-lang Sep 29, 2024
@Gabriella439
Copy link
Collaborator

Yeah, the Dhall parser has a few known issues with error reporting. Probably the most central issue relevant to this is: #1592

Basically, fixing this properly requires a bit of an overhaul to the parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants