freckle / rcl

Stackage resolver changelog
MIT License
0 stars 0 forks source link

Fix Stackage diff parser #5

Closed pbrisbin closed 4 years ago

pbrisbin commented 4 years ago

Stackage changed its JSON representation for package differences

It used to be nested objects:

{ diff:
  { some-package:    { lts-x: version-x, lts-y: version-y }
  , another-package: { lts-x: version-x, lts-y: version-y }
  , ...
  }
}

which was very easy to work with in Haskell (map of maps).

Now it's this:

{ diff:
  [ ["some-package",    { lts-x: version-x, lts-y: version-y }]
  , ["another-package", { lts-x: version-x, lts-y: version-y }]
  , ...
  ]
}

Which is not easy to work with in Haskell (list of heterogeneous list).

I guess is nicer for JavaScript? Anyway, I'm representing this silly type and JSON parser in its own module, to isolate the mess. It allows a drop-in change in the main type to fix parsing.