elm-community / parser-combinators

A parser combinator library for Elm.

Home Page:http://package.elm-lang.org/packages/elm-community/parser-combinators/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in this module when jinjor/elm-time-travel is also a dependency

zachwilliamson91 opened this issue · comments

NOTE: THIS ONLY HAPPENS when the jinjor/elm-time-travel dependency is also installed.

elm-package.json dependencies:

"Bogdanp/elm-combine": "2.2.1 <= v < 3.0.0"
"jinjor/elm-time-travel": "1.0.10 <= v < 2.0.0",

JSON formatted error report with 'elm-make --report=json':

[
{
"tag": "TYPE MISMATCH",
"overview": "The type annotation for (<) does not match its definition.",
"subregion": null,
"details": "The type annotation is saying:\n\n Parser a -> Parser b -> Parser a\n\nBut I am inferring that the definition has this type:\n\n Parser (a -> b) -> Parser a -> Parser (c -> b)\n\nHint: A type annotation is too generic. You can probably just switch to the type\nI inferred. These issues can be subtle though, so read more about it.\nhttps://github.com/elm-lang/elm-compiler/blob/0.17.0/hints/type-annotations.md",
"region": {
"start": {
"line": 51,
"column": 8
},
"end": {
"line": 51,
"column": 44
}
},
"type": "error",
"file": "elm-stuff/packages/Bogdanp/elm-combine/2.2.1/src/Combine/Infix.elm"
},
{
"tag": "TYPE MISMATCH",
"overview": "The type annotation for (
>) does not match its definition.",
"subregion": null,
"details": "The type annotation is saying:\n\n Parser a -> Parser b -> Parser b\n\nBut I am inferring that the definition has this type:\n\n Parser (a -> b) -> Parser a -> Parser (c -> c)\n\nHint: A type annotation is too generic. You can probably just switch to the type\nI inferred. These issues can be subtle though, so read more about it.\nhttps://github.com/elm-lang/elm-compiler/blob/0.17.0/hints/type-annotations.md",
"region": {
"start": {
"line": 63,
"column": 8
},
"end": {
"line": 63,
"column": 44
}
},
"type": "error",
"file": "elm-stuff/packages/Bogdanp/elm-combine/2.2.1/src/Combine/Infix.elm"
}
]

It looks like that package depends on Dandandan/parser which also defines *> and <* so this is a compiler bug. I think you should open a compiler issue for this noting that neither library defines custom fixity for those operators and that the issue is reproducible by having both Bogdanp/elm-combine and Dandandan/parser installed.

Interesting. Okay thanks for the help. I'll make that happen some time tomorrow.

I explain what the problem is, and how to fix it in this package, here: elm/compiler#1430 (comment).

It looks like elm-time-travel has switched to elm-combine so, at least the original issue has been fixed. As for dropping the use of infix map in the definitions of <* and *>, I don't think that's worth doing unless people run into this issue often (which they haven't so far). Until this gets fixed in the compiler, I think your second suggestion is the way to go, @jvoigtlaender. Dandandan/parser should drop its infix declaration for map.