Open balhoff opened 10 months ago
@lukewilliamboswell have you run into this issue? (maybe something to do with parsing a recursive type) Do you know of any workaround? (thanks for the library, by the way!)
Yes, I think this is the same as https://github.com/roc-lang/roc/issues/5749 but unfortunately is not a quick fix.
I don't have a good workaround for you. Maybe if you remove the type annotations altogether if might help?
Yes, I think this is the same as https://github.com/roc-lang/roc/issues/5749 but unfortunately is not a quick fix.
Oh, that's too bad, looks like I may need to wait a while.
Maybe if you remove the type annotations altogether if might help?
Weirdly if I remove the type annotations it no longer type checks:
── TYPE MISMATCH ──────────────────────────────────────────────────── main.roc ─
This expression is used in an unexpected way:
43│ concept = oneOf [atomicConcept, conjunction]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This Core.oneOf call produces:
Parser (List U8) [
AtomicConcept Str,
Conjunction {
left : Str,
right : Str,
},
]
But you are trying to use it as:
Parser (List U8) Str
@lukewilliamboswell I did find a workaround; I noticed your lazy
function. I redefined conjunction
as:
conjunction = lazy \_ ->
const (\left -> \right -> Conjunction { left, right })
|> skip (string "Conjunction(")
|> keep concept
|> skip (chompWhile \c -> c == ' ')
|> keep concept
|> skip (codeunit ')')
This works! I guess there is still a compiler bug though.
Well... it works for two concept expression types but not for three.
Using MacOS 14.2.1 with Apple Silicon CPU,
roc_nightly-macos_apple_silicon-2023-12-23-6710b371a43
:roc check
passes this code:but
roc build
outputs: