How to clear cache?


How can I clear the cache of the dhall exectuable? I assume there is caching happening because if run dhall <<< https://some.url.dhall. And then I update https://some.url.dhall. dhall hash <<< https://some.url.dhall still returns the old hash, but curl https://some.url.dhall | dhall hash returns the new hash.


(restarting my machine didn’t work)


Is the web server doing something strange?

I clear my Dhall cache with

rm -rf ~/.cache/dhall*

though I’m not 100% sure if that’s what’s wrong in your case.


Thanks. That’s helpful to know where the cache is. My still problem persists when I remove the .cache folders:

> dhall hash <<< https://myurl.dhall
> rm -rf ~/.cache/dhall*
> ls  ~/.cache

> dhall hash <<< https://myurl.dhall
> ls  ~/.cache # no dhall folders
dhall		dhall-haskell
> curl https://myurl.dhall | dhall hash

(I get basically the same thing as :point_up: if I use dhall --no-cache)


@bsaul: Does https://some.url.dhall have relative imports of its own?

The reason I ask is that curl "${URL}" | dhall hash is not necessarily the same thing as dhall hash "${URL}". Specifically, the case where they differ is when "${URL}" has a relative import.

For example, suppose that the contents of were:

-- ./foo.dhall

Then dhall hash <<< '' would resolve ./foo.dhall as the URL whereas curl | dhall hash would resolve ./foo.dhall relative to your local directory.

A related thing to try is to report the output of the following command

$ dhall diff "$(curl --silent https://some.url.dhall)" 'https://some.url.dhall'

That should narrow down pretty quickly why there is a hash mismatch.


Does https://some.url.dhall have relative imports of its own?

No, it doesn’t.

A related thing to try is to report the output of the following command

This returns:

{ …

It seems like there is some weird server or local caching happening. I’ll keep digging.


I myself have had some problems with which I think is on their end. Interested to know what you dig up!


A server-side problem still wouldn’t explain why the diff is empty but the hash is different. However, there are still a few more things worth trying.

First, check to see if we can reproduce the hash mismatch in smaller steps:

$ # First repeat the original two commands, to verify that the hashes still don't match
$ curl https://some.url.dhall | dhall hash
$ dhall hash <<< 'https://some.url.dhall'

$ # Now see if we still get a hash mismatch when using smaller steps
$ curl https://some.url.dhall | dhall --alpha | dhall encode | shasum --algorithm 256
$ dhall --alpha <<< 'https://some.url.dhall' | dhall encode | shasum --algorithm 256

If we can reproduce the hash mismatch with the latter two commands then that will help us narrow down what is causing the difference.


We have encountered a similar issue today with a hash that suddenly got another value out of dhall hash <<<

Cleaning the cache everywhere (CI, all personal laptops) succeeds to meet on a common value again. We could not get the current correct value (check with a clone & dhall hash locally) without cleaning ~/.cache/dhall*.

Is there any way to ensure dhall hash <<< http://URI is never influenced by a local cache ? I have been trying the no-cache option but it does not seem to apply to the hash subcommand ?


Thanks @Gabriel439. FWIW, before I saw your last message, I got around the problem by “clearing the cache everywhere”. And I haven’t been able to replicate the problem again (i.e. the hashes now match). When and if I do come across the problem again, I’ll respond here.


@Gabriel439: I was able to reproduce the mismatch using the smaller step as you suggested. What does that tell us?


@bsaul: The next step is to save the JSON representation of the two expressions that were hashed:

$ curl https://some.url.dhall | dhall --alpha | dhall encode --json > expression0.json
$ dhall --alpha <<< 'https://some.url.dhall' | dhall encode --json > expression1.json

… and then check to see what differs between them, either by comparing them by hand or using the diff command:

$ diff expression0.json expression1.json