dhall-lang / dhall-to-cabal

Compile Dhall expressions to Cabal files
MIT License
100 stars 19 forks source link

Add prelude.utils.mapBuildInfo. #172

Closed quasicomputational closed 5 years ago

quasicomputational commented 5 years ago

IMO, this is a function that highlights how dhall-to-cabal is an advance on hpack: the best feature of hpack, setting ghc-options at the top level and then having them apply to all components without any per-component effort, is now really easy to implement. It was writable before the latest Dhall version, but record projection by expression turns it from horrible to just mildly repetetive.

Tests are actually passing but I don't think its ready to merge on two counts:

ocharles commented 5 years ago

1009 is merged now, but I don't understand the second point. What's wrong with HTTP URLs?

quasicomputational commented 5 years ago

Ah, it's the non-self-containment, and how it'll hit the network at runtime. A secondary problem is that it's mutable, so there's no guarantee that the Dhall being fetched will work with the user's version.

A third option occurs to me: we could run dhall resolve at build time and distribute a 'statically linked' version of dhall/, which has the benefit of clean source but also self-containment for users.

ocharles commented 5 years ago

Ah, it's the non-self-containment, and how it'll hit the network at runtime

Only if it's not in the cache.

A secondary problem is that it's mutable, so there's no guarantee that the Dhall being fetched will work with the user's version.

That's just a case for versioning. We do have Git tag's that we should be using, and we should be using dhall freeze to add hashes for caching compatibility.

Would that be sufficient?

quasicomputational commented 5 years ago

I guess the cache is OK, though making sure it's filled is presently a bit clunky.

OK - let's go with HTTP; if it turns out to be a problem, there are always options.

quasicomputational commented 5 years ago

I've done some further thinking, and I realised that HTTP doesn't necessarily mean hitting the network - it's imaginable that, e.g., Dhall will get clever enough that it'll be able to resolve HTTP imports by using provided signed HTTP exchanges. That it's liable to hit the network today, and preventing that relies on the vagaries of cache invalidation, is unfortunate.

quasicomputational commented 5 years ago

Blocked on dhall-lang/dhall-lang#670, for version-pinned imports of the prelude from dhall-lang.org.

quasicomputational commented 5 years ago

Ah, and also on #179, because of that projection bug that was fixed in 1.25.