pointfreeco/swift-parsing

Compiler error does not help me figure out the problem with this code:

andreweades opened this issue · 1 comments

Each time I try to replace my current parsers with swift-parsing I get thwarted by compiler errors almost immediately. It's not at all obvious to me how to fix them though.

Here is an example of what I'm struggling with. No matter what I try, I cannot get it to compile so I must be missing something fundamental.

import Parsing

enum StackElement {
  case number(Double)
  case string(String)
}

let stackElement = Parse {
// ----------------^
// Error: "Type of expression is ambiguous without more context"
  StackElement.number($0)
} with: {
  Int.parser().map { Double($0)! }
}

I'm going to convert this to a discussion and answer over there.