elm-community / parser-combinators

A parser combinator library for Elm.
http://package.elm-lang.org/packages/elm-community/parser-combinators/latest
BSD 3-Clause "New" or "Revised" License
104 stars 13 forks source link

lazy dependency #6

Closed newlandsvalley closed 8 years ago

newlandsvalley commented 8 years ago

Not sure if this is what's causing me a dependency issue when I publish a library built around elm-combine or not, but you depend on maxsnew/lazy 1.0.1 whereas the most recent version is now 1.1.0. Superb library, by the way.

Bogdanp commented 8 years ago

I feel like this some king of bug in elm-make. The dependency on lazy is specified as

"maxsnew/lazy": "1.0.1 <= v < 2.0.0"

which should resolve to the latest version of lazy in the 1.x range, 1.1.0 in this case.

I've set up a simple test to try to reproduce the issue based on your post on the mailing list.

~/test> cat elm-package.json 
{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "3.0.0 <= v < 4.0.0",
        "evancz/elm-html": "4.0.2 <= v < 5.0.0",
        "maxsnew/lazy": "1.1.0 <= v < 2.0.0",
        "newlandsvalley/elm-comidi": "1.0.0 <= v < 2.0.0"
    },
    "elm-version": "0.16.0 <= v < 0.17.0"
}
~/test> elm package install
Some new packages are needed. Here is the upgrade plan.

  Install:
    Bogdanp/elm-combine 2.0.0
    elm-lang/core 3.0.0
    evancz/elm-html 4.0.2
    evancz/virtual-dom 2.1.0
    maxsnew/lazy 1.1.0
    newlandsvalley/elm-comidi 1.0.0

Do you approve of this plan? (y/n) y
Downloading Bogdanp/elm-combine
Downloading elm-lang/core
Downloading evancz/elm-html
Downloading evancz/virtual-dom
Downloading maxsnew/lazy
Downloading newlandsvalley/elm-comidi
Packages configured successfully!
~/test> cat Foo.elm 
module Foo where

import Html exposing (Html, text)

main : Html
main = text "hi"
~/test> elm make Foo.elm 
Problem in dependency newlandsvalley/elm-comidi 1.0.0               

The elm-package.json constraints of 'newlandsvalley/elm-comidi' are probably
letting too much stuff through. Definitely open an issue on the relevant github
repo to get this fixed and save other people from this pain.

In the meantime, take a look through the direct dependencies of the broken
package and see if any of them have had releases recently. If you find the new
thing that is causing problems, you can artificially constrain things by adding
some extra constraints to your elm-package.json as a stopgap measure.

Detected errors in 1 module.         

Notice how it installs lazy version 1.1.0. The exact same thing happens if I relax the lazy dependency in my test elm-package.json to 1.0.1 or remove the lazy dependency altogether.

The following seems to work:

~/test> cat elm-package.json 
{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "3.0.0 <= v < 4.0.0",
        "evancz/elm-html": "4.0.2 <= v < 5.0.0",
        "maxsnew/lazy": "1.0.1 <= v < 2.0.0",
        "Bogdanp/elm-combine": "2.0.0 <= v < 3.0.0"
    },
    "elm-version": "0.16.0 <= v < 0.17.0"
}
~/test> elm package install
Some new packages are needed. Here is the upgrade plan.

  Install:
    Bogdanp/elm-combine 2.0.0
    elm-lang/core 3.0.0
    evancz/elm-html 4.0.2
    evancz/virtual-dom 2.1.0
    maxsnew/lazy 1.1.0

Do you approve of this plan? (y/n) y
Downloading Bogdanp/elm-combine
Downloading elm-lang/core
Downloading evancz/elm-html
Downloading evancz/virtual-dom
Downloading maxsnew/lazy
Packages configured successfully!
~/test> elm make Foo.elm 
Success! Compiled 42 modules.                                       
Successfully generated index.html

I've found this issue in core but its resolution doesn't apply here. Could you open a new issue with elm-lang/core so we can see what the maintainers think?

Bogdanp commented 8 years ago

I think I found the issue:

[
   {
      "tag":"NAMING ERROR",
      "overview":"Cannot find pattern `Done`",
      "subregion":null,
      "suggestions":[

      ],
      "details":"",
      "region":{
         "start":{
            "line":491,
            "column":6
         },
         "end":{
            "line":491,
            "column":12
         }
      },
      "type":"error",
      "file":"elm-stuff/packages/newlandsvalley/elm-comidi/1.0.0/src/CoMidi.elm"
   },
   {
      "tag":"NAMING ERROR",
      "overview":"Cannot find pattern `Fail`",
      "subregion":null,
      "suggestions":[

      ],
      "details":"",
      "region":{
         "start":{
            "line":494,
            "column":6
         },
         "end":{
            "line":494,
            "column":13
         }
      },
      "type":"error",
      "file":"elm-stuff/packages/newlandsvalley/elm-comidi/1.0.0/src/CoMidi.elm"
   }
]

That is the output I get when I run elm make --report=json Foo.elm (I got the idea to do this after reading elm-make's Report.hs).

I don't know how/why you were allowed to publish the package in the first place since elm-combine no longer exports a custom Result ADT but I assume that if you fix those issues (replace Done with Ok and Fail with Err -- see CHANGELOG.md) and re-publish everything will work.

newlandsvalley commented 8 years ago

Ah - I see. Very sorry to have put you to all this trouble, Bogdan. Many thanks for spotting this. I suspect what happened is that I saw that you'd bumped up the version number, altered my dependency accordingly but then failed to delete elm-stuff before recompiling. I'll get this sorted out in the next day or so - so I'll close this issue now.