Updating packages from 0.17 to 0.18 (and maybe then to 0.19)

Recently I started looking for a package that works with BigDecimal numbers, both because we are currently working on a webshop-application that requires using money (and just using a fixed-point decimal like ‘cents’ everywhere is probably not good enough), and because in the near future we will be working on an application that does some stuff with cryptography, where common constants for cryptographic functions are rather large.

In my search, I found javascas/elm-decimal. However, it (and its dependency ‘elm-integer’ that implements BigInteger arithmetic) were written in the time of Elm 0.17 and have not been updated since.

So I attempted to upgrade them to 0.18, by using elm-upgrade. However:

  • Using the newest `elm-upgrade`` assumes you are updating from 0.18 to 0.19
  • After installing elm-update@0.18.7 which seems to be the latest version to go from 0.17 to 0.18 and attempting to run it, I get errors when it attempts to connect to the package repository:
(node:31342) ExperimentalWarning: The fs.promises API is experimental
{ HTTPError: Response code 404 (Not Found)
    at stream.catch.then.data (/home/qqwy/.asdf/installs/nodejs/10.1.0/.npm/lib/node_modules/elm-upgrade/node_modules/got/index.js:123:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  message: 'Response code 404 (Not Found)',
  host: 'package.elm-lang.org',
  hostname: 'package.elm-lang.org',
  method: 'GET',
  path: '/new-packages',
  statusCode: 404,
  statusMessage: 'Not Found' }
ERROR: Unable to connect to http://package.elm-lang.org.  Please try again later.

So I’d like your help: Could you explain how we can still carry over packages from 0.17 to the world of 0.18 (and then on to 0.19?)

I would just try converting it by hand - it looks like it might not be far off being able to compile it under 0.19 anyway?

1 Like

As far as I can tell, the very first thing elm-upgrade 0.18.7 does is downloading a list of “new packages” from the package site. That’s what’s failing. Luckily, it seems like all that list is used for is warning you about packages you depend on that haven’t been upgraded yet.

I haven’t tried this, but you could probably modify the script to pass in a hard coded empty array [] instead of making a network request here:

That should hopefully let you run the script to completion.

2 Likes

I used javascas/BigInteger back in the 0.17 days. When upgrading to 0.18 I forked BigInteger and fixed the issues for a project. Went back to refactor and switched horses to gilbertkennen/BigInt for further 0.18 work. Might that be useful?

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.